Update paiement.class.php
This commit is contained in:
parent
48e34c2069
commit
d728d268ca
@ -143,6 +143,10 @@ class Paiement extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $fk_paiement; // Type of payment
|
public $fk_paiement; // Type of payment
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string payment external reference
|
||||||
|
*/
|
||||||
|
public $ref_ext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -164,7 +168,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, p.multicurrency_amount,';
|
$sql = 'SELECT p.rowid, p.ref, p.ref_ext, 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 +191,7 @@ class Paiement extends CommonObject
|
|||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->ref ? $obj->ref : $obj->rowid;
|
$this->ref = $obj->ref ? $obj->ref : $obj->rowid;
|
||||||
|
$this->ref_ext = $obj->ref_ext;
|
||||||
$this->date = $this->db->jdate($obj->dp);
|
$this->date = $this->db->jdate($obj->dp);
|
||||||
$this->datepaye = $this->db->jdate($obj->dp);
|
$this->datepaye = $this->db->jdate($obj->dp);
|
||||||
$this->num_paiement = $obj->num_payment; // deprecated
|
$this->num_paiement = $obj->num_payment; // deprecated
|
||||||
@ -279,6 +284,10 @@ class Paiement extends CommonObject
|
|||||||
|
|
||||||
$this->ref = $this->getNextNumRef(is_object($thirdparty) ? $thirdparty : '');
|
$this->ref = $this->getNextNumRef(is_object($thirdparty) ? $thirdparty : '');
|
||||||
|
|
||||||
|
if (empty($this->ref_ext)) {
|
||||||
|
$this->ref_ext = '';
|
||||||
|
}
|
||||||
|
|
||||||
if ($way == 'dolibarr')
|
if ($way == 'dolibarr')
|
||||||
{
|
{
|
||||||
$total = $totalamount;
|
$total = $totalamount;
|
||||||
@ -291,8 +300,8 @@ class Paiement extends CommonObject
|
|||||||
$num_payment = ($this->num_payment ? $this->num_payment : $this->num_paiement);
|
$num_payment = ($this->num_payment ? $this->num_payment : $this->num_paiement);
|
||||||
$note = ($this->note_public ? $this->note_public : $this->note);
|
$note = ($this->note_public ? $this->note_public : $this->note);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, pos_change)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, ref_ext, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat, pos_change)";
|
||||||
$sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", ";
|
$sql .= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '".$this->db->escape($this->ref_ext)."', '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", ";
|
||||||
$sql .= "'".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".((int) $this->pos_change).")";
|
$sql .= "'".$this->db->escape($num_payment)."', '".$this->db->escape($note)."', ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").", ".$user->id.", ".((int) $this->pos_change).")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user