From 73f2e9e5de7538d372350f74f71da5a846c7fe38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Mar 2020 19:23:18 +0100 Subject: [PATCH] WIP migrate num_paiement into num_payment Fix label for free product in takepos --- htdocs/cashdesk/validation_verif.php | 1 + htdocs/compta/facture/class/facture.class.php | 6 ++-- htdocs/compta/paiement/list.php | 6 ++-- htdocs/compta/paiement/tovalidate.php | 4 +-- htdocs/compta/paiement_charge.php | 9 +++--- .../class/bonprelevement.class.php | 2 +- .../class/rejetprelevement.class.php | 1 + htdocs/compta/sociales/card.php | 4 +-- .../class/paymentsocialcontribution.class.php | 29 ++++++++++++++----- .../modules/rapport/pdf_paiement.class.php | 8 ++--- htdocs/expensereport/card.php | 3 +- .../class/api_supplier_invoices.class.php | 6 ++-- htdocs/fourn/facture/paiement.php | 8 +++-- htdocs/langs/en_US/cashdesk.lang | 1 + htdocs/public/payment/paymentok.php | 1 + htdocs/takepos/invoice.php | 13 +++++---- htdocs/webservices/server_payment.php | 18 ++++++------ 17 files changed, 70 insertions(+), 50 deletions(-) diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index b7b37054d91..7783bf7137a 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -305,6 +305,7 @@ switch ($action) $payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice(); $payment->paiementid=$invoice->mode_reglement_id; $payment->num_paiement=''; + $payment->num_payment=''; $paiement_id = $payment->create($user); if ($paiement_id > 0) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b0b78b3bf03..74d4c482c6a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2251,10 +2251,10 @@ class Facture extends CommonInvoice // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Tag la facture comme paye completement (si close_code non renseigne) => this->fk_statut=2, this->paye=1 - * ou partiellement (si close_code renseigne) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 + * Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1 + * or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 * - * @param User $user Objet utilisateur qui modifie + * @param User $user Object user that modify * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple) * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @return int <0 if KO, >0 if OK diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 926c0bfc87e..c78a010777a 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -115,7 +115,7 @@ if (GETPOST("orphelins", "alpha")) { // Payments not linked to an invoice. Should not happend. For debug only. $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,"; - $sql.= " p.statut, p.num_paiement,"; + $sql.= " p.statut, p.num_paiement as num_payment,"; $sql.= " c.code as paiement_code"; // Add fields from hooks $parameters=array(); @@ -133,7 +133,7 @@ if (GETPOST("orphelins", "alpha")) else { $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives - $sql.= " p.statut, p.num_paiement,"; + $sql.= " p.statut, p.num_paiement as num_payment,"; $sql.= " c.code as paiement_code,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,"; $sql.= " s.rowid as socid, s.nom as name, s.email"; @@ -323,7 +323,7 @@ if ($resql) if (!$i) $totalarray['nbfield']++; // Payment number - print ''.$objp->num_paiement.''; + print ''.$objp->num_payment.''; if (!$i) $totalarray['nbfield']++; // Account diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php index 7539d6165ea..c14c29f3179 100644 --- a/htdocs/compta/paiement/tovalidate.php +++ b/htdocs/compta/paiement/tovalidate.php @@ -64,7 +64,7 @@ if (! $sortfield) $sortfield="p.rowid"; llxHeader(); $sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut"; -$sql.=", c.libelle as paiement_type, p.num_paiement"; +$sql.=", c.libelle as paiement_type, p.num_paiement as num_payment"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id"; if ($socid) { @@ -119,7 +119,7 @@ if ($resql) print ''; print ''.img_object($langs->trans("ShowPayment"), "payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp), 'day')."\n"; - print "$objp->paiement_type $objp->num_paiement\n"; + print "$objp->paiement_type $objp->num_payment\n"; print ''.price($objp->amount).''; print ''; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 561120aead6..31e13a9d356 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -108,9 +108,10 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y $paiement->chid = $chid; $paiement->datepaye = $datepaye; $paiement->amounts = $amounts; // Tableau de montant - $paiement->paiementtype = $_POST["paiementtype"]; - $paiement->num_paiement = $_POST["num_paiement"]; - $paiement->note = $_POST["note"]; + $paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml'); + $paiement->num_payment = GETPOST("num_payment", 'alphanohtml'); + $paiement->note = GETPOST("note", 'none'); + $paiement->note_private = GETPOST("note", 'none'); if (!$error) { @@ -243,7 +244,7 @@ if ($action == 'create') print ''.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print ''; - print ''."\n"; + print ''."\n"; print ''; print ''.$langs->trans("Comments").''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 4050d081fe4..41f1ebf5a62 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -484,7 +484,7 @@ class BonPrelevement extends CommonObject $paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice $paiement->paiementid = 3; // $paiement->num_payment = $this->ref; // Set ref of direct debit note - $paiement->num_paiement = $this->ref; // For bacward compatibility + $paiement->num_paiement = $this->ref; // For backward compatibility $paiement->id_prelevement = $this->id; $paiement_id = $paiement->create($user); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 740a1e47784..c78dbd06259 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -154,6 +154,7 @@ class RejetPrelevement $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal $pai->num_paiement = $fac->ref; + $pai->num_payment = $fac->ref; if ($pai->create($this->user) < 0) // we call with no_commit { diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 69ad435c64c..d7f20622a43 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -603,7 +603,7 @@ if ($id > 0) /* * Payments */ - $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; + $sql = "SELECT p.rowid, p.num_paiement as num_payment, datep as dp, p.amount,"; $sql .= " c.code as type_code,c.libelle as paiement_type,"; $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal'; $sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; @@ -647,7 +647,7 @@ if ($id > 0) print ''.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp), 'day')."\n"; $labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type; - print "".$labeltype.' '.$objp->num_paiement."\n"; + print "".$labeltype.' '.$objp->num_payment."\n"; if (!empty($conf->banque->enabled)) { $bankaccountstatic->id = $objp->baid; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 629a73578b2..02c15b099b9 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -69,8 +69,17 @@ class PaymentSocialContribution extends CommonObject */ public $fk_typepaiement; + /** + * @var string + * @deprecated + */ public $num_paiement; + /** + * @var string + */ + public $num_payment; + /** * @var int ID */ @@ -125,7 +134,8 @@ class PaymentSocialContribution extends CommonObject if (isset($this->fk_charge)) $this->fk_charge = (int) $this->fk_charge; if (isset($this->amount)) $this->amount = trim($this->amount); if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement; - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); + if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated + if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note)) $this->note = trim($this->note); if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; @@ -149,11 +159,11 @@ class PaymentSocialContribution extends CommonObject if ($totalamount != 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount,"; - $sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)"; + $sql .= " fk_typepaiement, num_paiement as num_payment, note, fk_user_creat, fk_bank)"; $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datepaye)."',"; $sql .= " ".$totalamount.","; - $sql .= " ".$this->paiementtype.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.","; + $sql .= " ".$this->paiementtype.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.","; $sql .= " 0)"; $resql = $this->db->query($sql); @@ -231,7 +241,7 @@ class PaymentSocialContribution extends CommonObject $sql.= " t.datep,"; $sql.= " t.amount,"; $sql.= " t.fk_typepaiement,"; - $sql.= " t.num_paiement,"; + $sql.= " t.num_paiement as num_payment,"; $sql.= " t.note,"; $sql.= " t.fk_bank,"; $sql.= " t.fk_user_creat,"; @@ -260,7 +270,8 @@ class PaymentSocialContribution extends CommonObject $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; $this->fk_typepaiement = $obj->fk_typepaiement; - $this->num_paiement = $obj->num_paiement; + $this->num_paiement = $obj->num_payment; + $this->num_payment = $obj->num_payment; $this->note = $obj->note; $this->fk_bank = $obj->fk_bank; $this->fk_user_creat = $obj->fk_user_creat; @@ -301,7 +312,8 @@ class PaymentSocialContribution extends CommonObject if (isset($this->fk_charge)) $this->fk_charge = (int) $this->fk_charge; if (isset($this->amount)) $this->amount = trim($this->amount); if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement; - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); + if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated + if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note)) $this->note = trim($this->note); if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; @@ -511,8 +523,9 @@ class PaymentSocialContribution extends CommonObject $this->datep = ''; $this->amount = ''; $this->fk_typepaiement = ''; - $this->num_paiement = ''; - $this->note = ''; + $this->num_payment = ''; + $this->note_private = ''; + $this->note_public = ''; $this->fk_bank = ''; $this->fk_user_creat = ''; $this->fk_user_modif = ''; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 7393f0e198d..163ba420fc7 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -181,8 +181,7 @@ class pdf_paiement switch ($this->doc_type) { case "client": $sql = "SELECT p.datep as dp, f.ref"; - //$sql .= ", c.libelle as paiement_type, p.num_paiement"; - $sql.= ", c.code as paiement_code, p.num_paiement"; + $sql.= ", c.code as paiement_code, p.num_paiement as num_payment"; $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; $sql.= ", pf.amount as pf_amount"; if (! empty($conf->banque->enabled)) @@ -212,8 +211,7 @@ class pdf_paiement break; case "fourn": $sql = "SELECT p.datep as dp, f.ref as ref"; - //$sql .= ", c.libelle as paiement_type, p.num_paiement"; - $sql.= ", c.code as paiement_code, p.num_paiement"; + $sql.= ", c.code as paiement_code, p.num_paiement as num_payment"; $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; $sql.= ", pf.amount as pf_amount"; if (! empty($conf->banque->enabled)) @@ -257,7 +255,7 @@ class pdf_paiement $lines[$i][0] = $objp->ref; $lines[$i][1] = dol_print_date($this->db->jdate($objp->dp), "day", false, $outputlangs, true); $lines[$i][2] = $langs->transnoentities("PaymentTypeShort".$objp->paiement_code); - $lines[$i][3] = $objp->num_paiement; + $lines[$i][3] = $objp->num_payment; $lines[$i][4] = price($objp->paiement_amount); $lines[$i][5] = price($objp->facture_amount); $lines[$i][6] = price($objp->pf_amount); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 79e418206a5..77c2cf07f8e 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2029,7 +2029,8 @@ else $paymentexpensereportstatic->id = $objp->rowid; $paymentexpensereportstatic->datepaye = $db->jdate($objp->dp); $paymentexpensereportstatic->ref = $objp->rowid; - $paymentexpensereportstatic->num_paiement = $objp->num_paiement; + $paymentexpensereportstatic->num_paiement = $objp->num_payment; + $paymentexpensereportstatic->num_payment = $objp->num_payment; $paymentexpensereportstatic->payment_code = $objp->payment_code; print ''; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 204471bc9e7..65ae5677c87 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -388,7 +388,7 @@ class SupplierInvoices extends DolibarrApi * @param int $paiementid {@from body} Payment mode Id {@min 1} * @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no} * @param int $accountid {@from body} Account Id {@min 1} - * @param string $num_paiement {@from body} Payment number (optional) + * @param string $num_payment {@from body} Payment number (optional) * @param string $comment {@from body} Note (optional) * @param string $chqemetteur {@from body} Payment issuer (mandatory if paiementcode = 'CHQ') * @param string $chqbank {@from body} Issuer bank name (optional) @@ -400,7 +400,7 @@ class SupplierInvoices extends DolibarrApi * @throws RestException 401 * @throws RestException 404 */ - public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') + public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_payment = '', $comment = '', $chqemetteur = '', $chqbank = '') { global $conf; @@ -455,7 +455,7 @@ class SupplierInvoices extends DolibarrApi $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paiement->paiementid = $paiementid; $paiement->paiementcode = dol_getIdFromCode($this->db, $paiementid, 'c_paiement', 'id', 'code', 1); - $paiement->num_payment = $num_paiement; + $paiement->num_payment = $num_payment; $paiement->note_public = $comment; $paiement_id = $paiement->create(DolibarrApiAccess::$user, ($closepaidinvoices=='yes'?1:0)); // This include closing invoices diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 6c4f5ff95b1..f45160b427e 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -299,10 +299,12 @@ if (empty($reshook)) $paiement->multicurrency_amounts = $multicurrency_amounts; $paiement->paiementid = GETPOST('paiementid', 'int'); - $paiement->num_payment = GETPOST('num_paiement', 'alpha'); + $paiement->num_payment = GETPOST('num_paiement', 'alphanohtml'); $paiement->note_private = GETPOST('comment', 'alpha'); - $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility - $paiement->note = $paiement->note_private; // For bacward compatibility + $paiement->num_paiement = $paiement->num_payment; // For backward compatibility + $paiement->num_payment = $paiement->num_payment; + $paiement->note = $paiement->note_private; // For backward compatibility + $paiement->note_private = $paiement->note_private; if (!$error) { diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 603f15d2779..ec86076ac22 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -16,6 +16,7 @@ AddThisArticle=Add this article RestartSelling=Go back on sell SellFinished=Sale complete PrintTicket=Print ticket +SendTicket=Send ticket NoProductFound=No article found ProductFound=product found NoArticle=No article diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 5029d717a10..28060a6d71e 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -658,6 +658,7 @@ if ($ispaymentok) } $paiement->paiementid = $paymentTypeId; $paiement->num_paiement = ''; + $paiement->num_payment = ''; $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; $paiement->ext_payment_id = $TRANSACTIONID; $paiement->ext_payment_site = $service; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 9f0705b967d..a822e2f53e6 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -45,6 +45,12 @@ $idproduct = GETPOST('idproduct', 'int'); $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant $placeid = 0; // $placeid is ID of invoice +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + + if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') { // DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED @@ -70,11 +76,6 @@ if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == '; } -if (empty($user->rights->takepos->run)) { - access_forbidden(); -} - - /** * Abort invoice creationg with a given error message * @@ -920,7 +921,7 @@ if ($placeid > 0) if ($line->desc) $tooltiptext .= '
'; $tooltiptext .= $line->desc; } - $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : $line->product_ref, $tooltiptext); + $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext); } else { if ($line->product_label) $htmlforlines .= $line->product_label; if ($line->product_label != $line->desc) diff --git a/htdocs/webservices/server_payment.php b/htdocs/webservices/server_payment.php index 3ccf3dafcaa..4f4490d4707 100644 --- a/htdocs/webservices/server_payment.php +++ b/htdocs/webservices/server_payment.php @@ -97,7 +97,7 @@ $server->wsdl->addComplexType( '', array( 'amount' => array('name'=>'amount','type'=>'xsd:double'), - 'num_paiement' => array('name'=>'num_paiement','type'=>'xsd:string'), + 'num_payment' => array('name'=>'num_payment','type'=>'xsd:string'), 'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'), 'bank_account' => array('name'=>'bank_account','type'=>'xsd:int'), 'payment_mode_id' => array('name'=>'payment_mode_id','type'=>'xsd:int'), @@ -167,14 +167,14 @@ function createPayment($authentication, $payment) $soc = new Societe($db); $res = $soc->fetch($payment['thirdparty_id']); - $new_payment = new Paiement($db); - $new_payment->amount = doubleval($payment['amount']); - $new_payment->num_paiement = $payment['num_paiement']; - $new_payment->bank_account = intval($payment['bank_account']); - $new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id; - $new_payment->datepaye = $now; - $new_payment->author = $payment['thirdparty_id']; - $new_payment->amounts = array(); + $new_payment = new Paiement($db); + $new_payment->amount = doubleval($payment['amount']); + $new_payment->num_payment = $payment['num_payment']; + $new_payment->fk_account = intval($payment['bank_account']); + $new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id; + $new_payment->datepaye = $now; + $new_payment->author = $payment['thirdparty_id']; + $new_payment->amounts = array(); if (intval($payment['invoice_id']) > 0) { $new_payment->amounts[ $payment['invoice_id'] ] = $new_payment->amount;