From ffb1b232d4540d6bc34b9d6787495c9729461583 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Jun 2021 21:27:48 +0200 Subject: [PATCH] Fix Withdraw - link is missing in llx_bank_url when the debit is rejected --- .../compta/paiement/class/paiement.class.php | 26 ++++++++++++++----- .../class/rejetprelevement.class.php | 14 +++++++--- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 221ff3de042..76709332f06 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -2,13 +2,14 @@ /* Copyright (C) 2002-2004 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2014 Raphaël Doursenaud - * Copyright (C) 2014 Marcos García - * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Thibault FOUCART - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018 Frédéric France + * Copyright (C) 2021 OpenDsi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -748,6 +749,17 @@ class Paiement extends CommonObject ); } + // Add link 'InvoiceRefused' in bank_url + if (! $error && $label == '(InvoiceRefused)') { + $result=$acc->add_url_line( + $bank_line_id, + $this->id_prelevement, + DOL_URL_ROOT.'/compta/prelevement/card.php?id=', + $this->num_prelevement, + 'withdraw' + ); + } + if (! $error && ! $notrigger) { // Appel des triggers diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 740a1e47784..f1e6eab552a 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -1,7 +1,8 @@ - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2021 OpenDsi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,6 +96,10 @@ class RejetPrelevement $bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT; $facs = $this->getListInvoices(1); + require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; + $lipre = new LignePrelevement($this->db, $user); + $lipre->fetch($id); + $this->db->begin(); // Insert refused line into database @@ -154,6 +159,9 @@ class RejetPrelevement $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal $pai->num_paiement = $fac->ref; + $pai->num_payment = $fac->ref; + $pai->id_prelevement = $this->bon_id; + $pai->num_prelevement = $lipre->bon_ref; if ($pai->create($this->user) < 0) // we call with no_commit {