New classify billed order without invoice (#29614)

* Add new conf in admin page for supplier order classify billed without invoice

* Add translations en_US

* Add check on new config to allow or not the classify billed button

* Add possibility to set the hidden conf to disallow classify billed button from order, from the admin page

* Update conf names and move code to right parts, according to PR returns
This commit is contained in:
atm-etienne 2024-05-22 13:30:44 +02:00 committed by GitHub
parent 3576127d65
commit dc8b79e0d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 27 additions and 4 deletions

View File

@ -9775,7 +9775,7 @@ For developers:
- New: Can add a link on title field of added dictionary.
- New: Uniformize code.
- New: Add option WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER and
WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER.
ORDER_DISABLE_CLASSIFY_BILLED_FROM_ORDER.
- New: A module can add several css and js.
- New: removed deprecated methods
ldap::connect, formadmin::select_lang,

View File

@ -826,6 +826,7 @@ print '<td class="left" colspan="2">';
print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE');
print '</td></tr>';
// Allow external download
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowExternalDownload").'</td>';

View File

@ -685,6 +685,15 @@ print ajax_constantonoff('ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0
print '</td></tr>';
print '</form>';
// Disallow to classify billed an order without invoice, only if module invoice is enable
if (isModEnabled('invoice')) {
print '<tr class="oddeven"><td>'.$langs->trans("InvoiceClassifyBilledSupplierOrderWithoutInvoice"). '&nbsp;' ;
print $form->textwithpicto('', $langs->trans("InvoiceClassifyBilledSupplierOrderWithoutInvoiceHelp"), 1, 'help') . '</td>';
print '<td class="left" colspan="2">';
print ajax_constantonoff('ORDER_DISABLE_CLASSIFY_BILLED_FROM_ORDER');
print '</td></tr>';
}
/*
// Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
// TODO Must be implemented by PDF templates

View File

@ -547,6 +547,14 @@ if (isModEnabled('reception')) {
print "</td>\n";
print "</tr>\n";
// Disallow to classify billed a supplier order without invoice
print '<tr class="oddeven"><td>'.$langs->trans("SupplierOrderClassifyBilledWithoutInvoice"). '&nbsp;' ;
print $form->textwithpicto('', $langs->trans("SupplierOrderClassifyBilledWithoutInvoiceHelp"), 1, 'help') . '</td>';
print '<td class="left" colspan="2">';
print ajax_constantonoff('SUPPLIER_ORDER_DISABLE_CLASSIFY_BILLED_FROM_SUPPLIER_ORDER');
print '</td></tr>';
print '</table></div><br>';
print '</form>';

View File

@ -3055,12 +3055,12 @@ if ($action == 'create' && $usercancreate) {
// Set billed or unbilled
// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && !getDolGlobalString('WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER') && !getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')) {
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && !getDolGlobalString('ORDER_DISABLE_CLASSIFY_BILLED_FROM_ORDER') && !getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')) {
print dolGetButtonAction('', $langs->trans('ClassifyBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifybilled&amp;token='.newToken().'&amp;id='.$object->id, '');
}
}
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && !getDolGlobalString('WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER') && !getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')) {
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && !getDolGlobalString('ORDER_DISABLE_CLASSIFY_BILLED_FROM_ORDER') && !getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')) {
print dolGetButtonAction('', $langs->trans('ClassifyUnBilled'), 'delete', $_SERVER["PHP_SELF"].'?action=classifyunbilled&amp;token='.newToken().'&amp;id='.$object->id, '');
}
}

View File

@ -2685,7 +2685,7 @@ if ($action == 'create') {
if (!isModEnabled('invoice')) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'</a>';
} else {
if (!empty($object->linkedObjectsIds['invoice_supplier'])) {
if (!empty($object->linkedObjectsIds['invoice_supplier']) || (empty($object->linkedObjectsIds['invoice_supplier']) && !getDolGlobalInt('SUPPLIER_ORDER_DISABLE_CLASSIFY_BILLED_FROM_SUPPLIER_ORDER'))) {
if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight("supplier_invoice", "creer")) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'</a>';
}

View File

@ -1488,6 +1488,11 @@ InvoiceOptionCategoryOfOperations=Display the mention "category of operations" o
InvoiceOptionCategoryOfOperationsHelp=Depending on the situation, the mention will appear in the form:<br>- Category of operations: Delivery of goods<br>- Category of operations: Provision of services<br>- Category of operations: Mixed - Delivery of goods & provision of services
InvoiceOptionCategoryOfOperationsYes1=Yes, below the address block
InvoiceOptionCategoryOfOperationsYes2=Yes, in the lower left-hand corner
InvoiceClassifyBilledSupplierOrderWithoutInvoice=Disallow to classify billed an order without invoice.
InvoiceClassifyBilledSupplierOrderWithoutInvoiceHelp=Classify billed an order without invoice is allow by default. If this conf is set to true, it will be not.
##### Supplier Orders #####
SupplierOrderClassifyBilledWithoutInvoice=Disallow to classify billed a supplier order without invoice.
SupplierOrderClassifyBilledWithoutInvoiceHelp=Classify billed a supplier order without invoice is allow by default. If this conf is set to true, it will be not.
##### Proposals #####
PropalSetup=Commercial proposals module setup
ProposalsNumberingModules=Commercial proposal numbering models