X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffilter%2Forder_filter.php;h=4abbd40c7c6972dfd70bf8ba93677f5bbcf5ec39;hb=d3ea83baa3f2607db46c26f7d8527c84b994f116;hp=87e17902ea587023230fffc782ad1c4555e0dd3a;hpb=36c6c72729568a58124c7a5dba6562801cd15865;p=mailer.git diff --git a/inc/filter/order_filter.php b/inc/filter/order_filter.php index 87e17902ea..4abbd40c7c 100644 --- a/inc/filter/order_filter.php +++ b/inc/filter/order_filter.php @@ -16,8 +16,8 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * 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 * @@ -41,15 +41,73 @@ if (!defined('__SECURITY')) { } // END - if // Filter for returning given user's order points -function FILTER_ORDER_POINTS ($data) { +function FILTER_ORDER_POINTS ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Is ext-user installed and active? if (isExtensionActive('user')) { // Get the points and add them to the existing - $data['points'] += countSumTotalData($data['userid'], 'user_points', 'order_points'); + $filterData['points'] += countSumTotalData($filterData['userid'], 'user_points', 'order_points'); } // END - if // Return the data for next filter - return $data; + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; +} + +// Filter for returning given user's locked order points +function FILTER_LOCKED_ORDER_POINTS ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + // Is ext-user installed and active? + if (isExtensionActive('user')) { + // Get the points and add them to the existing + $filterData['points'] += countSumTotalData($filterData['userid'], 'user_points', 'locked_order_points'); + } // END - if + + // Return the data for next filter + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; +} + +// Filter for returning all user's order points column names +function FILTER_GET_ALL_ORDER_POINTS_COLUMN_NAMES ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + // Add 'order_points' and 'locked_order_points' + $filterData['columns'] .= $filterData['alias'] . 'order_points' . $filterData['separator'] . $filterData['alias'] . 'locked_order_points' . $filterData['separator']; + + // Return the data for next filter + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; +} + +// Filter for ZIP code inclusion (not exclusion but it must be run in exclusion filter chain) +function FILTER_ORDER_ZIP_CODE_SQL ($sql) { + // Check if category and number of receivers is okay + if ((isOrderMultiPageEnabled()) && (isPostRequestElementSet('zip')) && (postRequestElement('zip') != '')) { + // Choose recipients by ZIP code + if (empty($sql)) { + $sql = sprintf(" WHERE d.`zip` LIKE '%s%%'", + bigintval(postRequestElement('zip')) + ); + } else { + $sql .= sprintf(" AND d.`zip` LIKE '%s%%'", + bigintval(postRequestElement('zip')) + ); + } + } // END - if + + // Return expanded SQL + return $sql; +} + +// Filter for adding columns of points to array +function FILTER_ORDER_POINTS_COLUMNS ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + // Add column + array_push($filterData, 'order_points'); + + // Return the data for next filter + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; } // [EOF]