2
0
forked from Wavyzz/dolibarr

NEw translation for shipping method API

cf https://github.com/Dolibarr/dolibarr/pull/22699
This commit is contained in:
ptibogxiv
2022-10-30 16:42:54 +01:00
committed by GitHub
parent 41175b73ee
commit ebcaa34134

View File

@@ -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());