]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-coupon.php
Moved "fix" files (which only helps to fix stuff) in own inc/fixes/ folder.
[mailer.git] / inc / extensions / ext-coupon.php
index 4a90ed792057d8c8bf4a07332aefcb126e7765c0..544d111ea849deeade0610a4bf4884c0a4d7c4fe 100644 (file)
@@ -18,7 +18,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -49,7 +49,7 @@ setThisExtensionVersion('0.0.3');
 setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3'));
 
 switch (getExtensionMode()) {
-       case 'register': // Do stuff when installtion is running
+       case 'setup': // Do stuff when installtion is running
                // This extension requires an up-to-date ext-user
                addExtensionDependency('user');
                addExtensionDependency('autopurge');
@@ -64,7 +64,7 @@ switch (getExtensionMode()) {
 `total_created` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `total_cashed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
-`coupon_description` TEXT,
+`coupon_description` TEXT NOT NULL,
 PRIMARY KEY (`id`)",
                'Created coupons');
 
@@ -77,8 +77,8 @@ PRIMARY KEY (`id`)",
 `coupon_code` VARCHAR(30) NULL DEFAULT NULL,
 `cashed_on` TIMESTAMP NULL DEFAULT NULL,
 PRIMARY KEY (`id`),
-UNIQUE INDEX `coupon_user` (`coupon_id`,`userid`),
-UNIQUE (`coupon_code`)",
+UNIQUE INDEX `coupon_user` (`coupon_id`, `userid`),
+UNIQUE INDEX (`coupon_code`)",
                        'Coupon->user connection');
 
                // Configuration entries
@@ -88,7 +88,7 @@ UNIQUE (`coupon_code`)",
                addConfigAddSql('coupon_userid', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
 
                // User data table
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `receiving_coupons` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+               addExtensionAddTableColumnSql('user_data', 'receiving_coupons', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
 
                // Menu systems:
                //  - Admin entries
@@ -102,7 +102,7 @@ UNIQUE (`coupon_code`)",
                addMemberMenuSql('coupon', 'list_coupon', 'Eingelöste auflisten', 2);
 
                // Add filter (for changing user_points column dynamically
-               registerFilter(__FILE__, __LINE__, 'determine_points_column_name', 'COUPON_CHANGE_POINTS_COLUMN_NAME', false, true, isExtensionDryRun());
+               registerFilter(__FILE__, __LINE__, 'determine_points_column_name', 'COUPON_CHANGE_POINTS_COLUMN_NAME', FALSE, TRUE, isExtensionDryRun());
                break;
 
        case 'remove': // Do stuff when removing extension
@@ -116,8 +116,8 @@ UNIQUE (`coupon_code`)",
                unregisterExtensionPointsData('coupon_cashed');
 
                // Remove all filters
-               unregisterFilter(__FILE__, __LINE__, 'determine_points_column_name', 'COUPON_CHANGE_POINTS_COLUMN_NAME', true, isExtensionDryRun());
-               unregisterFilter(__FILE__, __LINE__, 'post_cash_coupon', 'POST_CASH_COUPON', true, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'determine_points_column_name', 'COUPON_CHANGE_POINTS_COLUMN_NAME', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'post_cash_coupon', 'POST_CASH_COUPON', TRUE, isExtensionDryRun());
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -137,8 +137,7 @@ UNIQUE (`coupon_code`)",
                                addConfigDropSql('coupon_payment_method');
                                addConfigDropSql('coupon_locked_points_mode');
 
-                               // This extension's update requires an up-to-date ext-sql_patches and ext-order
-                               addExtensionDependency('sql_patches');
+                               // This extension's update requires an up-to-date ext-order
                                addExtensionDependency('order');
 
                                // Insert data in new table
@@ -157,7 +156,7 @@ UNIQUE (`coupon_code`)",
                                break;
 
                        case '0.0.3': // SQL queries for v0.0.3
-                               registerFilter(__FILE__, __LINE__, 'post_cash_coupon', 'POST_CASH_COUPON', false, true, isExtensionDryRun());
+                               registerFilter(__FILE__, __LINE__, 'post_cash_coupon', 'POST_CASH_COUPON', FALSE, TRUE, isExtensionDryRun());
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes('Filter zum Post- und Pre-Filter hinzugefügt.');
@@ -175,7 +174,7 @@ UNIQUE (`coupon_code`)",
                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