From: Roland Häder Date: Sun, 30 Dec 2012 00:57:13 +0000 (+0000) Subject: Some improvements: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7454c5626871adc340ae1c90a2140366c4b73d9c;p=mailer.git Some improvements: - Used wrapper convertCommaToDotInPostData() instead of that wrapped code - Init database charset to UTF-8 by default - Use a mask for float instead (float) casting --- diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index d7a7fd3872..c32c8f2b86 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -223,6 +223,14 @@ function SQL_CONNECT ($host, $login, $password, $F, $L) { * working database link. */ SQL_SET_LINK(__FUNCTION__, __LINE__, $linkResource); + + // Init charsets (UTF-8 is default now) + SQL_QUERY("SET + `character_set_results`='utf8', + `character_set_client`='utf8', + `character_set_connection`='utf8', + `character_set_database`='utf8', + `character_set_server`='utf8'", __FUNCTION__, __LINE__); } // END - if // Return the resource diff --git a/inc/functions.php b/inc/functions.php index faecd19e7d..74305d4701 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1464,12 +1464,12 @@ function convertCommaToDot ($str) { $str = str_replace('.', '', $str); // Replace german commata with decimal dot and cast it - $float = (float) str_replace(',', '.', $str); + $float = sprintf('%01.5f', str_replace(',', '.', $str)); break; default: // US and so on // Remove thousand commatas first and cast - $float = (float) str_replace(',', '', $str); + $float = sprintf('%01.5f', str_replace(',', '', $str)); break; } // END - switch diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index e534811268..1ec81ad889 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -1872,7 +1872,7 @@ function doAdminNetworkProcessAddHandlerTypesConfig ($displayMessage = TRUE) { setPostRequestElement('network_type_id', bigintval(getRequestElement('network_type_id'))); // Translate German comma to dot - setPostRequestElement('network_min_payment', convertCommaToDot(postRequestElement('network_min_payment'))); + convertCommaToDotInPostData('network_min_payment'); /* * Some parameters are optional, at least one must be given so check a bunch @@ -1962,6 +1962,9 @@ function doAdminNetworkProcessAddHandlerTypesConfig ($displayMessage = TRUE) { // Only changes network type configuration if not yet present function doAdminNetworkProcessEditHandlerTypesConfig ($displayMessage = TRUE) { + // Translate German comma to dot + convertCommaToDotInPostData('network_min_payment'); + /* * Some parameters are optional, at least one must be given so check a bunch * of parameters. diff --git a/inc/sql-functions.php b/inc/sql-functions.php index b08d51ca5c..84456a0f00 100644 --- a/inc/sql-functions.php +++ b/inc/sql-functions.php @@ -184,11 +184,11 @@ function getInsertSqlFromArray ($array, $tableName) { $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_' . $tableName . '` ( -`' . implode('`, `', array_keys(postRequestArray())) . '` +`' . implode('`, `', array_keys($array)) . '` ) VALUES ('; // Walk through all entries - foreach (postRequestArray() as $key => $value) { + foreach ($array as $key => $value) { // Log debug message //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',key=' . $key . ',value=' . $value); diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 36d0bb2fe9..c5a616a6bd 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -3393,5 +3393,11 @@ function loadAllExtensionsByTemplate () { return $extensions; } +// Wrapper function to allow full float values as supported by current database layout +function translateFullComma ($dotted) { + // Call inner function + return translateComma($dotted, TRUE, 5); +} + // [EOF] ?> diff --git a/templates/de/html/admin/admin_edit_config_network_type_form.tpl b/templates/de/html/admin/admin_edit_config_network_type_form.tpl index 89b2630989..10ff1167fe 100644 --- a/templates/de/html/admin/admin_edit_config_network_type_form.tpl +++ b/templates/de/html/admin/admin_edit_config_network_type_form.tpl @@ -32,7 +32,7 @@
- +
@@ -42,7 +42,7 @@
{%form_close%}