A lot has been rewritten, ext-teams added, ext-forced continued:
[mailer.git] / inc / modules / member / what-cash_coupon.php
index da4e810d4b8c9d28ad6bac0363a8447c0c5c65f3..bbc77f1aabeb68e5254e682fca838b748b5d9e72 100644 (file)
@@ -47,7 +47,7 @@ addYouAreHereLink('member', __FILE__);
 
 // Continue only if the proper extension is active (admins can always continue)
 if ((!isExtensionActive('coupon')) && (!isAdmin())) {
-       displayMessage(generateExtensionInactiveNotInstalledMessage('coupon'));
+       displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=coupon%}');
        return;
 } // END - if
 
@@ -119,11 +119,12 @@ LIMIT 1",
                        } // END - if
 
                        // Now we just need to book that points on the user's account
-                       addPointsThroughReferalSystem('coupon_cashed', getMemberId(), $content['points'], false, 0, getConfig('coupon_payment_method'));
+                       initReferalSystem();
+                       addPointsThroughReferalSystem('coupon_cashed', getMemberId(), $content['points']);
 
                        // Subtract points from member account if the admin has selected one
                        if (isValidUserId(getConfig('coupon_userid'))) {
-                               // Subtract from this account
+                               // Subtract from this account and ignore return status
                                subtractPoints('cashed_coupon', getConfig('coupon_userid'), $content['points']);
                        } // END - if
 
@@ -135,7 +136,7 @@ LIMIT 1",
                        sendAdminNotification('{--ADMIN_COUPON_CASHED_SUBJECT--}', 'admin_coupon_cashed', $content, getMemberId());
 
                        // Display message
-                       displayMessage(getMaskedMessage('MEMBER_COUPON_CODE_CASHED', $content['points']));
+                       displayMessage('{%message,MEMBER_COUPON_CODE_CASHED=' . $content['points'] . '%}');
                } else {
                        // No coupon found
                        displayMessage('{--MEMBER_COUPON_CODE_ALREADY_CASHED--}');
@@ -149,7 +150,7 @@ LIMIT 1",
        }
 } elseif (isFormSent('change')) {
        // Change receive status, depending on its current state
-       if (getUserData('receiving_coupons') == 'Y') {
+       if (isUserDataEnabled('receiving_coupons')) {
                // Unsubscribe from coupons
                $message = '{--MEMBER_COUPON_RECEIVE_STATUS_UNSUBSCRIBED--}';
                $newStatus = 'N';