]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-order.php
Requires business card for payout :(
[mailer.git] / inc / extensions / ext-order.php
index 8734affb94a6cf076c688977802bcc65113f6c25..ee03201c4ede5a7c708917a5e062f50473ea8d54 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * 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 *
@@ -41,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.5.3');
+setThisExtensionVersion('0.5.6');
 
 // Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3'));
+setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6'));
 
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running
@@ -59,8 +59,12 @@ switch (getExtensionMode()) {
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='order'");
 
                // Remove these filters
-               unregisterFilter(__FUNCTION__, __LINE__, 'get_total_points', 'ORDER_POINTS', true, isExtensionDryRun());
-               unregisterFilter(__FUNCTION__, __LINE__, 'get_own_points', 'ORDER_POINTS', true, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'get_total_points', 'ORDER_POINTS', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'get_own_points', 'ORDER_POINTS', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'get_locked_points', 'LOCKED_ORDER_POINTS', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'get_all_point_columns', 'GET_ALL_ORDER_POINTS_COLUMN_NAMES', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'user_exclusion_sql', 'ORDER_ZIP_CODE_SQL', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'locked_points_columns_array', 'ORDER_POINTS_COLUMNS', TRUE, isExtensionDryRun());
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -86,7 +90,7 @@ switch (getExtensionMode()) {
                                break;
 
                        case '0.1.1': // SQL queries for v0.1.1
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `mail_orders` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+                               addExtensionAddTableColumnSql('user_data', 'mail_orders', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Maximale Mailbuchung vervollständigt (Admin-Bereich und im Buchungsformular selber).");
@@ -331,18 +335,45 @@ INDEX (`pool_id`)",
                                break;
 
                        case '0.5.3': // SQL queries for v0.5.3
-                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` ADD `order_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
-                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` ADD `locked_order_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
+                               addExtensionAddTableColumnSql('user_points', 'order_points', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
+                               addExtensionAddTableColumnSql('user_points', 'locked_order_points', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
 
                                // This update depends on ext-user
                                addExtensionDependency('user');
 
                                // Register filters for gathering points
-                               registerFilter(__FUNCTION__, __LINE__, 'get_total_points', 'ORDER_POINTS', true, isExtensionDryRun());
-                               registerFilter(__FUNCTION__, __LINE__, 'get_own_points', 'ORDER_POINTS', true, isExtensionDryRun());
+                               registerFilter(__FILE__, __LINE__, 'get_total_points', 'ORDER_POINTS', FALSE, TRUE, isExtensionDryRun());
+                               registerFilter(__FILE__, __LINE__, 'get_own_points', 'ORDER_POINTS', FALSE, TRUE, isExtensionDryRun());
 
                                // Update notes (these will be set as task text!)
-                               setExtensionUpdateNotes("Weiteres {?POINTS?}-Guthabenkonto "Werbeguthaben" hinzugefügt (verschoben von ext-user) und neue Filter zum Zurückliefern des Werbeguthabens hinzugefügt.");
+                               setExtensionUpdateNotes("Weiteres Verwendungszwecke "Werbeguthaben" hinzugefügt (verschoben von ext-user) und neue Filter zum Zurückliefern des Werbeguthabens hinzugefügt.");
+                               break;
+
+                       case '0.5.4': // SQL queries for v0.5.4
+                               // Register filter for handling locked points
+                               registerFilter(__FILE__, __LINE__, 'get_locked_points', 'LOCKED_ORDER_POINTS', FALSE, TRUE, isExtensionDryRun());
+
+                               // Register filter for all column names
+                               registerFilter(__FILE__, __LINE__, 'get_all_point_columns', 'GET_ALL_ORDER_POINTS_COLUMN_NAMES', FALSE, TRUE, isExtensionDryRun());
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Filter für gesperrtes Werbeguthaben hinzugefügt.");
+                               break;
+
+                       case '0.5.5': // SQL queries for v0.5.5
+                               // Register filter
+                               registerFilter(__FILE__, __LINE__, 'user_exclusion_sql', 'ORDER_ZIP_CODE_SQL', FALSE, TRUE, isExtensionDryRun());
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Filter für gesperrtes Werbeguthaben hinzugefügt.");
+                               break;
+
+                       case '0.5.6': // SQL queries for v0.5.6
+                               // Register filter
+                               registerFilter(__FILE__, __LINE__, 'locked_points_columns_array', 'ORDER_POINTS_COLUMNS', FALSE, TRUE, isExtensionDryRun());
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Filter für Spaltenname des gesperrten Werbeguthabens hinzugefügt.");
                                break;
                } // END - switch
                break;
@@ -354,19 +385,13 @@ INDEX (`pool_id`)",
                break;
 
        case 'init': // Do stuff when extension is initialized
-               // Do daily reset only when installed and extension version is at least 0.1.1
-               // @TODO This should be moved out to inc/daily/
-               if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (isExtensionInstalledAndNewer('order', '0.1.1'))) {
-                       // Reset mail order values
-                       $result_ext = SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `mail_orders`=0 WHERE `mail_orders` > 0', __FILE__, __LINE__);
-               } // END - if
                break;
 
        case 'init': // Do stuff when extension is initialized
                break;
 
        default: // Unknown extension mode
-               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
+               reportBug(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
 } // END - switch