From af66a8971a323ba43448a1d01b747e9a7bea9ba5 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 2 Oct 2018 15:51:17 +0200 Subject: [PATCH] NEW Hidden conf INVOICE_USE_DEFAULT_DOCUMENT --- htdocs/admin/facture.php | 75 +++++++++++++++++----------------- htdocs/compta/facture/card.php | 66 ++++++++++++++++-------------- 2 files changed, 74 insertions(+), 67 deletions(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 71fa035ee00..6e0f4bf681d 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -610,47 +610,48 @@ foreach ($dirmodels as $reldir) } print ''; - -/* - * Document templates generators - */ -print '
'; -print load_fiche_titre($langs->trans("BillsPDFModulesAccordindToInvoiceType"),'',''); -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$listtype=array( - Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), - Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), - Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), - Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), -); -if (! empty($conf->global->INVOICE_USE_SITUATION)) +if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf { - $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); -} - -foreach ($listtype as $type => $trans) -{ - $thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type; - $current = !empty($conf->global->{$thisTypeConfName})?$conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF; - print ''; - print ''; - print ''; + /* + * Document templates generators + */ + print '
'; + print load_fiche_titre($langs->trans("BillsPDFModulesAccordindToInvoiceType"),'',''); + print ''; + print ''; + print ''; + print '
'.$langs->trans("Type").''.$langs->trans("Name").'
'.$trans.''.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current,0,0, 0).'
'; + print ''; + print ''; + print ''; + print ''; print "\n"; + + $listtype=array( + Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), + Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), + Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), + Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), + ); + if (! empty($conf->global->INVOICE_USE_SITUATION)) + { + $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); + } + + foreach ($listtype as $type => $trans) + { + $thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type; + $current = !empty($conf->global->{$thisTypeConfName})?$conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF; + print ''; + print ''; + print ''; + print "\n"; + } + + print '
'.$langs->trans("Type").''.$langs->trans("Name").'
'.$trans.''.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current,0,0, 0).'
'; + print "
"; } -print ''; -print ""; - - /* * Modes de reglement */ diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ecd9ad09bbf..074558fd4ac 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2779,37 +2779,38 @@ if ($action == 'create') print ''; - - // Add auto select default document model - $listtType=array(Facture::TYPE_STANDARD,Facture::TYPE_REPLACEMENT,Facture::TYPE_CREDIT_NOTE,Facture::TYPE_DEPOSIT,Facture::TYPE_SITUATION); - $jsListType=''; - foreach ($listtType as $type) + if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf { - $thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type; - $curent = !empty($conf->global->{$thisTypeConfName})?$conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF; - $jsListType.=(!empty($jsListType)?',':'').'"'.$type.'":"'.$curent.'"'; + // Add auto select default document model + $listtType=array(Facture::TYPE_STANDARD,Facture::TYPE_REPLACEMENT,Facture::TYPE_CREDIT_NOTE,Facture::TYPE_DEPOSIT,Facture::TYPE_SITUATION); + $jsListType=''; + foreach ($listtType as $type) + { + $thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type; + $curent = !empty($conf->global->{$thisTypeConfName})?$conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF; + $jsListType.=(!empty($jsListType)?',':'').'"'.$type.'":"'.$curent.'"'; + } + + print ''; } - print ''; - - print ''; @@ -2902,8 +2903,13 @@ if ($action == 'create') print ''; include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; $liste = ModelePDFFactures::liste_modeles($db); - $paramkey='FACTURE_ADDON_PDF_'.$object->type; - $curent = !empty($conf->global->$paramkey)?$conf->global->$paramkey:$conf->global->FACTURE_ADDON_PDF; + if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)){ // Hidden conf + $paramkey='FACTURE_ADDON_PDF_'.$object->type; + $curent = !empty($conf->global->$paramkey)?$conf->global->$paramkey:$conf->global->FACTURE_ADDON_PDF; + } + else{ + $curent = $conf->global->FACTURE_ADDON_PDF; + } print $form->selectarray('model', $liste, $curent); print "";