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
This commit is contained in:
thibdrev 2023-11-12 23:41:59 +01:00 committed by GitHub
parent 2f340a1a77
commit 86bad02b9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -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;
}
}

View file

@ -3551,7 +3551,10 @@ if ($action == 'create') {
}
print '<td class="right">'.price($sign * $objp->amount).'</td>';
print '<td class="center">';
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 '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deletepayment&token='.newToken().'&paiement_id='.$objp->rowid.'">';
print img_delete();
print '</a>';