Skip to content

Commit

Permalink
FIX #26553 Supplier invoice - Do not display the delete button for re…
Browse files Browse the repository at this point in the history
…conciled 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
  • Loading branch information
thibdrev authored Nov 12, 2023
1 parent 2f340a1 commit 86bad02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions htdocs/fourn/class/paiementfourn.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -917,4 +917,17 @@ public function fetch_thirdparty($force_thirdparty_id = 0)

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;
}
}
5 changes: 4 additions & 1 deletion htdocs/fourn/facture/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -3551,7 +3551,10 @@ function setRadioForTypeOfInvoice() {
}
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>';
Expand Down

0 comments on commit 86bad02

Please sign in to comment.