-EXT_SET_VERSION("0.0.4");
-
-// Version history array (add more with , "0.1" and so on)
-EXT_SET_VER_HISTORY(array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4"));
-
-switch ($EXT_LOAD_MODE)
-{
-case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
- // SQL commands to run
- ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_wernis`");
- ADD_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_user_wernis` (
-id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-wernis_account VARCHAR(255) NOT NULL DEFAULT '',
-wernis_amount FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
-wernis_timestamp VARCHAR(10) NOT NULL DEFAULT 0,
-wernis_type ENUM('IN','OUT','FAILED') NOT NULL DEFAULT 'FAILED',
-wernis_api_message TINYTEXT,
-wernis_api_status VARCHAR(255) NULL DEFAULT NULL,
-KEY(userid),
-PRIMARY KEY(id)
-) TYPE={!_TABLE_TYPE!}");
-
- // Confiuration
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_min_payout BIGINT(20) UNSIGNED NOT NULL DEFAULT '40000'");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_min_withdraw BIGINT(20) UNSIGNED NOT NULL DEFAULT '5000'");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_api_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_api_md5 VARCHAR(32) NOT NULL DEFAULT ''");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_api_url VARCHAR(255) NOT NULL DEFAULT 'http://www.wds66.com/api/'");
-
- // User data
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD wernis_userid VARCHAR(6) NOT NULL DEFAULT ''");
-
- // Admin menu
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('wernis', NULL, 'Wernis-Management','Konfiguration zur WDS66-API einstellen, Auszahlungen auflisten usw..', 15)");
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('wernis','config_wernis','WDS66-API-Einstellungen','Konfiguration zur WDS66-API einstellen.', 1)");
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('wernis','list_wernis','Wernis-Anfragen auflisten','Listet alle Wernis-Auszahlungsanfragen Ihrer Mitglieder auf.', 2)");
-
- // Member menu
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','wernis','Wernis-Ein-/Auszahlungen','N','N', 11)");
-
- // Guest menu
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('main','wernis_portal','WDS66-News','N','N', 7)");
- break;
-
-case "remove": // Do stuff when removing extension
- // SQL commands to run
- ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_wernis`");
- ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='wernis'");
- ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `what`='wernis'");
- ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `what`='wernis_portal'");
- break;
-
-case "activate": // Do stuff when admin activates this extension
- // SQL commands to run
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='Y', `locked`='N' WHERE `what`='wernis_portal' LIMIT 1");
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='wernis' LIMIT 1");
- break;
-
-case "deactivate": // Do stuff when admin deactivates this extension
- // SQL commands to run
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='N', `locked`='Y' WHERE `what`='wernis_portal' LIMIT 1");
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='wernis' LIMIT 1");
- break;
-
-case "update": // Update an extension
- switch ($EXT_VER)
- {
- case "0.0.1": // SQL queries for v0.0.1
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_payout_active ENUM ('Y','N') NOT NULL DEFAULT 'Y'");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_withdraw_active ENUM ('Y','N') NOT NULL DEFAULT 'Y'");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_payout_factor FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_withdraw_factor FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_payout_fee_percent FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_withdraw_fee_percent FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_payout_fee_fix BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_withdraw_fee_fix BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
-
- // Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Ein-/Auszahlungsfunktion getrennt ein- und ausschaltbar, sowie mit Umrechungsfaktoren {!POINTS!}->Wernis versehen. Prozentualer Abzug als "Betreibergebühr hinzugefügt, was z.B. für Wechselstuben interessant ist.");
+setThisExtensionVersion('0.0.5');
+
+// Version history array (add more with , '0.0.1' and so on)
+setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5'));
+
+switch (getExtensionMode()) {
+ case 'setup': // Do stuff when installation is running
+ // SQL commands to run
+ addDropTableSql('user_wernis');
+ addCreateTableSql('user_wernis', "
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`wernis_account` VARCHAR(255) NOT NULL DEFAULT '',
+`wernis_amount` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+`wernis_timestamp` VARCHAR(10) NOT NULL DEFAULT 0,
+`wernis_type` ENUM('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED',
+`wernis_api_message` TINYTEXT NOT NULL,
+`wernis_api_status` VARCHAR(255) NULL DEFAULT NULL,
+PRIMARY KEY (`id`),
+INDEX (`userid`)",
+ 'Transfered Wernis per user');
+
+ // Confiuration
+ addConfigAddSql('wernis_min_payout', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 40000');
+ addConfigAddSql('wernis_min_withdraw', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 5000');
+ addConfigAddSql('wernis_api_id', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+ addConfigAddSql('wernis_api_md5', "VARCHAR(32) NOT NULL DEFAULT ''");
+ addConfigAddSql('wernis_api_url', "VARCHAR(255) NOT NULL DEFAULT 'http://www.wds66.com/api/'");
+
+ // User data
+ addExtensionAddTableColumnSql('user_data', 'wernis_userid', "VARCHAR(6) NOT NULL DEFAULT ''");
+
+ // Admin menu
+ addAdminMenuSql('wernis', NULL, 'Wernis-Management', 'Konfiguration zur WDS66-API einstellen, Auszahlungen auflisten usw..', 15);
+ addAdminMenuSql('wernis', 'config_wernis', 'WDS66-API-Einstellungen', 'Konfiguration zur WDS66-API einstellen.', 1);
+ addAdminMenuSql('wernis', 'list_wernis', 'Anfragen auflisten', 'Listet alle Wernis-Ein- und -auszahlungsanfragen Ihrer Mitglieder und Sponsoren auf.', 2);
+
+ // Member menu
+ addMemberMenuSql('main', 'wernis', 'Wernis-Ein-/Auszahlungen', 11);
+
+ // Guest menu
+ addGuestMenuSql('main', 'wernis_portal', 'WDS66-News', 7);