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;
|
//$var=!$var;
|
||||||
//print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("LanguageParameter","PHP LC_MONETARY")."</td><td>".setlocale(LC_MONETARY,0)."</td></tr>\n";
|
//print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("LanguageParameter","PHP LC_MONETARY")."</td><td>".setlocale(LC_MONETARY,0)."</td></tr>\n";
|
||||||
$var=!$var;
|
$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;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].'><td width="300">=> dolibarr_print_date(0,"daytext")</td><td>'.dolibarr_print_date(0,"daytext")."</td>";
|
print "<tr ".$bc[$var].'><td width="300">=> dolibarr_print_date(0,"daytext")</td><td>'.dolibarr_print_date(0,"daytext")."</td>";
|
||||||
// Thousands
|
// Thousands
|
||||||
@@ -87,18 +87,17 @@ $var=!$var;
|
|||||||
$dec=$langs->trans("SeparatorDecimal");
|
$dec=$langs->trans("SeparatorDecimal");
|
||||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("CurrentValueSeparatorDecimal")."</td><td>".$dec."</td></tr>\n";
|
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("CurrentValueSeparatorDecimal")."</td><td>".$dec."</td></tr>\n";
|
||||||
$var=!$var;
|
$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>";
|
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 != '.')
|
if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$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>\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
|
// Timezone
|
||||||
$var=!$var;
|
$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;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("ServerTZ")." (variable system TZ)</td><td>".$_ENV["TZ"]."</td></tr>\n";
|
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("ServerTZ")." (variable system TZ)</td><td>".$_ENV["TZ"]."</td></tr>\n";
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|||||||
@@ -77,9 +77,9 @@ ParameterInDolibarr=Parameter %s
|
|||||||
LanguageParameter=Language parameter %s
|
LanguageParameter=Language parameter %s
|
||||||
LanguageBrowserParameter=Parameter %s
|
LanguageBrowserParameter=Parameter %s
|
||||||
LocalisationDolibarrParameters=Localisation parameters
|
LocalisationDolibarrParameters=Localisation parameters
|
||||||
DolibarrTZ=Time Zone Dolibarr
|
ClientTZ=Time Zone Client (user)
|
||||||
ServerTZ=Time Zone Server
|
ServerTZ=Time Zone Server OS
|
||||||
PHPTZ=Time Zone PHP
|
PHPTZ=Time Zone Server PHP
|
||||||
PHPServerOffsetWithGreenwich=Offset for PHP server width Greenwich (secondes)
|
PHPServerOffsetWithGreenwich=Offset for PHP server width Greenwich (secondes)
|
||||||
CurrentHour=Current hour
|
CurrentHour=Current hour
|
||||||
CurrentSessionTimeOut=Current session timeout
|
CurrentSessionTimeOut=Current session timeout
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ ParameterInDolibarr=Variable %s
|
|||||||
LanguageParameter=Variable idioma %s
|
LanguageParameter=Variable idioma %s
|
||||||
LanguageBrowserParameter=Variable %s
|
LanguageBrowserParameter=Variable %s
|
||||||
LocalisationDolibarrParameters=Par<61>metros de localizaci<63>n
|
LocalisationDolibarrParameters=Par<61>metros de localizaci<63>n
|
||||||
DolibarrTZ=Zona hoaria
|
ClientTZ=Zona hoaria (user)
|
||||||
ServerTZ=Zona hoaria
|
ServerTZ=Zona hoaria server OS
|
||||||
PHPTZ=Zona horaria PHP
|
PHPTZ=Zona horaria server PHP
|
||||||
PHPServerOffsetWithGreenwich=Offset con Greenwich (segundos)
|
PHPServerOffsetWithGreenwich=Offset con Greenwich (segundos)
|
||||||
CurrentHour=Hora actual
|
CurrentHour=Hora actual
|
||||||
CurrentSessionTimeOut=Tiempo espera sesi<73>n actual
|
CurrentSessionTimeOut=Tiempo espera sesi<73>n actual
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ UsePopupCalendar=Utiliser les popups pour la saisie des dates
|
|||||||
UsePreviewTabs=Afficher les onglets "Aper<65>u"
|
UsePreviewTabs=Afficher les onglets "Aper<65>u"
|
||||||
ShowPreview=Afficher aper<65>u
|
ShowPreview=Afficher aper<65>u
|
||||||
ThemeCurrentlyActive=Theme actuellement actif
|
ThemeCurrentlyActive=Theme actuellement actif
|
||||||
CurrentTimeZone=TimeZone courant
|
CurrentTimeZone=Time Zone courant
|
||||||
Space=Espace
|
Space=Espace
|
||||||
Fields=Champs
|
Fields=Champs
|
||||||
Mask=Masque
|
Mask=Masque
|
||||||
@@ -77,9 +77,9 @@ ParameterInDolibarr=Variable %s
|
|||||||
LanguageParameter=Variable langue %s
|
LanguageParameter=Variable langue %s
|
||||||
LanguageBrowserParameter=Variable %s
|
LanguageBrowserParameter=Variable %s
|
||||||
LocalisationDolibarrParameters=Param<61>tres de localisation
|
LocalisationDolibarrParameters=Param<61>tres de localisation
|
||||||
DolibarrTZ=Time Zone Dolibarr
|
ClientTZ=Time Zone Client (utilisateur)
|
||||||
ServerTZ=Time Zone Serveur
|
ServerTZ=Time Zone Serveur OS
|
||||||
PHPTZ=Time Zone PHP
|
PHPTZ=Time Zone Serveur PHP
|
||||||
PHPServerOffsetWithGreenwich=Offset serveur PHP avec Greenwich (secondes)
|
PHPServerOffsetWithGreenwich=Offset serveur PHP avec Greenwich (secondes)
|
||||||
CurrentHour=Heure courante
|
CurrentHour=Heure courante
|
||||||
CurrentSessionTimeOut=Time out session courante
|
CurrentSessionTimeOut=Time out session courante
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ ParameterInDolibarr =Parametro %s
|
|||||||
LanguageParameter =Lingua parametro %s
|
LanguageParameter =Lingua parametro %s
|
||||||
LanguageBrowserParameter =Parametro %s
|
LanguageBrowserParameter =Parametro %s
|
||||||
LocalisationDolibarrParameters =Parametri di localizzazione
|
LocalisationDolibarrParameters =Parametri di localizzazione
|
||||||
DolibarrTZ =Fuso orario Dolibarr
|
ClientTZ =Fuso orario client (user)
|
||||||
ServerTZ =Fuso orario server
|
ServerTZ =Fuso orario server OS
|
||||||
PHPTZ =Fuso orario php
|
PHPTZ =Fuso orario server PHP
|
||||||
PHPServerOffsetWithGreenwich =Offset per PHP server larghezza di Greenwich (secondi)
|
PHPServerOffsetWithGreenwich =Offset per PHP server larghezza di Greenwich (secondi)
|
||||||
CurrentHour =Ora corrente
|
CurrentHour =Ora corrente
|
||||||
OSEnv =OS Ambiente
|
OSEnv =OS Ambiente
|
||||||
|
|||||||
@@ -2145,8 +2145,8 @@ function price2num($amount,$rounding='',$alreadysqlnb=-1)
|
|||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
// Round PHP function does not allow number like '1,234.5' nor '1.234,5' nor '1 234,5'
|
// Round PHP function does not allow number like '1,234.56' nor '1.234,56' nor '1 234,56'
|
||||||
// Numbers must be '1234.5'
|
// Numbers must be '1234.56'
|
||||||
// Decimal delimiter for database SQL request must be '.'
|
// Decimal delimiter for database SQL request must be '.'
|
||||||
$dec=','; $thousand=' ';
|
$dec=','; $thousand=' ';
|
||||||
if ($langs->trans("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->trans("SeparatorDecimal");
|
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;
|
if ($rounding == 'MU') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_UNIT;
|
||||||
elseif ($rounding == 'MT') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_TOT;
|
elseif ($rounding == 'MT') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_TOT;
|
||||||
elseif ($rounding == 'MS') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_SHOWN;
|
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';
|
else return 'ErrorBadParameterProvidedToFunction';
|
||||||
//print 'ZZ'.$nbofdec.'-'.$nbofdectoround.'=>'.$amount.'<br>';
|
//print 'ZZ'.$nbofdec.'-'.$nbofdectoround.'=>'.$amount.'<br>';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user