Fix: Avoid to load language when we can not.

This commit is contained in:
Laurent Destailleur 2014-11-12 10:25:56 +01:00
parent 81f0d953e3
commit 608fa5eaed
2 changed files with 7 additions and 1 deletions

View File

@ -197,6 +197,12 @@ class Translate
if ($alt < 1 && isset($langarray[1]) && strtolower($langarray[0]) == strtolower($langarray[1])) $alt=1;
if ($alt < 2 && strtolower($langofdir) == 'en_us') $alt=2;
if (empty($langofdir)) // This may occurs when load is called without setting the language and without providing a value for forcelangdir
{
dol_syslog("Error: ".get_class($this)."::Load was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
return -1;
}
foreach($this->dir as $keydir => $searchdir)
{
// Directory of translation files

View File

@ -2811,7 +2811,7 @@ class Societe extends CommonObject
}
else // For backward compatibility
{
dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_WARNING);
dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_ERR);
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$country_code=getCountry($country_id,2,$this->db); // This need a SQL request, but it's the old feature that should not be used anymore
$country_label=getCountry($country_id,0,$this->db); // This need a SQL request, but it's the old feature that should not be used anymore