Merge pull request #15931 from ATM-Nicolas/new_shipping_workflow
NEW : Workflow to set a shipment as closed
This commit is contained in:
commit
307d718e82
@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
// Load translation files required by the page
|
// 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');
|
$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))),
|
'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'
|
'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'])) {
|
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_proposal') $header .= ' - '.$langs->trans('SupplierProposal');
|
||||||
if ($reg[1] == 'supplier_order') $header .= ' - '.$langs->trans('SupplierOrder');
|
if ($reg[1] == 'supplier_order') $header .= ' - '.$langs->trans('SupplierOrder');
|
||||||
if ($reg[1] == 'reception') $header .= ' - '.$langs->trans('Reception');
|
if ($reg[1] == 'reception') $header .= ' - '.$langs->trans('Reception');
|
||||||
|
if ($reg[1] == 'shipping') $header .= ' - '.$langs->trans('Shipment');
|
||||||
} else {
|
} else {
|
||||||
$header = $langs->trans("Description");
|
$header = $langs->trans("Description");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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
|
descWORKFLOW_TICKET_CLOSE_INTERVENTION=Close all interventions linked to the ticket when a ticket is closed
|
||||||
AutomaticCreation=Automatic creation
|
AutomaticCreation=Automatic creation
|
||||||
AutomaticClassification=Automatic classification
|
AutomaticClassification=Automatic classification
|
||||||
|
# Autoclassify shipment
|
||||||
|
descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE=Classify linked source shipment as closed when customer invoice is validated
|
||||||
Loading…
Reference in New Issue
Block a user