From a77b343db2b028f6998f8ba2553aa6230bd7b44a Mon Sep 17 00:00:00 2001 From: Egils Consulting Date: Tue, 4 Aug 2020 21:58:01 +0200 Subject: [PATCH 1/2] Update api_supplier_invoices.class.php Unified names. Renamed variable to an english name $paiementid => $payment_mode_id Added hints where to look up the IDs needed. --- .../class/api_supplier_invoices.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 5ec2b6f49a6..7722f2584f4 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -384,12 +384,12 @@ class SupplierInvoices extends DolibarrApi * * @param int $id Id of invoice * @param string $datepaye {@from body} Payment date {@type timestamp} - * @param int $paiementid {@from body} Payment mode Id {@min 1} + * @param int $payment_mode_id {@from body} Payment mode ID (look it up via REST GET to /setup/dictionary/payment_types) {@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_payment {@from body} Payment number (optional) + * @param int $accountid {@from body} Bank account ID (look it up via REST GET to /bankaccounts) {@min 1} + * @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 $chqemetteur {@from body} Payment issuer (mandatory if payment_mode_id corresponds to 'CHQ'-payment type) * @param string $chqbank {@from body} Issuer bank name (optional) * * @url POST {id}/payments @@ -416,12 +416,12 @@ class SupplierInvoices extends DolibarrApi if (!empty($conf->banque->enabled)) { if (empty($accountid)) { - throw new RestException(400, 'Account ID is mandatory'); + throw new RestException(400, 'Bank account ID is mandatory'); } } - if (empty($paiementid)) { - throw new RestException(400, 'Paiement ID or Paiement Code is mandatory'); + if (empty($payment_mode_id)) { + throw new RestException(400, 'Payment mode ID is mandatory'); } @@ -452,8 +452,8 @@ class SupplierInvoices extends DolibarrApi $paiement->datepaye = $datepaye; $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id $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->paiementid = $payment_mode_id; + $paiement->paiementcode = dol_getIdFromCode($this->db, $payment_mode_id, 'c_paiement', 'id', 'code', 1); $paiement->num_payment = $num_payment; $paiement->note_public = $comment; From f26a287d10781a48e996a6a59d8f2be32f74ae1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Aug 2020 23:50:01 +0200 Subject: [PATCH 2/2] Update api_supplier_invoices.class.php --- htdocs/fourn/class/api_supplier_invoices.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 7722f2584f4..db288a5169a 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -399,7 +399,7 @@ class SupplierInvoices extends DolibarrApi * @throws RestException 401 * @throws RestException 404 */ - public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_payment = '', $comment = '', $chqemetteur = '', $chqbank = '') + public function addPayment($id, $datepaye, $payment_mode_id, $closepaidinvoices, $accountid, $num_payment = '', $comment = '', $chqemetteur = '', $chqbank = '') { global $conf;