Update commoninvoice.class.php

This commit is contained in:
Cédric 2020-09-12 19:05:33 +02:00 committed by GitHub
parent 29931bbded
commit acc995a553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -297,6 +297,7 @@ abstract class CommonInvoice extends CommonObject
$table2 = 'paiement';
$field = 'fk_facture';
$field2 = 'fk_paiement';
$field3=', p.ref_ext';
$sharedentity = 'facture';
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
{
@ -304,10 +305,11 @@ abstract class CommonInvoice extends CommonObject
$table2 = 'paiementfourn';
$field = 'fk_facturefourn';
$field2 = 'fk_paiementfourn';
$field3='';
$sharedentity = 'facture_fourn';
}
$sql = 'SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code';
$sql = 'SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code'.$field3;
$sql .= ' FROM '.MAIN_DB_PREFIX.$table.' as pf, '.MAIN_DB_PREFIX.$table2.' as p, '.MAIN_DB_PREFIX.'c_paiement as t';
$sql .= ' WHERE pf.'.$field.' = '.$this->id;
//$sql.= ' WHERE pf.'.$field.' = 1';
@ -325,7 +327,11 @@ abstract class CommonInvoice extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$retarray[] = array('amount'=>$obj->amount, 'type'=>$obj->code, 'date'=>$obj->datep, 'num'=>$obj->num, 'ref'=>$obj->ref);
$tmp = array('amount'=>$obj->amount,'type'=>$obj->code, 'date'=>$obj->datep, 'num'=>$obj->num, 'ref'=>$obj->ref);
if (!empty($field3)) {
$tmp['ref_ext'] = $obj->ref_ext;
}
$retarray[]=$tmp;
$i++;
}
$this->db->free($resql);