diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 89ab001986577e0886779137ba59818878936d04..866b746362bd596e9c5b400b00835a30f19b72d3 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -735,7 +735,7 @@ class Translate * * @param string $langdir Directory to scan * @param integer $maxlength Max length for each value in combo box (will be truncated) - * @param int $usecode Show code instead of country name for language variant + * @param int $usecode 1=Show code instead of country name for language variant, 2=Show only code * @return array List of languages */ function get_available_languages($langdir=DOL_DOCUMENT_ROOT,$maxlength=0,$usecode=0) @@ -751,9 +751,13 @@ class Translate { $this->load("languages"); - if ($usecode || ! empty($conf->global->MAIN_SHOW_LANGUAGE_CODE)) + if ($usecode == 2) { - $langs_available[$dir] = $dir.': '.dol_trunc($this->trans('Language_'.$dir),$maxlength); + $langs_available[$dir] = $dir; + } + if ($usecode == 1 || ! empty($conf->global->MAIN_SHOW_LANGUAGE_CODE)) + { + $langs_available[$dir] = $dir.': '.dol_trunc($this->trans('Language_'.$dir),$maxlength); } else { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c725d2c44202da69a0a8b4a1a509ab38037c3d21..2d1a4187963d98e63bd7417fb2d5afcb486302ac 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -734,6 +734,7 @@ class Product extends CommonObject $sql.= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy)."'"; $sql.= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell)."'"; $sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null"); + $sql.= ", cost_price = " . ($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null'); $sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit); $sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1); $sql.= ", fk_price_expression = ".($this->fk_price_expression != 0 ? $this->fk_price_expression : 'NULL'); @@ -987,8 +988,8 @@ class Product extends CommonObject function setMultiLangs($user) { global $langs; - - $langs_available = $langs->get_available_languages(); + + $langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 0, 2); $current_lang = $langs->getDefaultLang(); foreach ($langs_available as $key => $value) @@ -1017,7 +1018,7 @@ class Product extends CommonObject $sql2.= "','".$this->db->escape($this->description); $sql2.= "','".$this->db->escape($this->note)."')"; } - dol_syslog(get_class($this).'::setMultiLangs'); + dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key); if (! $this->db->query($sql2)) { $this->error=$this->db->lasterror(); @@ -1051,7 +1052,7 @@ class Product extends CommonObject // on ne sauvegarde pas des champs vides if ( $this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"] ) - dol_syslog(get_class($this).'::setMultiLangs'); + dol_syslog(get_class($this).'::setMultiLangs key = '.$key); if (! $this->db->query($sql2)) { $this->error=$this->db->lasterror();