forked from Wavyzz/dolibarr
Merge pull request #22711 from ptibogxiv/patch-59
NEW translation for shipping method API
This commit is contained in:
@@ -1190,6 +1190,7 @@ class Setup extends DolibarrApi
|
|||||||
* @param int $limit Number of items per page
|
* @param int $limit Number of items per page
|
||||||
* @param int $page Page number {@min 0}
|
* @param int $page Page number {@min 0}
|
||||||
* @param int $active Shipping methodsm is active or not {@min 0} {@max 1}
|
* @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')"
|
* @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')"
|
||||||
*
|
*
|
||||||
* @url GET dictionary/shipping_methods
|
* @url GET dictionary/shipping_methods
|
||||||
@@ -1198,7 +1199,7 @@ class Setup extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 400
|
* @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();
|
$list = array();
|
||||||
|
|
||||||
@@ -1234,7 +1235,9 @@ class Setup extends DolibarrApi
|
|||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
for ($i = 0; $i < $min; $i++) {
|
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 {
|
} else {
|
||||||
throw new RestException(400, $this->db->lasterror());
|
throw new RestException(400, $this->db->lasterror());
|
||||||
|
|||||||
Reference in New Issue
Block a user