From 86bad02b9d36e7ca22294be75467cd59e3753ea2 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Sun, 12 Nov 2023 23:41:59 +0100 Subject: [PATCH] FIX #26553 Supplier invoice - Do not display the delete button for reconciled payment (#26554) * do not display delete button if payment is reconciled * add isReconciled() function * phpcs fix: replace spaces by tab * phpcs fix: Whitespace found at end of line * phpcs --- htdocs/fourn/class/paiementfourn.class.php | 13 +++++++++++++ htdocs/fourn/facture/card.php | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index e8d6138b85f..967201e2c10 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -917,4 +917,17 @@ class PaiementFourn extends Paiement return parent::fetch_thirdparty($force_thirdparty_id); } + + + /** + * Return if payment is reconciled + * + * @return boolean True if payment is reconciled + */ + public function isReconciled() + { + $accountline = new AccountLine($this->db); + $accountline->fetch($this->bank_line); + return $accountline->rappro; + } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index ffb3641d06b..6837d1dad9c 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3551,7 +3551,10 @@ if ($action == 'create') { } print ''.price($sign * $objp->amount).''; print ''; - if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) { + + $paiementfourn = new PaiementFourn($db); + $paiementfourn->fetch($objp->rowid); + if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0 && !$paiementfourn->isReconciled()) { print 'rowid.'">'; print img_delete(); print '';