X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions%2Fext-booking.php;h=34f73f99fe99e44116e01edf999a9e424cea2c92;hb=8cab12aa2bd0bd1de03a377b37cd42faae64b0e1;hp=e04a8b8931cd4ef73f8dd8f9e6c85510003c8150;hpb=2acfc49984a0f9bb3adaf6366351d6ce604dcacd;p=mailer.git diff --git a/inc/extensions/ext-booking.php b/inc/extensions/ext-booking.php index e04a8b8931..34f73f99fe 100644 --- a/inc/extensions/ext-booking.php +++ b/inc/extensions/ext-booking.php @@ -14,12 +14,10 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2013 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -43,87 +41,90 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.0'); +setThisExtensionVersion('0.0.1'); -// Version history array (add more with , '0.1.0' and so on) -setExtensionVersionHistory(array('0.0')); - -// This extension is in development (non-productive) -enableExtensionProductive(false); +// Version history array (add more with , '0.0.1' and so on) +setExtensionVersionHistory(array('0.0.0', '0.0.1')); +// Check extension load-mode switch (getExtensionMode()) { - case 'register': // Do stuff when installation is running (modules.php?module=admin is called) + case 'setup': // Do stuff when installation is running // 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 ".(getConfig('ONE_DAY') * 3).""); + addConfigAddSql('booking_page_count', '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`"); - addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_book`( -`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, + addDropTableSql('user_booking'); + addCreateTableSql('user_booking', " +`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, -INDEX (`userid`), -PRIMARY KEY (`id`) -) TYPE={?_TABLE_TYPE?} COMMENT='Member points booking table'"); +`comments` TINYTEXT NULL DEFAULT NULL, +`recorded` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`booking_id`), +INDEX (`userid`)", + 'Member points booking table'); // Admin menu addAdminMenuSql('setup','config_booking','Kontoauszug','Einstellungen am Kontoauszug für Mitglieder vornehmen.', 14); - addAdminMenuSql('user','list_booking','Kontoauszug','Kontoauszüge aller Ihrer Mitglieder oder eines einzelnen Mitgliedes anzeigen.',10); + addAdminMenuSql('user','list_booking','Kontoauszüge','Kontoauszüge aller Ihrer Mitglieder oder eines einzelnen Mitgliedes anzeigen.',10); // Member menu - addMemberMenuSql('main','booking','{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Kontoauszug','N','Y',5); + addMemberMenuSql('main', 'booking', '{OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Kontoauszug', 5); // Add the filters - registerFilter('add_points', 'ADD_BOOKING_RECORD', false, true, getExtensionDryRun()); - registerFilter('sub_points', 'ADD_BOOKING_RECORD', false, true, getExtensionDryRun()); + 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 - addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_book`"); + addDropTableSql('user_booking'); 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('add_points', 'ADD_BOOKING_RECORD', true, getExtensionDryRun()); - unregisterFilter('sub_points', 'ADD_BOOKING_RECORD', true, getExtensionDryRun()); + 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 idbooking_id, da id zu allgemein ist (sollte am besten überall folgen)."); 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 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 // [EOF] ?>