]> git.mxchange.org Git - mailer.git/blobdiff - inc/filter/coupon_filter.php
earning_name renamed to earning_provider
[mailer.git] / inc / filter / coupon_filter.php
index 44f7ff921bf0716d30aa6d0cf0656b6b3494e253..1a1fea8454f666a10e0701b4b1fcde2bd5f2a739 100644 (file)
@@ -51,5 +51,30 @@ function FILTER_COUPON_CHANGE_POINTS_COLUMN_NAME ($filterData) {
        return $filterData;
 }
 
+// Filter to do generic post-coupon-cash things
+function FILTER_POST_CASH_COUPON ($filterData) {
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+       // Now we just need to book that points on the user's account
+       initReferalSystem();
+       addPointsThroughReferalSystem('coupon_cashed', $filterData['userid'], $filterData['points']);
+
+       // Subtract points from member account if the admin has selected one
+       if (isValidUserId(getCouponUserid())) {
+               // Subtract from this account and ignore return status
+               subtractPoints('cashed_coupon', getCouponUserid(), $filterData['points']);
+       } // END - if
+
+       // Translate some data
+       $filterData['coupon_expired'] = generateDateTime($filterData['coupon_expired'], '0');
+       $filterData['coupon_created'] = generateDateTime($filterData['coupon_created'], '0');
+
+       // Send admin notification
+       sendAdminNotification('{--ADMIN_COUPON_CASHED_SUBJECT--}', 'admin_coupon_cashed', $filterData, $filterData['userid']);
+
+       // Return data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
 // [EOF]
 ?>