NEW Hidden conf INVOICE_USE_DEFAULT_DOCUMENT
This commit is contained in:
parent
f4384fa76d
commit
af66a8971a
@ -610,47 +610,48 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
|
||||||
/*
|
|
||||||
* Document templates generators
|
|
||||||
*/
|
|
||||||
print '<br>';
|
|
||||||
print load_fiche_titre($langs->trans("BillsPDFModulesAccordindToInvoiceType"),'','');
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'#default-pdf-modules-by-type-table" method="POST">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
|
||||||
print '<input type="hidden" name="action" value="setDefaultPDFModulesByType" >';
|
|
||||||
print '<table id="default-pdf-modules-by-type-table" class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td>'.$langs->trans("Type").'</td>';
|
|
||||||
print '<td>'.$langs->trans("Name").'</td>';
|
|
||||||
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
|
||||||
print "</tr>\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");
|
/*
|
||||||
}
|
* Document templates generators
|
||||||
|
*/
|
||||||
foreach ($listtype as $type => $trans)
|
print '<br>';
|
||||||
{
|
print load_fiche_titre($langs->trans("BillsPDFModulesAccordindToInvoiceType"),'','');
|
||||||
$thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type;
|
print '<form action="'.$_SERVER["PHP_SELF"].'#default-pdf-modules-by-type-table" method="POST">';
|
||||||
$current = !empty($conf->global->{$thisTypeConfName})?$conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF;
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||||
print '<tr >';
|
print '<input type="hidden" name="action" value="setDefaultPDFModulesByType" >';
|
||||||
print '<td>'.$trans.'</td>';
|
print '<table id="default-pdf-modules-by-type-table" class="noborder" width="100%">';
|
||||||
print '<td colspan="2" >'.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current,0,0, 0).'</td>';
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Name").'</td>';
|
||||||
|
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\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 '<tr >';
|
||||||
|
print '<td>'.$trans.'</td>';
|
||||||
|
print '<td colspan="2" >'.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current,0,0, 0).'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print "</form>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
print "</form>";
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Modes de reglement
|
* Modes de reglement
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2779,37 +2779,38 @@ if ($action == 'create')
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
|
||||||
// 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;
|
// Add auto select default document model
|
||||||
$curent = !empty($conf->global->{$thisTypeConfName})?$conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF;
|
$listtType=array(Facture::TYPE_STANDARD,Facture::TYPE_REPLACEMENT,Facture::TYPE_CREDIT_NOTE,Facture::TYPE_DEPOSIT,Facture::TYPE_SITUATION);
|
||||||
$jsListType.=(!empty($jsListType)?',':'').'"'.$type.'":"'.$curent.'"';
|
$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 '<script type="text/javascript" language="javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
var listType = {'.$jsListType.'};
|
||||||
|
$("[name=\'type\'").change(function() {
|
||||||
|
if($( this ).prop("checked"))
|
||||||
|
{
|
||||||
|
if(($( this ).val() in listType))
|
||||||
|
{
|
||||||
|
$("#model").val(listType[$( this ).val()]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#model").val("'.$conf->global->FACTURE_ADDON_PDF.'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<script type="text/javascript" language="javascript">
|
|
||||||
$(document).ready(function() {
|
|
||||||
var listType = {'.$jsListType.'};
|
|
||||||
$("[name=\'type\'").change(function() {
|
|
||||||
if($( this ).prop("checked"))
|
|
||||||
{
|
|
||||||
if(($( this ).val() in listType))
|
|
||||||
{
|
|
||||||
$("#model").val(listType[$( this ).val()]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$("#model").val("'.$conf->global->FACTURE_ADDON_PDF.'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -2902,8 +2903,13 @@ if ($action == 'create')
|
|||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||||
$liste = ModelePDFFactures::liste_modeles($db);
|
$liste = ModelePDFFactures::liste_modeles($db);
|
||||||
$paramkey='FACTURE_ADDON_PDF_'.$object->type;
|
if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)){ // Hidden conf
|
||||||
$curent = !empty($conf->global->$paramkey)?$conf->global->$paramkey:$conf->global->FACTURE_ADDON_PDF;
|
$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 $form->selectarray('model', $liste, $curent);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user