From cf5de9d0c878a3f35f9fd47ce6f4a0f28c15a5c2 Mon Sep 17 00:00:00 2001 From: arnaud <arnaud.saint-patrice@atm-consulting.fr> Date: Fri, 1 Jul 2016 16:59:03 +0200 Subject: [PATCH] FIX form_confirm to delete payment on supplier invoice --- htdocs/fourn/facture/card.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 38dcdc87759..1a7d236307b 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -292,14 +292,17 @@ if (empty($reshook)) } // Delete payment - elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer) + elseif ($action == 'confirm_delete_paiement' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) { - $object->fetch($id); + $object->fetch($id); if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0) { $paiementfourn = new PaiementFourn($db); $result=$paiementfourn->fetch(GETPOST('paiement_id')); - if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found + if ($result > 0) { + $result=$paiementfourn->delete(); // If fetch ok and found + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); + } if ($result < 0) { setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors'); } @@ -1725,6 +1728,12 @@ else { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); + } + if ($action == 'deletepaiement') + { + $payment_id = GETPOST('paiement_id'); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&paiement_id='.$payment_id, $langs->trans('DeletePayment'), $langs->trans('ConfirmDeletePayment'), 'confirm_delete_paiement', '', 0, 1); + } // Confirmation to delete line -- GitLab