From 73078fa11b256ad3d835566d0c284691887d9a7c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 15 Jul 2011 20:33:00 +0000 Subject: [PATCH] We require FAILED, sorry folks --- inc/extensions/ext-funcoins.php | 2 +- inc/extensions/ext-primera.php | 2 +- inc/extensions/ext-wernis.php | 13 ++++++++++--- inc/language/wernis_de.php | 1 + inc/libs/wernis_functions.php | 22 ++++++++++------------ 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/inc/extensions/ext-funcoins.php b/inc/extensions/ext-funcoins.php index 13f20a0dae..638a5b161e 100644 --- a/inc/extensions/ext-funcoins.php +++ b/inc/extensions/ext-funcoins.php @@ -63,7 +63,7 @@ switch (getExtensionMode()) { `funcoins_account` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'FunCoins account', `funcoins_amount` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000 COMMENT 'Transfered amount', `funcoins_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Booking timestamp', -`funcoins_type` ENUM('WITHDRAW','PAYOUT') NOT NULL DEFAULT 'PAYOUT' COMMENT 'Transaction type', +`funcoins_type` ENUM('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED' COMMENT 'Transaction type', `fucoins_tan` VARCHAR(255) NULL DEFAULT NULL COMMENT 'TAN from API', `funcoins_api_response` TINYTEXT COMMENT 'Clear text API response (only for debugging)', `funcoins_api_status` INT(4) NULL DEFAULT NULL COMMENT 'Status code from API', diff --git a/inc/extensions/ext-primera.php b/inc/extensions/ext-primera.php index 9d7373da88..6b0f8b1aa2 100644 --- a/inc/extensions/ext-primera.php +++ b/inc/extensions/ext-primera.php @@ -61,7 +61,7 @@ switch (getExtensionMode()) { `primera_account` VARCHAR(255) NOT NULL DEFAULT '', `primera_amount` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000, `primera_timestamp` VARCHAR(10) NOT NULL DEFAULT 0, -`primera_type` ENUM('IN','OUT','FAILED') NOT NULL DEFAULT 'FAILED', +`primera_type` ENUM('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED', `primera_api_message` TINYTEXT, `primera_api_status` VARCHAR(255) NULL DEFAULT NULL, PRIMARY KEY (`id`), diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 47e8c7d84b..c0cde98b9a 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -41,10 +41,10 @@ if (!defined('__SECURITY')) { } // END - if // Version of this extension -setThisExtensionVersion('0.0.4'); +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')); +setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5')); switch (getExtensionMode()) { case 'register': // Do stuff when installation is running @@ -56,7 +56,7 @@ switch (getExtensionMode()) { `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') NOT NULL DEFAULT 'OUT', +`wernis_type` ENUM('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED', `wernis_api_message` TINYTEXT, `wernis_api_status` VARCHAR(255) NULL DEFAULT NULL, PRIMARY KEY (`id`), @@ -144,6 +144,13 @@ INDEX (`userid`)", // Update notes setExtensionUpdateNotes("Überweisungen vom Portal werden nun über die Tabelle {OPEN_CONFIG}_MYSQL_PREFIX{CLOSE_CONFIG}_points_data verwaltet."); break; + + case '0.0.5': // SQL queries for v0.0.5 + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_wernis` CHANGE `wernis_type` `wernis_type` ENUM('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED'"); + + // Update notes + setExtensionUpdateNotes("IN/OUT ersetzt mit WITHDRAW/PAYOUT."); + break; } // END - switch break; diff --git a/inc/language/wernis_de.php b/inc/language/wernis_de.php index a0dc069860..f48aa00677 100644 --- a/inc/language/wernis_de.php +++ b/inc/language/wernis_de.php @@ -45,6 +45,7 @@ addMessages(array( 'WERNIS_STATUS_UNKNWOWN' => "Wernis-Typ %s unbekannt.", 'WERNIS_STATUS_WITHDRAW' => "Einzahlung von WDS66", 'WERNIS_STATUS_PAYOUT' => "Auszahlung an WDS66", + 'WERNIS_STATUS_FAILED' => "Fehlgeschlagen", 'WERNIS_TIMESTAMP' => "Buchungszeitmarke", 'WERNIS_ACCOUNT' => "WDS66-Hauptaccount", 'WERNIS_TOTAL_WERNIS' => "Gesamt überwiesen", diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index 24969366a6..b28bc9ee2d 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -264,7 +264,7 @@ function WERNIS_EXECUTE_WITHDRAW ($wdsId, $userMd5, $amount) { $result = true; // Log the transfer - WERNIS_LOG_TRANSFER($wdsId, $amount, 'IN'); + WERNIS_LOG_TRANSFER($wdsId, $amount, 'WITHDRAW'); } else { // Status failure text WERNIS_STATUS_MESSAGE($return['message'], $return['status']); @@ -301,7 +301,7 @@ function WERNIS_EXECUTE_PAYOUT ($wdsId, $amount) { $result = true; // Log the transfer - WERNIS_LOG_TRANSFER($wdsId, $amount, 'OUT'); + WERNIS_LOG_TRANSFER($wdsId, $amount, 'PAYOUT'); } else { // Status failure text WERNIS_STATUS_MESSAGE($return['message'], $return['status']); @@ -316,19 +316,17 @@ function WERNIS_EXECUTE_PAYOUT ($wdsId, $amount) { // Translate the status IN/OUT function translateWernisTransferStatus ($status) { - // Default status + // Default status is unknown $return = '{%message,WERNIS_STATUS_UNKNWOWN=' . $status . '%}'; - // Which status? - switch ($status) { - case 'IN': // Withdraw - $return = '{--WERNIS_STATUS_WITHDRAW--}'; - break; + // Construct message id + $messageId = 'WERNIS_STATUS_' . $status; - case 'OUT': // Payout - $return = '{--WERNIS_STATUS_PAYOUT--}'; - break; - } // END - switch + // Is it there? + if (isMessageIdValid($messageId)) { + // Then use it as message string + $return = '{--' . $messageId . '--}'; + } // END - if // Return the status return $return; -- 2.39.5