Fix in most cases, we don't need translated value of languages, jsut

list of language code.
Fix cost price was not updated.
This commit is contained in:
Laurent Destailleur 2016-02-23 19:50:33 +01:00
parent 7bd700113a
commit 28b8258acb
2 changed files with 12 additions and 7 deletions

View File

@ -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
{

View File

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