]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-booking.php
Introduced 'per-what-word-wrapping
[mailer.git] / inc / extensions / ext-booking.php
index 01557fa3095680e0a16b542db25bbbf5857f3f78..aa0b3e4752548e5a987f0fd864234f2dc4a958e4 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,14 +41,12 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.0.0');
+setThisExtensionVersion('0.0.1');
 
 // Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0'));
-
-// This extension is in development (non-productive)
-enableExtensionProductive(false);
+setExtensionVersionHistory(array('0.0.0', '0.0.1'));
 
+// Check extension load-mode
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running
                // Configuration entries
@@ -58,14 +56,15 @@ switch (getExtensionMode()) {
                // Drop/create table for user bookings
                addDropTableSql('user_booking');
                addCreateTableSql('user_booking', "
-`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`booking_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `subject` VARCHAR(255) NOT NULL DEFAULT 'missing',
-`mode` ENUM('ADD','SUB') NOT NULL DEFAULT 'ADD',
+`points_mode` ENUM('ADD','SUB') NOT NULL DEFAULT 'ADD',
+`points_account_type` VARCHAR(255) NOT NULL DEFAULT 'INVALID',
 `points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.0000,
 `comments` TINYTEXT NULL DEFAULT NULL,
 `recorded` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-PRIMARY KEY (`id`),
+PRIMARY KEY (`booking_id`),
 INDEX (`userid`)",
                        'Member points booking table');
 
@@ -77,8 +76,9 @@ INDEX (`userid`)",
                addMemberMenuSql('main', 'booking', '{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Kontoauszug', 5);
 
                // Add the filters
-               registerFilter('post_add_points', 'ADD_BOOKING_RECORD', false, true, isExtensionDryRun());
-               registerFilter('post_sub_points', 'ADD_BOOKING_RECORD', false, true, isExtensionDryRun());
+               registerFilter(__FILE__, __LINE__, 'post_add_points', 'ADD_BOOKING_RECORD', FALSE, TRUE, isExtensionDryRun());
+               registerFilter(__FILE__, __LINE__, 'post_sub_points', 'ADD_BOOKING_RECORD', FALSE, TRUE, isExtensionDryRun());
+               registerFilter(__FILE__, __LINE__, 'member_admin_actions', 'ADD_BOOKING_MEMBER_ACTION', FALSE, TRUE, isExtensionDryRun());
                break;
 
        case 'remove': // Do stuff when removing extension
@@ -87,27 +87,28 @@ INDEX (`userid`)",
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='booking'");
 
                // Remove the filters
-               unregisterFilter(__FUNCTION__, __LINE__, 'post_add_points', 'ADD_BOOKING_RECORD', true, isExtensionDryRun());
-               unregisterFilter(__FUNCTION__, __LINE__, 'post_sub_points', 'ADD_BOOKING_RECORD', true, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'post_add_points', 'ADD_BOOKING_RECORD', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'post_sub_points', 'ADD_BOOKING_RECORD', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'member_admin_actions', 'ADD_BOOKING_MEMBER_ACTION', TRUE, isExtensionDryRun());
                break;
 
        case 'activate': // Do stuff when admin activates this extension
                // SQL commands to run
-               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='booking' LIMIT 1");
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what`='booking' LIMIT 1");
                break;
 
        case 'deactivate': // Do stuff when admin deactivates this extension
                // SQL commands to run
-               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='booking' LIMIT 1");
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `what`='booking' LIMIT 1");
                break;
 
        case 'update': // Update an extension
                switch (getCurrentExtensionVersion()) {
                        case '0.0.1': // SQL queries for v0.0.1
-                               addExtensionSql('');
+                               addExtensionChangeTableColumnSql('user_booking', 'id', 'booking_id', 'BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT');
 
                                // Update notes (these will be set as task text!)
-                               setExtensionUpdateNotes('');
+                               setExtensionUpdateNotes("Spalte <strong>id</strong umbenannt nach <strong>booking_id</strong>, da <em>id</em> zu allgemein ist (sollte am besten &uuml;berall folgen).");
                                break;
                } // END - switch