diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index 6c28081e6fc..cd84dbf65a5 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -238,6 +238,32 @@ if ($action == 'setforcedate')
}
}
+if ($action == 'setDefaultPDFModulesByType')
+{
+ $invoicetypemodels = GETPOST('invoicetypemodels');
+
+ if(!empty($invoicetypemodels) && is_array($invoicetypemodels))
+ {
+ $error = 0;
+
+ foreach ($invoicetypemodels as $type => $value)
+ {
+ $res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type),$value,'chaine',0,'',$conf->entity);
+ if (! $res > 0) $error++;
+ }
+
+ if (! $error)
+ {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ }
+ else
+ {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+ }
+
+
+}
/*
@@ -465,6 +491,8 @@ print "\n";
clearstatcache();
+$activatedModels = array();
+
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
@@ -580,6 +608,47 @@ foreach ($dirmodels as $reldir)
}
print '';
+if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
+{
+ /*
+ * Document templates generators
+ */
+ print '
';
+ print load_fiche_titre($langs->trans("BillsPDFModulesAccordindToInvoiceType"),'','');
+ print '
";
+}
/*
* Modes de reglement
@@ -662,6 +731,7 @@ if ($resql)
$i = 0;
while ($i < $num)
{
+
$row = $db->fetch_row($resql);
print '