forked from Wavyzz/dolibarr
price2num was broken with some localization
This commit is contained in:
@@ -74,7 +74,7 @@ print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("LanguageParameter","
|
||||
//$var=!$var;
|
||||
//print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("LanguageParameter","PHP LC_MONETARY")."</td><td>".setlocale(LC_MONETARY,0)."</td></tr>\n";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].'><td width="300">=> price2num(1234.56)</td><td>'.price2num(1233.56+1,'MT')."</td></tr>";
|
||||
print "<tr ".$bc[$var].'><td width="300">=> price2num(1234.56)</td><td>'.price2num(1233.56+1,'2')."</td></tr>";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].'><td width="300">=> dolibarr_print_date(0,"daytext")</td><td>'.dolibarr_print_date(0,"daytext")."</td>";
|
||||
// Thousands
|
||||
@@ -87,18 +87,17 @@ $var=!$var;
|
||||
$dec=$langs->trans("SeparatorDecimal");
|
||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("CurrentValueSeparatorDecimal")."</td><td>".$dec."</td></tr>\n";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].'><td width=\"300\">=> price2num('."'1".$thousand."234".$dec."56')</td><td>".price2num("1".$thousand."234".$dec."56",'MT')."</td>";
|
||||
if ($thousand != ',' && $thousand != '.')
|
||||
print "<tr ".$bc[$var].'><td width=\"300\">=> price2num('."'1".$thousand."234".$dec."56')</td><td>".price2num("1".$thousand."234".$dec."56",'2')."</td>";
|
||||
if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].'><td width=\"300\">=> price2num('."'1 234.56')</td><td>".price2num("1 234.56",'MT')."</td>";
|
||||
print "<tr ".$bc[$var].'><td width=\"300\">=> price2num('."'1 234.56')</td><td>".price2num("1 234.56",'2')."</td>";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("TimeZone").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
|
||||
//print '<tr class="liste_titre"><td>'.$langs->trans("TimeZone").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
|
||||
// Timezone
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("DolibarrTZ")."</td><td>".$langs->trans("FeatureNotYetAvailable")."</td></tr>\n";
|
||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("ClientTZ")."</td><td>".$langs->trans("FeatureNotYetAvailable")."</td></tr>\n";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("ServerTZ")." (variable system TZ)</td><td>".$_ENV["TZ"]."</td></tr>\n";
|
||||
$var=!$var;
|
||||
|
||||
@@ -77,9 +77,9 @@ ParameterInDolibarr=Parameter %s
|
||||
LanguageParameter=Language parameter %s
|
||||
LanguageBrowserParameter=Parameter %s
|
||||
LocalisationDolibarrParameters=Localisation parameters
|
||||
DolibarrTZ=Time Zone Dolibarr
|
||||
ServerTZ=Time Zone Server
|
||||
PHPTZ=Time Zone PHP
|
||||
ClientTZ=Time Zone Client (user)
|
||||
ServerTZ=Time Zone Server OS
|
||||
PHPTZ=Time Zone Server PHP
|
||||
PHPServerOffsetWithGreenwich=Offset for PHP server width Greenwich (secondes)
|
||||
CurrentHour=Current hour
|
||||
CurrentSessionTimeOut=Current session timeout
|
||||
|
||||
@@ -75,9 +75,9 @@ ParameterInDolibarr=Variable %s
|
||||
LanguageParameter=Variable idioma %s
|
||||
LanguageBrowserParameter=Variable %s
|
||||
LocalisationDolibarrParameters=Par<61>metros de localizaci<63>n
|
||||
DolibarrTZ=Zona hoaria
|
||||
ServerTZ=Zona hoaria
|
||||
PHPTZ=Zona horaria PHP
|
||||
ClientTZ=Zona hoaria (user)
|
||||
ServerTZ=Zona hoaria server OS
|
||||
PHPTZ=Zona horaria server PHP
|
||||
PHPServerOffsetWithGreenwich=Offset con Greenwich (segundos)
|
||||
CurrentHour=Hora actual
|
||||
CurrentSessionTimeOut=Tiempo espera sesi<73>n actual
|
||||
|
||||
@@ -77,9 +77,9 @@ ParameterInDolibarr=Variable %s
|
||||
LanguageParameter=Variable langue %s
|
||||
LanguageBrowserParameter=Variable %s
|
||||
LocalisationDolibarrParameters=Param<61>tres de localisation
|
||||
DolibarrTZ=Time Zone Dolibarr
|
||||
ServerTZ=Time Zone Serveur
|
||||
PHPTZ=Time Zone PHP
|
||||
ClientTZ=Time Zone Client (utilisateur)
|
||||
ServerTZ=Time Zone Serveur OS
|
||||
PHPTZ=Time Zone Serveur PHP
|
||||
PHPServerOffsetWithGreenwich=Offset serveur PHP avec Greenwich (secondes)
|
||||
CurrentHour=Heure courante
|
||||
CurrentSessionTimeOut=Time out session courante
|
||||
|
||||
@@ -71,9 +71,9 @@ ParameterInDolibarr =Parametro %s
|
||||
LanguageParameter =Lingua parametro %s
|
||||
LanguageBrowserParameter =Parametro %s
|
||||
LocalisationDolibarrParameters =Parametri di localizzazione
|
||||
DolibarrTZ =Fuso orario Dolibarr
|
||||
ServerTZ =Fuso orario server
|
||||
PHPTZ =Fuso orario php
|
||||
ClientTZ =Fuso orario client (user)
|
||||
ServerTZ =Fuso orario server OS
|
||||
PHPTZ =Fuso orario server PHP
|
||||
PHPServerOffsetWithGreenwich =Offset per PHP server larghezza di Greenwich (secondi)
|
||||
CurrentHour =Ora corrente
|
||||
OSEnv =OS Ambiente
|
||||
|
||||
@@ -2145,8 +2145,8 @@ function price2num($amount,$rounding='',$alreadysqlnb=-1)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
// Round PHP function does not allow number like '1,234.5' nor '1.234,5' nor '1 234,5'
|
||||
// Numbers must be '1234.5'
|
||||
// Round PHP function does not allow number like '1,234.56' nor '1.234,56' nor '1 234,56'
|
||||
// Numbers must be '1234.56'
|
||||
// Decimal delimiter for database SQL request must be '.'
|
||||
$dec=','; $thousand=' ';
|
||||
if ($langs->trans("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->trans("SeparatorDecimal");
|
||||
@@ -2180,7 +2180,8 @@ function price2num($amount,$rounding='',$alreadysqlnb=-1)
|
||||
if ($rounding == 'MU') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_UNIT;
|
||||
elseif ($rounding == 'MT') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_TOT;
|
||||
elseif ($rounding == 'MS') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_SHOWN;
|
||||
if ($nbofdectoround) $amount = round($amount,$nbofdectoround);
|
||||
elseif ($rounding == '2') $nbofdectoround=2; // For admin info page
|
||||
if (strlen($nbofdectoround)) $amount = round($amount,$nbofdectoround); // $nbofdectoround can be 0.
|
||||
else return 'ErrorBadParameterProvidedToFunction';
|
||||
//print 'ZZ'.$nbofdec.'-'.$nbofdectoround.'=>'.$amount.'<br>';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user