Fix: Bad translation of date format
This commit is contained in:
parent
8a8ed0f129
commit
91f5bdd7ed
@ -376,7 +376,7 @@ class Conf
|
||||
$this->global->MAIN_GRAPH_LIBRARY = 'artichow';
|
||||
}
|
||||
|
||||
// Format for date
|
||||
// Format for date (if not found in lang)
|
||||
$this->format_date_short="%d/%m/%Y"; # Format of day with PHP/C tags (strftime functions)
|
||||
$this->format_date_short_java="dd/MM/yyyy"; # Format of day with Java tags
|
||||
$this->format_hour_short="%H:%M";
|
||||
|
||||
@ -303,21 +303,6 @@ class Translate {
|
||||
{
|
||||
if ($fileread) $this->tab_loaded[$newdomain]=1; // Set domain file as loaded
|
||||
|
||||
// Format for date
|
||||
if ($newdomain == 'main')
|
||||
{
|
||||
$conf->format_date_short=empty($this->tab_translate['FormatDateShort'])?"%d/%m/%Y":$this->tab_translate['FormatDateShort']; # Format of day with PHP/C tags (strftime functions)
|
||||
$conf->format_date_short_java=empty($this->tab_translate['FormatDateShortJava'])?"dd/MM/yyyy":$this->tab_translate['FormatDateShortJava']; # Format of day with Java tags
|
||||
$conf->format_hour_short=empty($this->tab_translate['FormatHourShort'])?"%H:%M":$this->tab_translate['FormatHourShort'];
|
||||
$conf->format_hour_short_duration=empty($this->tab_translate['FormatHourShortDuration'])?"%H:%M":$this->tab_translate['FormatHourShortDuration'];
|
||||
$conf->format_date_text_short=empty($this->tab_translate['FormatDateTextShort'])?"%d %b %Y":$this->tab_translate['FormatDateTextShort'];
|
||||
$conf->format_date_text=empty($this->tab_translate['FormatDateText'])?"%d %B %Y":$this->tab_translate['FormatDateText'];
|
||||
$conf->format_date_hour_short=empty($this->tab_translate['FormatDateHourShort'])?"%d/%m/%Y %H:%M":$this->tab_translate['FormatDateHourShort'];
|
||||
$conf->format_date_hour_text_short=empty($this->tab_translate['FormatDateHourTextShort'])?"%d %b %Y %H:%M":$this->tab_translate['FormatDateHourTextShort'];
|
||||
$conf->format_date_hour_text=empty($this->tab_translate['FormatDateHourText'])?"%d %B %Y %H:%M":$this->tab_translate['FormatDateHourText'];
|
||||
//print $domain." => ".$this->defaultlang." ".$conf->format_date_hour_short." ".$this->tab_translate['FormatDateHourShort'];
|
||||
}
|
||||
|
||||
if (empty($this->tab_loaded[$newdomain])) $this->tab_loaded[$newdomain]=2; // Marque ce fichier comme non trouve
|
||||
}
|
||||
|
||||
|
||||
@ -434,18 +434,22 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodeto
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
|
||||
// Si format non defini, on prend $conf->format_date_text_short sinon %Y-%m-%d %H:%M:%S
|
||||
if (! $format) $format=(isset($conf->format_date_text_short) ? $conf->format_date_text_short : '%Y-%m-%d %H:%M:%S');
|
||||
|
||||
if ($format == 'day') $format=$conf->format_date_short;
|
||||
if ($format == 'hour') $format=$conf->format_hour_short;
|
||||
if ($format == 'hourduration') $format=$conf->format_hour_short_duration;
|
||||
if ($format == 'daytext') $format=$conf->format_date_text;
|
||||
if ($format == 'daytextshort') $format=$conf->format_date_text_short;
|
||||
if ($format == 'dayhour') $format=$conf->format_date_hour_short;
|
||||
if ($format == 'dayhourtext') $format=$conf->format_date_hour_text;
|
||||
if ($format == 'dayhourtextshort') $format=$conf->format_date_hour_text_short;
|
||||
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
|
||||
if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short);
|
||||
if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short);
|
||||
if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration);
|
||||
if ($format == 'daytext') $format=($outputlangs->trans("FormatDateText")!="FormatDateText"?$outputlangs->trans("FormatDateText"):$conf->format_date_text);
|
||||
if ($format == 'daytextshort') $format=($outputlangs->trans("FormatDateTextShort")!="FormatDateTextShort"?$outputlangs->trans("FormatDateTextShort"):$conf->format_date_text_short);
|
||||
if ($format == 'dayhour') $format=($outputlangs->trans("FormatDateHourShort")!="FormatDateHourShort"?$outputlangs->trans("FormatDateHourShort"):$conf->format_date_hour_short);
|
||||
if ($format == 'dayhourtext') $format=($outputlangs->trans("FormatDateHourText")!="FormatDateHourText"?$outputlangs->trans("FormatDateHourText"):$conf->format_date_hour_text);
|
||||
if ($format == 'dayhourtextshort') $format=($outputlangs->trans("FormatDateHourTextShort")!="FormatDateHourTextShort"?$outputlangs->trans("FormatDateHourTextShort"):$conf->format_date_hour_text_short);
|
||||
|
||||
// Format not sensitive to language
|
||||
if ($format == 'dayhourlog') $format='%Y%m%d%H%M%S';
|
||||
if ($format == 'dayhourldap') $format='%Y%m%d%H%M%SZ';
|
||||
if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ';
|
||||
@ -495,8 +499,6 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodeto
|
||||
else $ret='Bad value '.$time.' for date';
|
||||
}
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
|
||||
if (preg_match('/__b__/i',$format))
|
||||
{
|
||||
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
||||
|
||||
@ -48,6 +48,7 @@ if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'expedition',$id,'livraison','livraison');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -176,6 +177,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
$result=delivery_order_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user