X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-cash_coupon.php;h=7718abc36c28129a9caedd600ecc945f5b372ca2;hb=f6014bce7255a915872f2f463247440c0d58f9a9;hp=7c9a24241f70e230ead3059a5bc239b7ef87932f;hpb=4867976d90c806a03bb0848886f1e175c68cf3a4;p=mailer.git diff --git a/inc/modules/member/what-cash_coupon.php b/inc/modules/member/what-cash_coupon.php index 7c9a24241f..7718abc36c 100644 --- a/inc/modules/member/what-cash_coupon.php +++ b/inc/modules/member/what-cash_coupon.php @@ -17,7 +17,7 @@ * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -54,10 +54,12 @@ if ((!isExtensionActive('coupon')) && (!isAdmin())) { // Is the form sent? if (isFormSent()) { // Is the coupon code entered? - if (isPostRequestParameterSet('coupon_code')) { + if (isPostRequestElementSet('coupon_code')) { // Search for the coupon $result = SQL_QUERY_ESC("SELECT c.`coupon_id`, + c.`userid`, + c.`coupon_code`, UNIX_TIMESTAMP(d.`coupon_created`) AS `coupon_created`, UNIX_TIMESTAMP(d.`coupon_expired`) AS `coupon_expired`, d.`coupon_type`, @@ -78,7 +80,7 @@ WHERE UNIX_TIMESTAMP(d.`coupon_expired`) > UNIX_TIMESTAMP() LIMIT 1", array( - postRequestParameter('coupon_code'), + postRequestElement('coupon_code'), getMemberId() ), __FILE__, __LINE__); @@ -87,6 +89,9 @@ LIMIT 1", // Load data $content = SQL_FETCHARRAY($result); + // Run pre-filter + $content = runFilterChain('pre_cash_coupon', $content); + // Mark it as "cashed" SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_coupons` @@ -98,7 +103,7 @@ WHERE `userid`=%s LIMIT 1", array( - postRequestParameter('coupon_code'), + postRequestElement('coupon_code'), getMemberId() ), __FILE__, __LINE__); @@ -118,21 +123,8 @@ LIMIT 1", debug_report_bug(__FILE__, __LINE__, 'Coupon data cannot be updated! coupon_id=' . $content['coupon_id']); } // END - if - // Now we just need to book that points on the user's account - 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 - subtractPoints('cashed_coupon', getConfig('coupon_userid'), $content['points']); - } // END - if - - // Translate some data - $content['coupon_expired'] = generateDateTime($content['coupon_expired'], '0'); - $content['coupon_created'] = generateDateTime($content['coupon_created'], '0'); - - // Send admin notification - sendAdminNotification('{--ADMIN_COUPON_CASHED_SUBJECT--}', 'admin_coupon_cashed', $content, getMemberId()); + // Run post filter chain + $content = runFilterChain('post_cash_coupon', $content); // Display message displayMessage('{%message,MEMBER_COUPON_CODE_CASHED=' . $content['points'] . '%}');