Fix: Bad detection of PDF format.
This commit is contained in:
parent
9bbe5014e6
commit
840dcfec38
@ -105,14 +105,18 @@ function dolGetModulesDirs($subdir='')
|
||||
/**
|
||||
* Try to guess default paper format according to language into $langs
|
||||
*
|
||||
* @return string Defautl paper format code
|
||||
* @param Translate $outputlangs Output lang to use to autodetect output format if setup not done
|
||||
* @return string Default paper format code
|
||||
*/
|
||||
function dol_getDefaultFormat()
|
||||
function dol_getDefaultFormat($outputlangs='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected='EUA4';
|
||||
if ($langs->defaultlang == 'ca_CA') $selected='CAP4'; // Canada
|
||||
if ($langs->defaultlang == 'en_US') $selected='USLetter'; // US
|
||||
if (empty($outputlangs) || ! is_object($outputlangs)) $outputlangs=$langs;
|
||||
|
||||
if ($outputlangs->defaultlang == 'ca_CA') $selected='CAP4'; // Canada
|
||||
if ($outputlangs->defaultlang == 'en_US') $selected='USLetter'; // US
|
||||
return $selected;
|
||||
}
|
||||
|
||||
@ -739,7 +743,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),$counterpadded,$maskLike);
|
||||
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
||||
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
||||
|
||||
|
||||
$ref='';
|
||||
$sql = "SELECT ".$field." as ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||
@ -748,7 +752,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||
if ($where) $sql.=$where;
|
||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||
|
||||
|
||||
dol_syslog("functions2::get_next_value sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -174,7 +174,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
|
||||
|
||||
// Define format of output PDF
|
||||
$formatarray=pdf_getFormat();
|
||||
$formatarray=pdf_getFormat($langs);
|
||||
$page_largeur = $formatarray['width'];
|
||||
$page_hauteur = $formatarray['height'];
|
||||
$format = array($page_largeur,$page_hauteur);
|
||||
|
||||
@ -29,11 +29,12 @@
|
||||
|
||||
|
||||
/**
|
||||
* Return array with format properties of default PDF format
|
||||
*
|
||||
* @return array Array('width'=>w,'height'=>h,'unit'=>u);
|
||||
*/
|
||||
function pdf_getFormat()
|
||||
* Return array with format properties of default PDF format
|
||||
*
|
||||
* @param Translate $outputlangs Output lang to use to autodetect output format if setup not done
|
||||
* @return array Array('width'=>w,'height'=>h,'unit'=>u);
|
||||
*/
|
||||
function pdf_getFormat($outputlangs='')
|
||||
{
|
||||
global $conf,$db;
|
||||
|
||||
@ -43,7 +44,7 @@ function pdf_getFormat()
|
||||
if (empty($conf->global->MAIN_PDF_FORMAT))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$pdfformat=dol_getDefaultFormat();
|
||||
$pdfformat=dol_getDefaultFormat($outputlangs);
|
||||
}
|
||||
else $pdfformat=$conf->global->MAIN_PDF_FORMAT;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user