Introduced function determinePointsColumnFromSubjectLocked(), renamed filter:
[mailer.git] / inc / extensions / ext-booking.php
index 7900d6d41aea2f2c4e7c9350658cb816045dff8c..aa0f8f1ee2547f5bcb4978af55e1d6eaf7414585 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -52,11 +52,11 @@ enableExtensionProductive(false);
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // Configuration entries
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `booking_per_page` TINYINT(3) UNSIGNED NOT NULL DEFAULT 10");
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `booking_purge` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay() * 3)."");
+               addConfigAddSql('booking_per_page', "TINYINT(3) UNSIGNED NOT NULL DEFAULT 10");
+               addConfigAddSql('booking_purge', "BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay() * 3)."");
 
                // Drop/create table for user bookings
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_book`');
+               addDropTableSql('user_book');
                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_book`(
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
@@ -67,7 +67,7 @@ switch (getExtensionMode()) {
 `recorded` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 INDEX (`userid`),
 PRIMARY KEY (`id`)
-) TYPE={?_TABLE_TYPE?} COMMENT='Member points booking table'");
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Member points booking table'");
 
                // Admin menu
                addAdminMenuSql('setup','config_booking','Kontoauszug','Einstellungen am Kontoauszug für Mitglieder vornehmen.', 14);
@@ -77,17 +77,17 @@ PRIMARY KEY (`id`)
                addMemberMenuSql('main','booking','{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Kontoauszug','N','Y',5);
 
                // Add the filters
-               registerFilter('add_points', 'ADD_BOOKING_RECORD', false, true, isExtensionDryRun());
+               registerFilter('post_add_points', 'ADD_BOOKING_RECORD', false, true, isExtensionDryRun());
                registerFilter('sub_points', 'ADD_BOOKING_RECORD', false, true, isExtensionDryRun());
                break;
 
        case 'remove': // Do stuff when removing extension
-               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_book`');
+               addDropTableSql('user_book');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_booking','list_booking')");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='booking'");
 
                // Remove the filters
-               unregisterFilter(__FUNCTION__, __LINE__, 'add_points', 'ADD_BOOKING_RECORD', true, isExtensionDryRun());
+               unregisterFilter(__FUNCTION__, __LINE__, 'post_add_points', 'ADD_BOOKING_RECORD', true, isExtensionDryRun());
                unregisterFilter(__FUNCTION__, __LINE__, 'sub_points', 'ADD_BOOKING_RECORD', true, isExtensionDryRun());
                break;
 
@@ -109,12 +109,12 @@ PRIMARY KEY (`id`)
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes('');
                                break;
-               }
+               } // END - switch
 
        case 'modify': // When the extension got modified
                break;
 
-       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+       case 'test': // For testing purposes
                break;
 
        case 'init': // Do stuff when extension is initialized
@@ -123,7 +123,7 @@ PRIMARY KEY (`id`)
        default: // Unknown extension mode
                logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
-}
+} // END - switch
 
 // [EOF]
 ?>