diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 138891ea31d..f31d66a2f6d 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -2,14 +2,15 @@ /* 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) 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) 2020 Andreu Bisquerra Gaya + * Copyright (C) 2020 Andreu Bisquerra Gaya + * 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 @@ -705,6 +706,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 $result = $this->call_trigger('PAYMENT_ADD_TO_BANK', $user); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index dcf3c1a8bc5..db92da8ce90 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 @@ -98,6 +99,10 @@ class RejetPrelevement $bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_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 @@ -160,7 +165,10 @@ class RejetPrelevement $pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * ($this->type == 'bank-transfer' ? 1 : -1)); $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