From 1d74387125d9f975619b5e9b8e77500cb0f0bd53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Sep 2019 08:47:23 +0200 Subject: [PATCH] Removed deprecated property ->numero (We must use ->num_payment) --- htdocs/adherents/class/adherent.class.php | 3 +-- .../compta/paiement/cheque/class/remisecheque.class.php | 2 +- htdocs/compta/paiement/class/paiement.class.php | 8 +++++--- htdocs/fourn/class/paiementfourn.class.php | 9 ++++++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1b516e1c94e..7085f08be91 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1740,8 +1740,7 @@ class Adherent extends CommonObject $paiement->datepaye = $paymentdate; $paiement->amounts = $amounts; $paiement->paiementid = dol_getIdFromCode($this->db, $operation, 'c_paiement', 'code', 'id', 1); - $paiement->num_paiement = $num_chq; - $paiement->note = $label; + $paiement->num_payment = $num_chq; $paiement->note_public = $label; if (! $error) diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 316215a5caf..a582c95ce6b 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -813,7 +813,7 @@ class RemiseCheque extends CommonObject $rejectedPayment->amounts = array(); $rejectedPayment->datepaye = $rejection_date; $rejectedPayment->paiementid = dol_getIdFromCode($this->db, 'CHQ', 'c_paiement', 'code', 'id', 1); - $rejectedPayment->num_paiement = $payment->numero; + $rejectedPayment->num_payment = $payment->num_payment; while($obj = $db->fetch_object($resql)) { diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index a96a3d12f26..96f74fdae48 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -117,6 +117,7 @@ class Paiement extends CommonObject /** * @var int bank account id of payment * @deprecated + * @see $fk_account */ public $bank_account; @@ -182,7 +183,6 @@ class Paiement extends CommonObject $this->ref = $obj->ref?$obj->ref:$obj->rowid; $this->date = $this->db->jdate($obj->dp); $this->datepaye = $this->db->jdate($obj->dp); - $this->numero = $obj->num_payment; // deprecated $this->num_paiement = $obj->num_payment; // deprecated $this->num_payment = $obj->num_payment; $this->montant = $obj->amount; // deprecated @@ -286,10 +286,12 @@ class Paiement extends CommonObject $total = $totalamount_converted; // Maybe use price2num with MT for the converted value $mtotal = $totalamount; } + + $num_payment = ($this->num_payment?$this->num_payment:$this->num_paiement); $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)"; - $sql.= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($this->num_paiement)."', '".$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.")"; + $sql.= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$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.")"; dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG); $resql = $this->db->query($sql); @@ -885,7 +887,7 @@ class Paiement extends CommonObject $result = $this->db->query($sql); if ($result) { - $this->numero = $this->db->escape($num); + $this->num_payment = $this->db->escape($num); return 0; } else diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 51485a7db5e..9ba504bb876 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -88,7 +88,7 @@ class PaiementFourn extends Paiement $sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank,'; $sql.= ' c.code as paiement_code, c.libelle as paiement_type,'; - $sql.= ' p.num_paiement, 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.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid '; @@ -113,12 +113,15 @@ class PaiementFourn extends Paiement $this->entity = $obj->entity; $this->date = $this->db->jdate($obj->dp); $this->datepaye = $this->db->jdate($obj->dp); - $this->numero = $obj->num_paiement; - $this->num_paiement = $obj->num_paiement; + $this->num_paiement = $obj->num_payment; + $this->num_payment = $obj->num_payment; $this->bank_account = $obj->fk_account; + $this->fk_account = $obj->fk_account; $this->bank_line = $obj->fk_bank; $this->montant = $obj->amount; + $this->amount = $obj->amount; $this->note = $obj->note; + $this->note_private = $obj->note; $this->type_code = $obj->paiement_code; $this->type_libelle = $obj->paiement_type; $this->statut = $obj->statut;