]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-order.php
More rewrites to configuration:
[mailer.git] / inc / modules / member / what-order.php
index a1f7a2a08f284aa3a8a87311af2bbb1a6c940f4c..38c953be9906c1a25073a9a6caba076e9279b7e1 100644 (file)
@@ -56,7 +56,7 @@ $data = array(
 );
 
 $ALLOWED = getUserData('receive_mails') - getUserData('mail_orders');
-if (getConfig('order_max_full') == 'MAX') $ALLOWED = getUserData('receive_mails');
+if (getOrderMaxFull() == 'MAX') $ALLOWED = getUserData('receive_mails');
 
 // Now check his points amount
 $totalPoints = getTotalPoints(getMemberId());
@@ -69,6 +69,7 @@ if ((isExtensionInstalledAndNewer('holiday', '0.1.3')) && (isUserDataEnabled('ho
        // Continue with the frametester, we first need to store the data temporary in the pool
        //
        // First we would like to store the data and get it's pool position back...
+       // @TODO Try to move out url_tlock to a filter for extra SQL statements
        $result = SQL_QUERY_ESC("SELECT
        `id`,
        `data_type`
@@ -107,7 +108,7 @@ LIMIT 1",
                        $TEST = str_replace(array(PHP_EOL, chr(13)), array('', ''), postRequestElement('text'));
 
                        // Text length within allowed length?
-                       if (strlen($TEST) > getConfig('max_tlength')) {
+                       if (strlen($TEST) > getMaxTextLength()) {
                                // Text is too long!
                                $data['url'] = 'modules.php?module=login&what=order&code=' . getCode('OVERLENGTH');
                        } // END - if
@@ -245,7 +246,7 @@ LIMIT 1",
                        } // END - if
 
                        // Calculate used points
-                       $usedPoints = $content['target_send'] * getPaymentData(bigintval(postRequestElement('mail_type')));
+                       $usedPoints = $content['target_send'] * getPaymentPrice(bigintval(postRequestElement('mail_type')));
 
                        // Fix empty zip code
                        if (!isPostRequestElementSet('zip')) {
@@ -428,10 +429,10 @@ LIMIT 1",
 } elseif (postRequestElement('receiver') == '0') {
        // Not enougth receivers selected
        $data['url'] = 'modules.php?module=login&what=order&code=' . getCode('MORE_RECEIVERS1');
-} elseif (($ALLOWED == '0') && (getConfig('order_max_full') == 'ORDER')) {
+} elseif (($ALLOWED == '0') && (getOrderMaxFull() == 'ORDER')) {
        // No more mail orders allowed
        displayMessage('{--MEMBER_ORDER_ALLOWED_EXHAUSTED--}');
-} elseif (getTotalUnconfirmedMails(getMemberId()) < getConfig('unconfirmed')) {
+} elseif (getTotalUnconfirmedMails(getMemberId()) < getConfig('max_unconfirmed')) {
        // Show only enabled categories to the user ...
        $whereStatement = " WHERE `visible`='Y'";
 
@@ -544,7 +545,7 @@ LIMIT 1",
                        SQL_FREERESULT($result_cats);
 
                        // Now we need to load the mail types...
-                       $result = SQL_QUERY("SELECT `id`, `price`, `payment`, `mail_title` FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `payment` ASC", __FILE__, __LINE__);
+                       $result = SQL_QUERY("SELECT `id`, `price`, `payment`, `mail_title` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `price` > 0 AND `payment` > 0 ORDER BY `payment` ASC", __FILE__, __LINE__);
 
                        $payments = array();
                        if (!SQL_HASZERONUMS($result)) {
@@ -566,7 +567,7 @@ LIMIT 1",
                                $content['total_points'] = $totalPoints;
 
                                // Check how many mail orders he has placed today and how many he's allowed to send
-                               switch (getConfig('order_max_full')) {
+                               switch (getOrderMaxFull()) {
                                        case 'MAX': // He is allowed to send as much as possible
                                                $content['order_max_full'] = '{--MEMBER_ORDER_ALLOWED_MAX--}';
                                                break;
@@ -576,7 +577,7 @@ LIMIT 1",
                                                break;
 
                                        default: // Unknown/invalid
-                                               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown order_mas_full config detected.", getConfig('order_max_full')));
+                                               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown order_mas_full config detected.", getOrderMaxFull()));
                                                $content['order_max_full'] = '{--MEMBER_ORDER_ALLOWED_UNKNOWN--}';
                                                break;
                                } // END - switch
@@ -636,13 +637,13 @@ LIMIT 1",
                                        $content['category_selection'] = generateCategoryOptionsList(((isExtensionActive('html_mail')) && (isPostRequestElementSet('html'))) ? postRequestElement('html') : 'N', getMemberId());
 
                                        // Mail type
-                                       $content['type_selection'] = '';
+                                       $content['payment_selection'] = '';
                                        foreach ($payments as $key => $value) {
                                                if (is_array($value)) {
                                                        // Output option line
-                                                       $content['type_selection'] .= '      <option value="' . $payments[$key]['id'] . '"';
-                                                       if (($OLD_ORDER) && ($content['payment_id'] == $payments[$key]['id'])) $content['type_selection'] .= ' selected="selected"';
-                                                       $content['type_selection'] .= '>{%pipe,translateComma=' . $payments[$key]['price'] . '%} {--PER_MAIL--} - ' . $payments[$key]['mail_title'] . ' - ' . round($payments[$key]['payment']) . ' {--PAYMENT--}</option>';
+                                                       $content['payment_selection'] .= '      <option value="' . $payments[$key]['id'] . '"';
+                                                       if (($OLD_ORDER) && ($content['payment_id'] == $payments[$key]['id'])) $content['payment_selection'] .= ' selected="selected"';
+                                                       $content['payment_selection'] .= '>{%pipe,translateComma=' . $payments[$key]['price'] . '%} {--PER_MAIL--} - ' . $payments[$key]['mail_title'] . ' - ' . round($payments[$key]['payment']) . ' {--PAYMENT--}</option>';
                                                } // END - if
                                        } // END - foreach