Merge pull request #15931 from ATM-Nicolas/new_shipping_workflow

NEW : Workflow to set a shipment as closed
This commit is contained in:
Laurent Destailleur 2021-01-11 16:34:26 +01:00 committed by GitHub
commit 307d718e82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 1 deletions

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
if (!$user->admin) accessforbidden();
// Load translation files required by the page
$langs->loadLangs(array("admin", "workflow", "propal", "workflow", "orders", "supplier_proposal", "receptions", "errors"));
$langs->loadLangs(array("admin", "workflow", "propal", "workflow", "orders", "supplier_proposal", "receptions", "errors", 'sendings'));
$action = GETPOST('action', 'aZ09');
@ -130,6 +130,14 @@ $workflowcodes = array(
'enabled'=>(!empty($conf->reception->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
'picto'=>'bill'
),
// Automatic classification shipping
'WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE' => array(
'family' => 'classify_shipping',
'position' => 66,
'enabled' => ! empty($conf->expedition->enabled) && ! empty($conf->facture->enabled),
'picto' => 'shipment'
)
);
if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) {
@ -190,6 +198,7 @@ foreach ($workflowcodes as $key => $params) {
if ($reg[1] == 'supplier_proposal') $header .= ' - '.$langs->trans('SupplierProposal');
if ($reg[1] == 'supplier_order') $header .= ' - '.$langs->trans('SupplierOrder');
if ($reg[1] == 'reception') $header .= ' - '.$langs->trans('Reception');
if ($reg[1] == 'shipping') $header .= ' - '.$langs->trans('Shipment');
} else {
$header = $langs->trans("Description");
}

View File

@ -158,6 +158,18 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
}
if (! empty($conf->expedition->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE)) {
/** @var Facture $object */
$object->fetchObjectLinked('', 'shipping', $object->id, $object->element);
if (! empty($object->linkedObjects)) {
/** @var Expedition $shipment */
$shipment = array_shift($object->linkedObjects['shipping']);
$ret = $shipment->setClosed();
}
}
return $ret;
}

View File

@ -21,3 +21,5 @@ descWORKFLOW_BILL_ON_RECEPTION=Classify receptions to "billed" when a linked sup
descWORKFLOW_TICKET_CLOSE_INTERVENTION=Close all interventions linked to the ticket when a ticket is closed
AutomaticCreation=Automatic creation
AutomaticClassification=Automatic classification
# Autoclassify shipment
descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE=Classify linked source shipment as closed when customer invoice is validated