Can use several root directories.
This commit is contained in:
parent
7e0fbd02a1
commit
fcc5f9f28d
@ -23,7 +23,6 @@
|
|||||||
* \brief Ensemble de fonctions de base pour le module produit et service
|
* \brief Ensemble de fonctions de base pour le module produit et service
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function product_prepare_head($product, $user)
|
function product_prepare_head($product, $user)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
@ -122,7 +121,6 @@ function product_prepare_head($product, $user)
|
|||||||
foreach ($conf->tabs_modules['product'] as $value)
|
foreach ($conf->tabs_modules['product'] as $value)
|
||||||
{
|
{
|
||||||
$values=split(':',$value);
|
$values=split(':',$value);
|
||||||
|
|
||||||
if ($values[2]) $langs->load($values[2]);
|
if ($values[2]) $langs->load($values[2]);
|
||||||
$head[$h][0] = eregi_replace('__ID__',$product->id,$values[3]);
|
$head[$h][0] = eregi_replace('__ID__',$product->id,$values[3]);
|
||||||
$head[$h][1] = $langs->trans($values[1]);
|
$head[$h][1] = $langs->trans($values[1]);
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class MouvementStock
|
|||||||
$sql.= " (".$qty.",".$entrepot_id.",".$fk_product.")";
|
$sql.= " (".$qty.",".$entrepot_id.",".$fk_product.")";
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_syslog("MouvementStock::_create sql=".$sql, LOG_DEBUG);
|
dolibarr_syslog("MouvementStock::_Create sql=".$sql, LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -130,11 +130,17 @@ class MouvementStock
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add movement for sub products
|
// Add movement for sub products
|
||||||
if ($conf->global->PRODUIT_SOUSPRODUITS)
|
if ($error == 0 && $conf->global->PRODUIT_SOUSPRODUITS)
|
||||||
{
|
{
|
||||||
$error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, $price=0);
|
$error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, $price=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// composition module
|
||||||
|
if ($error == 0 && $qty < 0 && $conf->global->MAIN_MODULE_COMPOSITION)
|
||||||
|
{
|
||||||
|
$error = $this->_createProductComposition($user, $fk_product, $entrepot_id, $qty, $type, $price=0);
|
||||||
|
}
|
||||||
|
|
||||||
if ($error == 0)
|
if ($error == 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@ -183,6 +183,8 @@ class Translate {
|
|||||||
|
|
||||||
foreach($this->dir as $searchdir)
|
foreach($this->dir as $searchdir)
|
||||||
{
|
{
|
||||||
|
$newalt=$alt;
|
||||||
|
|
||||||
// If $domain is @xxx instead of xxx then we look for module lang file htdocs/xxx/langs/code_CODE/xxx.lang
|
// If $domain is @xxx instead of xxx then we look for module lang file htdocs/xxx/langs/code_CODE/xxx.lang
|
||||||
// instead of global lang file htdocs/langs/code_CODE/xxx.lang
|
// instead of global lang file htdocs/langs/code_CODE/xxx.lang
|
||||||
if (eregi('@',$domain)) // It's a language file of a module, we look in dir of this module.
|
if (eregi('@',$domain)) // It's a language file of a module, we look in dir of this module.
|
||||||
@ -191,7 +193,6 @@ class Translate {
|
|||||||
$searchdir=$searchdir ."/".$domain."/langs";
|
$searchdir=$searchdir ."/".$domain."/langs";
|
||||||
}
|
}
|
||||||
else $searchdir=$searchdir."/langs";
|
else $searchdir=$searchdir."/langs";
|
||||||
//print 'rrr'.$searchdir;
|
|
||||||
|
|
||||||
// Directory of translation files
|
// Directory of translation files
|
||||||
$scandir = $searchdir."/".$this->defaultlang;
|
$scandir = $searchdir."/".$this->defaultlang;
|
||||||
@ -199,7 +200,7 @@ class Translate {
|
|||||||
$filelangexists=is_file($file_lang);
|
$filelangexists=is_file($file_lang);
|
||||||
|
|
||||||
// Check in "always available" alternate file if not found or if asked
|
// Check in "always available" alternate file if not found or if asked
|
||||||
if ($alt || ! $filelangexists)
|
if ($newalt || ! $filelangexists)
|
||||||
{
|
{
|
||||||
// Dir of always available alternate file (en_US or fr_FR)
|
// Dir of always available alternate file (en_US or fr_FR)
|
||||||
if ($this->defaultlang == "en_US") $scandiralt = $searchdir."/fr_FR";
|
if ($this->defaultlang == "en_US") $scandiralt = $searchdir."/fr_FR";
|
||||||
@ -210,9 +211,10 @@ class Translate {
|
|||||||
|
|
||||||
$file_lang = $scandiralt . "/".$domain.".lang";
|
$file_lang = $scandiralt . "/".$domain.".lang";
|
||||||
$filelangexists=is_file($file_lang);
|
$filelangexists=is_file($file_lang);
|
||||||
$alt=1;
|
$newalt=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//print 'eee'.$file_lang."-".$filelangexists;
|
||||||
if ($filelangexists)
|
if ($filelangexists)
|
||||||
{
|
{
|
||||||
// Enable cache of lang file in session (faster but need more memory)
|
// Enable cache of lang file in session (faster but need more memory)
|
||||||
@ -258,7 +260,7 @@ class Translate {
|
|||||||
if ($this->charset_inputfile == 'ISO-8859-1') $value=utf8_encode($value);
|
if ($this->charset_inputfile == 'ISO-8859-1') $value=utf8_encode($value);
|
||||||
|
|
||||||
// We do not load Separator values for alternate files
|
// We do not load Separator values for alternate files
|
||||||
if (! $alt || (! eregi('^Separator',$key)))
|
if (! $newalt || (! eregi('^Separator',$key)))
|
||||||
{
|
{
|
||||||
$this->tab_translate[$key]=$value;
|
$this->tab_translate[$key]=$value;
|
||||||
}
|
}
|
||||||
@ -270,7 +272,7 @@ class Translate {
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
// Pour les langues aux fichiers parfois incomplets, on charge la langue alternative
|
// Pour les langues aux fichiers parfois incomplets, on charge la langue alternative
|
||||||
if (! $alt && $this->defaultlang != "fr_FR" && $this->defaultlang != "en_US")
|
if (! $newalt && $this->defaultlang != "fr_FR" && $this->defaultlang != "en_US")
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Translate::Load loading alternate translation file (to complete ".$this->defaultlang."/".$domain.".lang file)", LOG_DEBUG);
|
dolibarr_syslog("Translate::Load loading alternate translation file (to complete ".$this->defaultlang."/".$domain.".lang file)", LOG_DEBUG);
|
||||||
$this->load($domain,1);
|
$this->load($domain,1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user