From 6e612dd3162ae4b8aae596a7284a9d56f2386f26 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Jan 2012 21:27:31 +0100 Subject: [PATCH] Fix: Use default pdf format if not defined --- htdocs/admin/pdf.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 8c7e6937a47..d16462390d0 100755 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -223,11 +223,18 @@ else // Show // Show pdf format $var=!$var; print ''.$langs->trans("DictionnaryPaperFormat").''; - $pdfformatlabel=$conf->global->MAIN_PDF_FORMAT; - if (! empty($conf->global->MAIN_PDF_FORMAT)) + + if (empty($conf->global->MAIN_PDF_FORMAT)) + { + include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'); + $pdfformatlabel=dol_getDefaultFormat(); + } + else $pdfformatlabel=$conf->global->MAIN_PDF_FORMAT; + + if (! empty($pdfformatlabel)) { $sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format"; - $sql.=" WHERE code LIKE '%".$conf->global->MAIN_PDF_FORMAT."%'"; + $sql.=" WHERE code LIKE '%".$db->escape($pdfformatlabel)."%'"; $resql=$db->query($sql); if ($resql)