Fix: Wrong column name fk_paiement_fourn -> fk_paiementfourn

The column in llx_paiementfourn_facturefourn is fk_paiementfourn (no underscore)
not fk_paiement_fourn. This caused payment lookups to fail, creating
duplicate payments instead of linking to existing ones.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-02-20 09:12:53 +01:00
parent 2dc9279143
commit 6342225cc1
3 changed files with 4 additions and 4 deletions

View file

@ -496,7 +496,7 @@ if ($object->id > 0) {
$sql = "SELECT pf.fk_facturefourn, pf.amount, f.ref, f.ref_supplier, f.total_ttc"; $sql = "SELECT pf.fk_facturefourn, pf.amount, f.ref, f.ref_supplier, f.total_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf"; $sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON pf.fk_facturefourn = f.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON pf.fk_facturefourn = f.rowid";
$sql .= " WHERE pf.fk_paiement_fourn = ".((int) $object->fk_paiementfourn); $sql .= " WHERE pf.fk_paiementfourn = ".((int) $object->fk_paiementfourn);
$resql = $db->query($sql); $resql = $db->query($sql);
$invoicesFound = false; $invoicesFound = false;
if ($resql && $db->num_rows($resql) > 0) { if ($resql && $db->num_rows($resql) > 0) {

View file

@ -1656,7 +1656,7 @@ class BankImportTransaction extends CommonObject
} }
// Find the payment(s) for this invoice // Find the payment(s) for this invoice
$sql = "SELECT pfp.fk_paiement_fourn as payment_id, pfp.amount"; $sql = "SELECT pfp.fk_paiementfourn as payment_id, pfp.amount";
$sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pfp"; $sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pfp";
$sql .= " WHERE pfp.fk_facturefourn = ".((int) $invoiceId); $sql .= " WHERE pfp.fk_facturefourn = ".((int) $invoiceId);
$sql .= " ORDER BY pfp.rowid DESC"; $sql .= " ORDER BY pfp.rowid DESC";
@ -1951,7 +1951,7 @@ class BankImportTransaction extends CommonObject
} }
// Find payment for this invoice // Find payment for this invoice
$sql = "SELECT pfp.fk_paiement_fourn as payment_id"; $sql = "SELECT pfp.fk_paiementfourn as payment_id";
$sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pfp"; $sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pfp";
$sql .= " WHERE pfp.fk_facturefourn = ".((int) $invoiceId); $sql .= " WHERE pfp.fk_facturefourn = ".((int) $invoiceId);
$sql .= " ORDER BY pfp.rowid DESC LIMIT 1"; $sql .= " ORDER BY pfp.rowid DESC LIMIT 1";

View file

@ -76,7 +76,7 @@ class modBankImport extends DolibarrModules
$this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@bankimport' $this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@bankimport'
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z' // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z'
$this->version = '1.7'; $this->version = '1.8';
// Url to the file with your last numberversion of this module // Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt'; //$this->url_last_version = 'http://www.example.com/versionmodule.txt';