]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-send_coupon.php
Introduced padLeftZero()
[mailer.git] / inc / modules / admin / what-send_coupon.php
index 38244178440f975fbde16a117bd213226d8748e2..5d8ec24a8254d25303bb63603161de92747f47bd 100644 (file)
@@ -84,23 +84,29 @@ ORDER BY
                        // Get the insert id from the table
                        $couponId = SQL_INSERTID();
 
+                       // Init userid array
+                       $adminUserids = array();
+
                        // Load entry
                        while (list($userid) = SQL_FETCHROW($result)) {
+                               // Debug message
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'NUMS=' . SQL_NUMROWS($result) . ',userid=' . $userid);
+
                                // By default no code is unique
-                               $isUnique = false;
+                               $isUnique = FALSE;
                                $couponCode = '';
 
                                // Look for a unique id
                                while (!$isUnique) {
                                        /*
-                                        * Add a coupon for this user, first we need to create a
-                                        * table-unique "id". The function generatePassword() can do
-                                        * this job for us but we want to exclude some characters.
+                                        * Add a coupon for this user, first generate a
+                                        * "table-unique" id number. generatePassword() can do this
+                                        * but with some characters excluded.
                                         */
                                        $couponCode = generatePassword(30, array('-', '+', '_', '/', '.'));
 
                                        // Is it really unique?
-                                       $isUnique = (countSumTotalData($couponCode, 'user_coupons', 'id', 'coupon_code', true) == 0);
+                                       $isUnique = (countSumTotalData($couponCode, 'user_coupons', 'id', 'coupon_code', TRUE) == 0);
                                } // END - while
 
                                // The above loop should always set $couponCode, so we can now insert it
@@ -158,7 +164,7 @@ ORDER BY
        $content['coupon_default_time_selection'] = createConfigurationTimeSelections('coupon_default_time', 'WDh');
 
        // Load template
-       loadTemplate('admin_send_coupon', false, $content);
+       loadTemplate('admin_send_coupon', FALSE, $content);
 }
 
 // [EOF]