Merge pull request #14096 from ATM-Consulting/11.0_NEW_fetch_multicurrency_code_with_payments

FIX 11.0 - multicurrency_amount not fetched with payments
This commit is contained in:
Laurent Destailleur 2020-06-17 12:30:36 +02:00 committed by GitHub
commit 33cd20de68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 36 deletions

View File

@ -68,9 +68,10 @@ class Paiement extends CommonObject
*/ */
public $montant; public $montant;
public $amount; // Total amount of payment public $amount; // Total amount of payment (in the main currency)
public $amounts=array(); // Array of amounts public $multicurrency_amount; // Total amount of payment (in the currency of the bank account)
public $multicurrency_amounts=array(); // Array of amounts public $amounts=array(); // array: invoice ID => amount for that invoice (in the main currency)>
public $multicurrency_amounts=array(); // array: invoice ID => amount for that invoice (in the invoice's currency)>
public $author; public $author;
public $paiementid; // Type of payment. Id saved into fields fk_paiement on llx_paiement public $paiementid; // Type of payment. Id saved into fields fk_paiement on llx_paiement
public $paiementcode; // Code of payment. public $paiementcode; // Code of payment.
@ -159,7 +160,7 @@ class Paiement extends CommonObject
*/ */
public function fetch($id, $ref = '', $fk_bank = '') public function fetch($id, $ref = '', $fk_bank = '')
{ {
$sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank,'; $sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank, p.multicurrency_amount,';
$sql.= ' c.code as type_code, c.libelle as type_label,'; $sql.= ' c.code as type_code, c.libelle as type_label,';
$sql.= ' p.num_paiement as num_payment, p.note,'; $sql.= ' p.num_paiement as num_payment, p.note,';
$sql.= ' b.fk_account'; $sql.= ' b.fk_account';
@ -187,6 +188,7 @@ class Paiement extends CommonObject
$this->num_payment = $obj->num_payment; $this->num_payment = $obj->num_payment;
$this->montant = $obj->amount; // deprecated $this->montant = $obj->amount; // deprecated
$this->amount = $obj->amount; $this->amount = $obj->amount;
$this->multicurrency_amount = $obj->multicurrency_amount;
$this->note = $obj->note; $this->note = $obj->note;
$this->type_label = $obj->type_label; $this->type_label = $obj->type_label;
$this->type_code = $obj->type_code; $this->type_code = $obj->type_code;

View File

@ -89,7 +89,7 @@ class PaiementFourn extends Paiement
{ {
$error=0; $error=0;
$sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank,'; $sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank, p.multicurrency_amount,';
$sql.= ' c.code as paiement_code, c.libelle as paiement_type,'; $sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
$sql.= ' p.num_paiement as num_payment, p.note, b.fk_account'; $sql.= ' p.num_paiement as num_payment, p.note, b.fk_account';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
@ -123,6 +123,7 @@ class PaiementFourn extends Paiement
$this->bank_line = $obj->fk_bank; $this->bank_line = $obj->fk_bank;
$this->montant = $obj->amount; $this->montant = $obj->amount;
$this->amount = $obj->amount; $this->amount = $obj->amount;
$this->multicurrency_amount = $obj->multicurrency_amount;
$this->note = $obj->note; $this->note = $obj->note;
$this->note_private = $obj->note; $this->note_private = $obj->note;
$this->type_code = $obj->paiement_code; $this->type_code = $obj->paiement_code;