From 55d48077a32301e509aa67925d19f07c11287e91 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Mon, 31 May 2021 09:26:53 +0200 Subject: [PATCH 1/2] ADD note to supplier order refusal --- .../interface_50_modAgenda_ActionsAuto.class.php | 7 ++++++- htdocs/fourn/commande/card.php | 14 +++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) 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 From 68579f9cda31df18f0d61789da37c96a06e0d0ef Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Wed, 2 Jun 2021 08:17:34 +0200 Subject: [PATCH 2/2] fix html linebreak --- .../core/triggers/interface_50_modAgenda_ActionsAuto.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 3c7c8cb6e1c..8e23c258d88 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -552,7 +552,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref); if (!empty($object->refuse_note)) { - $object->actionmsg .= '
'; + $object->actionmsg .= '
'; $object->actionmsg .= $langs->trans("Reason") . ': '.$object->refuse_note; }