diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 8e98030b484..3c7c8cb6e1c 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -544,13 +544,18 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; } elseif ($action == 'ORDER_SUPPLIER_REFUSE') { // Load translation files required by the page - $langs->loadLangs(array("agenda", "other", "orders")); + $langs->loadLangs(array("agenda", "other", "orders", "main")); if (empty($object->actionmsg2)) { $object->actionmsg2 = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref); } $object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref); + if (!empty($object->refuse_note)) { + $object->actionmsg .= '
'; + $object->actionmsg .= $langs->trans("Reason") . ': '.$object->refuse_note; + } + $object->sendtoid = 0; } elseif ($action == 'ORDER_SUPPLIER_SUBMIT') { // Load translation files required by the page diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8c4aa1e2a54..d5ff9bc229f 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -960,6 +960,9 @@ if (empty($reshook)) { } if ($action == 'confirm_refuse' && $confirm == 'yes' && $usercanapprove) { + if (GETPOST('refuse_note')) { + $object->refuse_note = GETPOST('refuse_note'); + } $result = $object->refuse($user); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); @@ -1875,7 +1878,16 @@ if ($action == 'create') { // Confirmation de la desapprobation if ($action == 'refuse') { - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", '', 0, 1); + $formquestion = array( + array( + 'type' => 'text', + 'name' => 'refuse_note', + 'label' => $langs->trans("MotifCP"), + 'value' => '', + 'morecss' => 'minwidth300' + ) + ); + $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