Skip to content
Snippets Groups Projects
Commit 83885261 authored by Laurent Destailleur's avatar Laurent Destailleur Committed by GitHub
Browse files

Merge pull request #5439 from atm-arnaud/FIX_ASK_DELETE_PAYMENT_SUPPLIER_INVOICE

FIX form_confirm to delete payment on supplier invoice
parents f8b1d0d7 cf5de9d0
Branches
Tags
No related merge requests found
...@@ -292,14 +292,17 @@ if (empty($reshook)) ...@@ -292,14 +292,17 @@ if (empty($reshook))
} }
// Delete payment // 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) if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0)
{ {
$paiementfourn = new PaiementFourn($db); $paiementfourn = new PaiementFourn($db);
$result=$paiementfourn->fetch(GETPOST('paiement_id')); $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) { if ($result < 0) {
setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors'); setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors');
} }
...@@ -1725,6 +1728,12 @@ else ...@@ -1725,6 +1728,12 @@ else
{ {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); $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 // Confirmation to delete line
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment