Add multilang support into getProductOrService webservice method
This commit is contained in:
parent
181a49c18c
commit
f9e08c23d9
@ -303,7 +303,7 @@ $server->register(
|
||||
* @param int $id Id of object
|
||||
* @param string $ref Ref of object
|
||||
* @param ref_ext $ref_ext Ref external of object
|
||||
* @param $lang $lang Force lang
|
||||
* @param string $lang Lang to force
|
||||
* @return mixed
|
||||
*/
|
||||
function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='')
|
||||
@ -312,6 +312,9 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang=''
|
||||
|
||||
dol_syslog("Function: getProductOrService login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
|
||||
|
||||
$langcode=($lang?$lang:(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT));
|
||||
$langs->setDefaultLang($langcode);
|
||||
|
||||
if ($authentication['entity']) $conf->entity=$authentication['entity'];
|
||||
|
||||
// Init and check authentication
|
||||
@ -347,6 +350,10 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang=''
|
||||
$pdir = get_exdir($product->id,2) . $product->id ."/photos/";
|
||||
$dir = $dir . '/'. $pdir;
|
||||
|
||||
if (! empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"];
|
||||
if (! empty($product->multilangs[$langs->defaultlang]["description"])) $product->description = $product->multilangs[$langs->defaultlang]["description"];
|
||||
if (! empty($product->multilangs[$langs->defaultlang]["note"])) $product->note = $product->multilangs[$langs->defaultlang]["note"];
|
||||
|
||||
// Create
|
||||
$objectresp = array(
|
||||
'result'=>array('result_code'=>'OK', 'result_label'=>''),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user