diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index fc10842ea3e..15bb3fc9e0f 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -2560,14 +2560,17 @@ if ($action == 'create') {
print "";
}
// Template to use by default
- print '
';
- print '| ' . $langs->trans("DefaultModel") . ' | ';
- print '';
- print img_picto('', 'pdf', 'class="pictofixedwidth"');
- $liste = ModelePDFPropales::liste_modeles($db);
- $preselected = getDolGlobalString('PROPALE_ADDON_PDF_ODT_DEFAULT', getDolGlobalString("PROPALE_ADDON_PDF"));
- print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
- print " |
";
+ include_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php';
+ $list = ModelePDFPropales::liste_modeles($db);
+ if (is_array($list) && count($list) > 0) {
+ print '';
+ print '| ' . $langs->trans("DefaultModel") . ' | ';
+ print '';
+ print img_picto('', 'pdf', 'class="pictofixedwidth"');
+ $preselected = getDolGlobalString('PROPALE_ADDON_PDF_ODT_DEFAULT', getDolGlobalString("PROPALE_ADDON_PDF"));
+ print $form->selectarray('model', $list, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
+ print " |
";
+ }
// Multicurrency
if (isModEnabled("multicurrency")) {
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 00374a58972..fb59d4503d1 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -2494,14 +2494,16 @@ if ($action == 'create' && $usercancreate) {
}
// Template to use by default
- print '| ' . $langs->trans('DefaultModel') . ' | ';
- print '';
include_once DOL_DOCUMENT_ROOT . '/core/modules/commande/modules_commande.php';
- $liste = ModelePDFCommandes::liste_modeles($db);
- $preselected = getDolGlobalString('COMMANDE_ADDON_PDF');
- print img_picto('', 'pdf', 'class="pictofixedwidth"');
- print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
- print " |
";
+ $list = ModelePDFCommandes::liste_modeles($db);
+ if (is_array($list) && count($list) > 0) {
+ print '| ' . $langs->trans('DefaultModel') . ' | ';
+ print '';
+ $preselected = getDolGlobalString('COMMANDE_ADDON_PDF');
+ print img_picto('', 'pdf', 'class="pictofixedwidth"');
+ print $form->selectarray('model', $list, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
+ print " |
";
+ }
// Multicurrency
if (isModEnabled("multicurrency")) {
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 9ca5dcdb29e..e5355e0001d 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4643,21 +4643,23 @@ if ($action == 'create') {
}
// Template to use by default
- print '| '.$langs->trans('Model').' | ';
- print '';
- print img_picto('', 'pdf', 'class="pictofixedwidth"');
include_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
- $liste = ModelePDFFactures::liste_modeles($db);
- if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) {
- $type = GETPOSTISSET('type') ? GETPOSTINT('type') : $object->type;
- // Hidden conf
- $paramkey = 'FACTURE_ADDON_PDF_'.$type;
- $preselected = getDolGlobalString($paramkey, getDolGlobalString('FACTURE_ADDON_PDF'));
- } else {
- $preselected = getDolGlobalString('FACTURE_ADDON_PDF');
+ $list = ModelePDFFactures::liste_modeles($db);
+ if (is_array($list) && count($list) > 0) {
+ print ' |
| '.$langs->trans('Model').' | ';
+ print '';
+ print img_picto('', 'pdf', 'class="pictofixedwidth"');
+ if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) {
+ $type = GETPOSTISSET('type') ? GETPOSTINT('type') : $object->type;
+ // Hidden conf
+ $paramkey = 'FACTURE_ADDON_PDF_'.$type;
+ $preselected = getDolGlobalString($paramkey, getDolGlobalString('FACTURE_ADDON_PDF'));
+ } else {
+ $preselected = getDolGlobalString('FACTURE_ADDON_PDF');
+ }
+ print $form->selectarray('model', $list, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
+ print " |
";
}
- print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
- print "";
// Multicurrency
if (isModEnabled('multicurrency')) {
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index e3b9bcf2b53..993b869860e 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -1620,7 +1620,7 @@ if ($action == 'create' && $usercancreate) {
// Document model
include_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
$list = ModelePdfExpedition::liste_modeles($db);
- if (is_countable($list) && count($list) > 1) {
+ if (is_array($list) && count($list) > 1) {
print "| ".$langs->trans("DefaultModel")." | ";
print '';
print img_picto('', 'pdf', 'class="pictofixedwidth"');
@@ -1831,7 +1831,7 @@ if ($action == 'create' && $usercancreate) {
// Document model
include_once DOL_DOCUMENT_ROOT . '/core/modules/expedition/modules_expedition.php';
$list = ModelePdfExpedition::liste_modeles($db);
- if (is_countable($list) && count($list) > 1) {
+ if (is_array($list) && count($list) > 1) {
print " |
| " . $langs->trans("DefaultModel") . " | ";
print '';
print img_picto('', 'pdf', 'class="pictofixedwidth"');
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 489c59258dc..5ead89a0784 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -1096,12 +1096,14 @@ if ($action == 'create') {
}
// Model
- print ' |
';
- print '| '.$langs->trans("DefaultModel").' | ';
- print '';
$liste = ModelePDFFicheinter::liste_modeles($db);
- print $form->selectarray('model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
- print " |
";
+ if (count($liste) > 0) {
+ print '';
+ print '| '.$langs->trans("DefaultModel").' | ';
+ print '';
+ print $form->selectarray('model', $liste, getDolGlobalString('FICHEINTER_ADDON_PDF'));
+ print " |
";
+ }
// Public note
print '';
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index 849fccf7b69..e023df29b7e 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -1296,13 +1296,15 @@ if ($action == 'create' && $permissiontoadd) {
}
// Template to use by default
- print '
| '.$langs->trans('Model').' | ';
- print '';
- print img_picto('', 'pdf', 'class="pictofixedwidth"');
- include_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php';
$list = ModelePdfReception::liste_modeles($db);
- print $form->selectarray('model', $list, getDolGlobalString('RECEPTION_ADDON_PDF'), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
- print " |
";
+ if (is_countable($list) && count($list) > 0) {
+ print '| '.$langs->trans('Model').' | ';
+ print '';
+ print img_picto('', 'pdf', 'class="pictofixedwidth"');
+ include_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php';
+ print $form->selectarray('model', $list, getDolGlobalString('RECEPTION_ADDON_PDF'), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
+ print " |
";
+ }
// Note Public
$htmltext ='';
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index b85ff553ecb..c0e65d28f4c 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -1641,14 +1641,16 @@ if ($action == 'create') {
// Model
- print '';
- print '| '.$langs->trans("DefaultModel").' | ';
- print '';
- print img_picto('', 'pdf', 'class="pictofixedwidth"');
$list = ModelePDFSupplierProposal::liste_modeles($db);
- $preselected = getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT', getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF'));
- print $form->selectarray('model', $list, $preselected, 0, 0, 0, '', 0, 0, 0, '', '', 1);
- print " |
";
+ if (count($list) > 0) {
+ print '';
+ print '| '.$langs->trans("DefaultModel").' | ';
+ print '';
+ print img_picto('', 'pdf', 'class="pictofixedwidth"');
+ $preselected = getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT', getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF'));
+ print $form->selectarray('model', $list, $preselected, 0, 0, 0, '', 0, 0, 0, '', '', 1);
+ print " |
";
+ }
// Project
if (isModEnabled('project')) {