diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ee2be30e97a..a9bc9bd0c5d 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -605,7 +605,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); - $result=facture_pdf_create($db, $_REQUEST['facid'], '', '', $outputlangs); + $result=facture_pdf_create($db, $_REQUEST['facid'], '', $_REQUEST['model'], $outputlangs); if ($result <= 0) { exit; @@ -1975,7 +1975,7 @@ else $var=true; print '
'; - $html->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed); + $html->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$conf->global->FACTURE_ADDON_PDF); /* * Propales rattachées diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php index b95103ec140..d007da17140 100644 --- a/htdocs/includes/modules/facture/modules_facture.php +++ b/htdocs/includes/modules/facture/modules_facture.php @@ -59,10 +59,12 @@ class ModelePDFFactures extends FPDF */ function liste_modeles($db) { - $liste=array(); - $sql ="SELECT value, value from ".MAIN_DB_PREFIX."const"; - $sql.=" where name='FACTURE_ADDON_PDF'"; - + $type='invoice'; + $liste=array(); + $sql ="SELECT nom as id, nom as lib"; + $sql.=" FROM ".MAIN_DB_PREFIX."document_model"; + $sql.=" WHERE type = '".$type."'"; + $resql = $db->query($sql); if ($resql) {