From ebcaa34134ca5d73f957a156f504cdc0b3f9a2fd Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 30 Oct 2022 16:42:54 +0100 Subject: [PATCH] NEw translation for shipping method API cf https://github.com/Dolibarr/dolibarr/pull/22699 --- htdocs/api/class/api_setup.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 406172590d7..54f08cb1df3 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1188,6 +1188,7 @@ class Setup extends DolibarrApi * @param int $limit Number of items per page * @param int $page Page number {@min 0} * @param int $active Shipping methodsm is active or not {@min 0} {@max 1} + * @param string $lang Code of the language the label of the method must be translated to * @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')" * * @url GET dictionary/shipping_methods @@ -1196,7 +1197,7 @@ class Setup extends DolibarrApi * * @throws RestException 400 */ - public function getShippingModes($limit = 100, $page = 0, $active = 1, $sqlfilters = '') + public function getShippingModes($limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '') { $list = array(); @@ -1232,7 +1233,9 @@ class Setup extends DolibarrApi $num = $this->db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { - $list[] = $this->db->fetch_object($result); + $method = $this->db->fetch_object($result); + $this->translateLabel($method, $lang, '', array('dict')); + $list[] = $method; } } else { throw new RestException(400, $this->db->lasterror());