X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions%2Fext-coupon.php;h=18cb42983559d0a588581659ed57ff1128a318a5;hb=e78eede1b3ad977f89c45effc9a4ef1275d90214;hp=369c2eba1f5257de3f9cf7df6f789ec3bfd29e66;hpb=32abac7bad2e128e1c12aae311bdf7aa36421fb8;p=mailer.git diff --git a/inc/extensions/ext-coupon.php b/inc/extensions/ext-coupon.php index 369c2eba1f..18cb429835 100644 --- a/inc/extensions/ext-coupon.php +++ b/inc/extensions/ext-coupon.php @@ -43,10 +43,10 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.0.1'); +setThisExtensionVersion('0.0.3'); // Version history array (add more with , '0.1' and so on) -setExtensionVersionHistory(array('0.0.0', '0.0.1')); +setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3')); switch (getExtensionMode()) { case 'register': // Do stuff when installtion is running @@ -56,7 +56,7 @@ switch (getExtensionMode()) { // Coupon data addDropTableSql('coupon_data'); - addCreateTableSql('coupon_data', "( + addCreateTableSql('coupon_data', " `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `coupon_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `coupon_expired` TIMESTAMP NULL DEFAULT NULL, @@ -65,21 +65,21 @@ switch (getExtensionMode()) { `total_cashed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000, `coupon_description` TEXT, -PRIMARY KEY (`id`) -) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Created coupons'"); +PRIMARY KEY (`id`)", + 'Created coupons'); // Coupon->user connection table addDropTableSql('user_coupons'); - addCreateTableSql('user_coupons', "( + addCreateTableSql('user_coupons', " `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `coupon_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `userid` BIGINT(2) UNSIGNED NOT NULL DEFAULT 0, `coupon_code` VARCHAR(30) NULL DEFAULT NULL, `cashed_on` TIMESTAMP NULL DEFAULT NULL, PRIMARY KEY (`id`), -UNIQUE KEY `coupon_user` (`coupon_id`,`userid`), -UNIQUE KEY (`coupon_code`) -) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Coupon->user connection'"); +UNIQUE `coupon_user` (`coupon_id`,`userid`), +UNIQUE (`coupon_code`)", + 'Coupon->user connection'); // Configuration entries addConfigAddSql('coupon_default_time', 'BIGINT(20) NOT NULL DEFAULT ' . (getOneDay() * 7)); @@ -97,9 +97,9 @@ UNIQUE KEY (`coupon_code`) addAdminMenuSql('coupon', 'send_coupon', 'Versenden/Neuen erstellen', 'Versendet neue Gutscheine an die Mitglieder. Wenn Sie auf "Absenden" klicken, warten Sie bitte die Folgeseite ab, da der Versand der Gutscheine derzeit nicht gepoolt ist.', 2); addAdminMenuSql('coupon', 'config_coupon', 'Einstellungen', 'Allgemeine Einstellungen zu Code-Gutscheinen und Gutscheinen von Sponsoren (z.B. per API) können hier vorgenommen werden.', 3); // - Member entries - addMemberMenuSql('coupon', NULL, 'Gutscheine', 'N', 'Y', 3); - addMemberMenuSql('coupon', 'cash_coupon', 'Gutschein einlösen', 'N', 'Y', 1); - addMemberMenuSql('coupon', 'list_coupon', 'Eingelöste auflisten', 'N', 'Y', 2); + addMemberMenuSql('coupon', NULL, 'Gutscheine', 3); + addMemberMenuSql('coupon', 'cash_coupon', 'Gutschein einlösen', 1); + addMemberMenuSql('coupon', 'list_coupon', 'Eingelöste auflisten', 2); // Add filter (for changing user_points column dynamically registerFilter('determine_points_column_name', 'COUPON_CHANGE_POINTS_COLUMN_NAME', false, true, isExtensionDryRun()); @@ -114,6 +114,7 @@ UNIQUE KEY (`coupon_code`) // Remove all filters unregisterFilter(__FUNCTION__, __LINE__, 'determine_points_column_name', 'COUPON_CHANGE_POINTS_COLUMN_NAME', true, isExtensionDryRun()); + unregisterFilter(__FUNCTION__, __LINE__, 'post_cash_coupon', 'POST_CASH_COUPON', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension @@ -138,11 +139,26 @@ UNIQUE KEY (`coupon_code`) addExtensionDependency('order'); // Insert data in new table - addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`ext_name`,`column_name`,`locked_mode`,`payment_method`) VALUES('coupon','order_points','LOCKED','DIRECT')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('coupon_cashed','order_points','LOCKED','DIRECT')"); // Update notes (these will be set as task text!) setExtensionUpdateNotes(''); break; + + case '0.0.2': // SQL queries for v0.0.2 + // Update data in points_data table + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_points_data` SET `subject`='coupon_cashed' WHERE `subject`='coupon' LIMIT 1"); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes('Eintrag in {CONFIG_OPEN}_MYSQL_PREFIX{CONFIG_CLOSE}_points_data umbenannt.'); + break; + + case '0.0.3': // SQL queries for v0.0.3 + registerFilter('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.'); + break; } // END - switch break;