Merge pull request #18248 from cfoellmann/agenda-fcomm-cancel

NEW add agenda auto creation on supplier_order cancellation
This commit is contained in:
Laurent Destailleur 2021-07-31 17:02:08 +02:00 committed by GitHub
commit b332d02d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 5 deletions

View File

@ -556,6 +556,21 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg .= $langs->trans("Reason") . ': '.$object->refuse_note;
}
$object->sendtoid = 0;
} elseif ($action == 'ORDER_SUPPLIER_CANCEL') {
// Load translation files required by the page
$langs->loadLangs(array("agenda", "other", "orders", "main"));
if (empty($object->actionmsg2)) {
$object->actionmsg2 = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
}
$object->actionmsg = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
if (!empty($object->cancel_note)) {
$object->actionmsg .= '<br>';
$object->actionmsg .= $langs->trans("Reason") . ': '.$object->cancel_note;
}
$object->sendtoid = 0;
} elseif ($action == 'ORDER_SUPPLIER_SUBMIT') {
// Load translation files required by the page

View File

@ -1095,6 +1095,9 @@ if (empty($reshook)) {
}
if ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanorder) {
if (GETPOST('cancel_note')) {
$object->cancel_note = GETPOST('cancel_note');
}
$result = $object->cancel($user);
if ($result > 0) {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
@ -1895,13 +1898,13 @@ if ($action == 'create') {
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ApproveThisOrder"), $text, "confirm_".$action, $formquestion, 1, 1, 240);
}
// Confirmation de la desapprobation
// Confirmation of disapproval
if ($action == 'refuse') {
$formquestion = array(
array(
'type' => 'text',
'name' => 'refuse_note',
'label' => $langs->trans("MotifCP"),
'label' => $langs->trans("Reason"),
'value' => '',
'morecss' => 'minwidth300'
)
@ -1909,9 +1912,18 @@ if ($action == 'create') {
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1);
}
// Confirmation de l'annulation
// Confirmation of cancellation
if ($action == 'cancel') {
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("Cancel"), $langs->trans("ConfirmCancelThisOrder", $object->ref), "confirm_cancel", '', 0, 1);
$formquestion = array(
array(
'type' => 'text',
'name' => 'cancel_note',
'label' => $langs->trans("Reason"),
'value' => '',
'morecss' => 'minwidth300'
)
);
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("Cancel"), $langs->trans("ConfirmCancelThisOrder", $object->ref), "confirm_cancel", $formquestion, 0, 1);
}
// Confirmation de l'envoi de la commande

View File

@ -67,6 +67,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',13);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',13);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_DELETE','Supplier order deleted','Executed when a supplier order is deleted','order_supplier',14);

View File

@ -38,4 +38,5 @@
ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN ref_fourn varchar(128);
ALTER TABLE llx_product_customer_price MODIFY COLUMN ref_customer varchar(128);
-- -- add action trigger
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13);