2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 07/02/2011 *
4 * =================== Last change: 07/02/2011 *
6 * -------------------------------------------------------------------- *
7 * File : order_filter.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Filters for ext-order *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Filter fuer ext-order *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2012 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // Filter for returning given user's order points
44 function FILTER_ORDER_POINTS ($filterData) {
45 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
46 // Is ext-user installed and active?
47 if (isExtensionActive('user')) {
48 // Get the points and add them to the existing
49 $filterData['points'] += countSumTotalData($filterData['userid'], 'user_points', 'order_points');
52 // Return the data for next filter
53 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
57 // Filter for returning given user's locked order points
58 function FILTER_LOCKED_ORDER_POINTS ($filterData) {
59 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
60 // Is ext-user installed and active?
61 if (isExtensionActive('user')) {
62 // Get the points and add them to the existing
63 $filterData['points'] += countSumTotalData($filterData['userid'], 'user_points', 'locked_order_points');
66 // Return the data for next filter
67 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
71 // Filter for returning all user's order points column names
72 function FILTER_GET_ALL_ORDER_POINTS_COLUMN_NAMES ($filterData) {
73 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
74 // Add 'order_points' and 'locked_order_points'
75 $filterData['columns'] .= $filterData['alias'] . 'order_points' . $filterData['separator'] . $filterData['alias'] . 'locked_order_points' . $filterData['separator'];
77 // Return the data for next filter
78 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
82 // Filter for ZIP code inclusion (not exclusion but it must be run in exclusion filter chain)
83 function FILTER_ORDER_ZIP_CODE_SQL ($sql) {
84 // Check if category and number of receivers is okay
85 if ((isOrderMultiPageEnabled()) && (isPostRequestElementSet('zip')) && (postRequestElement('zip') != '')) {
86 // Choose recipients by ZIP code
88 $sql = sprintf(" WHERE `zip` LIKE '%s%%%%'",
89 bigintval(postRequestElement('zip'))
92 $sql .= sprintf(" AND `zip` LIKE '%s%%%%'",
93 bigintval(postRequestElement('zip'))
98 // Return expanded SQL
102 // Filter for adding columns of points to array
103 function FILTER_ORDER_POINTS_COLUMNS ($filterData) {
104 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
106 array_push($filterData, 'order_points');
108 // Return the data for next filter
109 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');