diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index d1eb324cc7f..dd0ec988062 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -332,6 +332,7 @@ abstract class CommonInvoice extends CommonObject $field = 'fk_facture'; $field2 = 'fk_paiement'; $field3 = ', p.ref_ext'; + $field4 = ', p.fk_bank'; // Bank line id $sharedentity = 'facture'; if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') { $table = 'paiementfourn_facturefourn'; @@ -342,7 +343,7 @@ abstract class CommonInvoice extends CommonObject $sharedentity = 'facture_fourn'; } - $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3; + $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3 . $field4; $sql .= " FROM ".$this->db->prefix().$table." as pf, ".$this->db->prefix().$table2." as p, ".$this->db->prefix()."c_paiement as t"; $sql .= " WHERE pf.".$field." = ".((int) $this->id); $sql .= " AND pf.".$field2." = p.rowid"; @@ -363,6 +364,9 @@ abstract class CommonInvoice extends CommonObject if (!empty($field3)) { $tmp['ref_ext'] = $obj->ref_ext; } + if (!empty($field4)) { + $tmp['fk_bank_line'] = $obj->fk_bank; + } $retarray[] = $tmp; $i++; }