36 public $charset_output =
'UTF-8';
38 public $tab_translate = array();
39 private $_tab_loaded = array();
41 public $cache_labels = array();
42 public $cache_currencies = array();
43 private $cache_currencies_all_loaded =
false;
54 if (!empty($conf->file->character_set_client)) $this->charset_output = $conf->file->character_set_client;
55 if ($dir) $this->dir = array($dir);
56 else $this->dir = $conf->file->dol_document_root;
73 if (!empty($conf->global->MAIN_FORCELANGDIR))
77 foreach ($conf->file->dol_document_root as $dir)
79 $newdir = $dir.$conf->global->MAIN_FORCELANGDIR;
80 if (!in_array($newdir, $this->dir))
82 $more[
'module_'.$i] = $newdir; $i++;
85 $this->dir = array_merge($more, $this->dir);
88 $this->origlang = $srclang;
90 if (empty($srclang) || $srclang ==
'auto')
93 $langpref = empty(
$_SERVER[
'HTTP_ACCEPT_LANGUAGE']) ?
'' :
$_SERVER[
'HTTP_ACCEPT_LANGUAGE'];
94 $langpref = preg_replace(
"/;([^,]*)/i",
"", $langpref);
95 $langpref = str_replace(
"-",
"_", $langpref);
96 $langlist = preg_split(
"/[;,]/", $langpref);
97 $codetouse = preg_replace(
'/[^_a-zA-Z]/',
'', $langlist[0]);
98 }
else $codetouse = $srclang;
101 $langpart = explode(
"_", $codetouse);
103 if (!empty($langpart[1]))
106 $longforshort = array(
'ar'=>
'ar_SA');
107 $longforshortexcep = array(
'ar_EG');
108 if (isset($longforshort[strtolower($langpart[0])]) && !in_array($codetouse, $longforshortexcep)) $srclang = $longforshort[strtolower($langpart[0])];
109 elseif (!is_numeric($langpart[1])) {
110 $srclang = strtolower($langpart[0]).
"_".strtoupper($langpart[1]);
111 $longforlong = array(
'no_nb'=>
'nb_NO');
112 if (isset($longforlong[strtolower($srclang)])) $srclang = $longforlong[strtolower($srclang)];
113 }
else $srclang = strtolower($langpart[0]).
"_".strtoupper($langpart[0]);
116 $longforshort = array(
117 'am'=>
'am_ET',
'ar'=>
'ar_SA',
'bn'=>
'bn_DB',
'el'=>
'el_GR',
'ca'=>
'ca_ES',
'cs'=>
'cs_CZ',
'en'=>
'en_US',
'fa'=>
'fa_IR',
118 'gl'=>
'gl_ES',
'he'=>
'he_IL',
'hi'=>
'hi_IN',
'ja'=>
'ja_JP',
119 'ka'=>
'ka_GE',
'km'=>
'km_KH',
'kn'=>
'kn_IN',
'ko'=>
'ko_KR',
'lo'=>
'lo_LA',
'nb'=>
'nb_NO',
'no'=>
'nb_NO',
'ne'=>
'ne_NP',
120 'sl'=>
'sl_SI',
'sq'=>
'sq_AL',
'sr'=>
'sr_RS',
'sv'=>
'sv_SE',
'uk'=>
'uk_UA',
'vi'=>
'vi_VN',
'zh'=>
'zh_CN'
122 if (isset($longforshort[strtolower($langpart[0])])) $srclang = $longforshort[strtolower($langpart[0])];
123 elseif (!empty($langpart[0])) $srclang = strtolower($langpart[0]).
"_".strtoupper($langpart[0]);
124 else $srclang =
'en_US';
127 $this->defaultlang = $srclang;
128 $this->shortlang = substr($srclang, 0, 2);
142 if (empty($mode))
return $this->defaultlang;
143 else return substr($this->defaultlang, 0, 2);
155 foreach ($domains as $domain)
157 $this->
load($domain);
182 public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir =
'', $loadfromfileonly = 0, $forceloadifalreadynotfound = 0)
194 if ($this->defaultlang ==
'none_NONE')
return 0;
198 if (empty($loadfromfileonly) && count($this->tab_translate) == 0) $this->
loadFromDatabase($db);
201 $newdomain = $domain;
206 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $domain, $regs))
208 $newdomain = $regs[1];
209 $modulename = $regs[2];
213 if (!empty($this->_tab_loaded[$newdomain])
214 && ($this->_tab_loaded[$newdomain] != 2 || empty($forceloadifalreadynotfound)))
221 $langofdir = (empty($forcelangdir) ? $this->defaultlang : $forcelangdir);
224 $langarray = explode(
'_', $langofdir);
225 if ($alt < 1 && isset($langarray[1]) && (strtolower($langarray[0]) == strtolower($langarray[1]) || in_array(strtolower($langofdir), array(
'el_gr')))) $alt = 1;
226 if ($alt < 2 && strtolower($langofdir) ==
'en_us') $alt = 2;
228 if (empty($langofdir))
230 dol_syslog(
"Error: ".get_class($this).
"::load was called for domain=".$domain.
" but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
234 foreach ($this->dir as $searchdir)
237 $file_lang = $searchdir.($modulename ?
'/'.$modulename :
'').
"/langs/".$langofdir.
"/".$newdomain.
".lang";
240 $filelangexists = is_file($file_lang_osencoded);
253 if (!empty($conf->memcached->enabled) && !empty($conf->global->MEMCACHED_SERVER))
255 $usecachekey = $newdomain.
'_'.$langofdir.
'_'.md5($file_lang);
258 elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))
260 $usecachekey = $newdomain;
268 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
270 if (is_array($tmparray) && count($tmparray))
272 $this->tab_translate += $tmparray;
275 if ($alt == 2) $fileread = 1;
282 if ($fp = @fopen($file_lang,
"rt"))
284 if ($usecachekey) $tabtranslatedomain = array();
291 while ($line = fscanf($fp,
"%[^= ]%*[ =]%[^\n\r]"))
295 list($key, $value) = $line;
298 if (empty($this->tab_translate[$key]))
300 if ($key ==
'DIRECTION') {
301 if ($alt < 2 || empty($this->tab_translate[$key])) {
302 $this->tab_translate[$key] = $value;
303 if ($stopafterdirection) {
305 } elseif ($usecachekey) {
306 $tabtranslatedomain[$key] = $value;
309 } elseif ($key[0] ==
'#')
314 $this->tab_translate[$key] = str_replace(array(
'\\n',
'\\\\s'), array(
"\n",
'\s'), $value);
316 $tabtranslatedomain[$key] = $value;
327 if ($usecachekey && count($tabtranslatedomain))
329 $ressetcache =
dol_setcache($usecachekey, $tabtranslatedomain);
330 if ($ressetcache < 0)
332 $error =
'Failed to set cache for usecachekey='.$usecachekey.
' result='.$ressetcache;
337 if (empty($conf->global->MAIN_FORCELANGDIR))
break;
348 $langofdir = strtolower($langarray[0]).
'_'.strtoupper($langarray[0]);
349 if ($langofdir ==
'el_EL') $langofdir =
'el_GR';
350 if ($langofdir ==
'ar_AR') $langofdir =
'ar_SA';
351 $this->
load($domain, $alt + 1, $stopafterdirection, $langofdir);
359 $langofdir =
'en_US';
360 $this->
load($domain, $alt + 1, $stopafterdirection, $langofdir);
366 if ($fileread) $this->_tab_loaded[$newdomain] = 1;
368 if (empty($this->_tab_loaded[$newdomain])) $this->_tab_loaded[$newdomain] = 2;
373 if (empty($loadfromfileonly))
375 $overwritekey =
'MAIN_OVERWRITE_TRANS_'.$this->defaultlang;
376 if (!empty($conf->global->$overwritekey))
379 $tmparray = explode(
',', $conf->global->$overwritekey);
380 foreach ($tmparray as $tmp)
382 $tmparray2 = explode(
':', $tmp);
383 if (!empty($tmparray2[1])) $this->tab_translate[$tmparray2[0]] = $tmparray2[1];
389 if (!empty($this->tab_translate[
"SeparatorDecimal"]) && !empty($this->tab_translate[
"SeparatorThousand"])
390 && $this->tab_translate[
"SeparatorDecimal"] == $this->tab_translate[
"SeparatorThousand"]) $this->tab_translate[
"SeparatorThousand"] =
'';
411 $domain =
'database';
414 if (empty($db))
return 0;
418 $newdomain = $domain;
421 if (!empty($this->_tab_loaded[$newdomain]))
427 $this->_tab_loaded[$newdomain] = 1;
430 $langofdir = $this->defaultlang;
432 if (empty($langofdir))
434 dol_syslog(
"Error: ".get_class($this).
"::loadFromDatabase was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
444 if (!empty($conf->memcached->enabled) && !empty($conf->global->MEMCACHED_SERVER))
446 $usecachekey = $newdomain.
'_'.$langofdir;
449 elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))
451 $usecachekey = $newdomain;
459 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
461 if (is_array($tmparray) && count($tmparray))
463 $this->tab_translate += $tmparray;
471 if (!$found && !empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
474 $sql =
"SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX.
"overwrite_trans where lang='".$db->escape($this->defaultlang).
"' OR lang IS NULL";
475 $sql .=
" AND entity IN (0, ".getEntity(
'overwrite_trans').
")";
476 $sql .= $db->order(
"lang",
"DESC");
477 $resql = $db->query($sql);
481 $num = $db->num_rows(
$resql);
484 if ($usecachekey) $tabtranslatedomain = array();
489 $obj = $db->fetch_object(
$resql);
491 $key = $obj->transkey;
492 $value = $obj->transvalue;
495 if (empty($this->tab_translate[$key]))
498 $this->tab_translate[$key] = str_replace(array(
'\\n',
'\\\\s'), array(
"\n",
'\s'), $value);
500 if ($usecachekey) $tabtranslatedomain[$key] = $value;
510 if ($usecachekey && count($tabtranslatedomain))
512 $ressetcache =
dol_setcache($usecachekey, $tabtranslatedomain);
513 if ($ressetcache < 0)
515 $error =
'Failed to set cache for usecachekey='.$usecachekey.
' result='.$ressetcache;
525 if ($fileread) $this->_tab_loaded[$newdomain] = 1;
527 if (empty($this->_tab_loaded[$newdomain])) $this->_tab_loaded[$newdomain] = 2;
540 return $this->_tab_loaded[$domain];
558 if (!is_string($key)) {
560 return 'ErrorBadValueForParamNotAString';
564 if (preg_match(
'/^Civility([0-9A-Z]+)$/i', $key, $reg))
566 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_civility',
'code',
'label');
567 } elseif (preg_match(
'/^Currency([A-Z][A-Z][A-Z])$/i', $key, $reg))
569 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_currencies',
'code_iso',
'label');
570 } elseif (preg_match(
'/^SendingMethod([0-9A-Z]+)$/i', $key, $reg))
572 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_shipment_mode',
'code',
'libelle');
573 } elseif (preg_match(
'/^PaymentTypeShort([0-9A-Z]+)$/i', $key, $reg))
575 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_paiement',
'code',
'libelle',
'', 1);
576 } elseif (preg_match(
'/^OppStatus([0-9A-Z]+)$/i', $key, $reg))
578 $newstr = $this->
getLabelFromKey($db, $reg[1],
'c_lead_status',
'code',
'label');
579 } elseif (preg_match(
'/^OrderSource([0-9A-Z]+)$/i', $key, $reg))
608 public function trans($key, $param1 =
'', $param2 =
'', $param3 =
'', $param4 =
'', $maxsize = 0)
612 if (!empty($this->tab_translate[$key]))
614 $str = $this->tab_translate[$key];
617 $replacekey =
'MAIN_REPLACE_TRANS_'.$this->defaultlang;
618 if (!empty($conf->global->$replacekey))
620 $tmparray = explode(
';', $conf->global->$replacekey);
621 foreach ($tmparray as $tmp)
623 $tmparray2 = explode(
':', $tmp);
624 $str = preg_replace(
'/'.preg_quote($tmparray2[0]).
'/', $tmparray2[1], $str);
631 array(
'"',
'<b>',
'</b>',
'<u>',
'</u>',
'<i>',
'</i>',
'<center>',
'</center>',
'<strong>',
'</strong>',
'<a ',
'</a>',
'<br>',
'<span',
'</span>',
'< ',
'>'),
632 array(
'__quot__',
'__tagb__',
'__tagbend__',
'__tagu__',
'__taguend__',
'__tagi__',
'__tagiend__',
'__tagcenter__',
'__tagcenterend__',
'__tagb__',
'__tagbend__',
'__taga__',
'__tagaend__',
'__tagbr__',
'__tagspan__',
'__tagspanend__',
'__ltspace__',
'__gt__'),
636 if (strpos($key,
'Format') !== 0)
638 $str = sprintf($str, $param1, $param2, $param3, $param4);
642 $str = htmlentities($str, ENT_COMPAT, $this->charset_output);
646 array(
'__quot__',
'__tagb__',
'__tagbend__',
'__tagu__',
'__taguend__',
'__tagi__',
'__tagiend__',
'__tagcenter__',
'__tagcenterend__',
'__taga__',
'__tagaend__',
'__tagbr__',
'__tagspan__',
'__tagspanend__',
'__ltspace__',
'__gt__'),
647 array(
'"',
'<b>',
'</b>',
'<u>',
'</u>',
'<i>',
'</i>',
'<center>',
'</center>',
'<a ',
'</a>',
'<br>',
'<span',
'</span>',
'< ',
'>'),
651 if ($maxsize) $str =
dol_trunc($str, $maxsize);
675 public function transnoentities($key, $param1 =
'', $param2 =
'', $param3 =
'', $param4 =
'', $param5 =
'')
700 if (!empty($this->tab_translate[$key]))
702 $str = $this->tab_translate[$key];
705 $replacekey =
'MAIN_REPLACE_TRANS_'.$this->defaultlang;
706 if (!empty($conf->global->$replacekey))
708 $tmparray = explode(
';', $conf->global->$replacekey);
709 foreach ($tmparray as $tmp)
711 $tmparray2 = explode(
':', $tmp);
712 $str = preg_replace(
'/'.preg_quote($tmparray2[0]).
'/', $tmparray2[1], $str);
716 if (!preg_match(
'/^Format/', $key))
719 $str = sprintf($str, $param1, $param2, $param3, $param4, $param5);
724 if ($key[0] ==
'$') {
return dol_eval($key, 1); }
739 if ($this->tab_translate[
"$str$countrycode"])
return $this->
trans(
"$str$countrycode");
740 else return $this->
trans($str);
753 if (!empty($this->tab_translate[
"$str$countrycode"]))
return $this->
transnoentities(
"$str$countrycode");
767 if ($pagecodefrom ==
'ISO-8859-1' && $this->charset_output ==
'UTF-8') $str = utf8_encode($str);
768 if ($pagecodefrom ==
'UTF-8' && $this->charset_output ==
'ISO-8859-1') $str = utf8_decode(str_replace(
'€', chr(128), $str));
788 $this->
load(
"languages");
791 $handle = opendir($langdir.
"/langs");
792 $langs_available = array();
793 while ($dir = trim(readdir($handle)))
796 if (preg_match(
'/^([a-z]+)_([A-Z]+)/i', $dir, $regs))
800 $arrayofspecialmainlanguages = array(
830 if (strtolower($regs[1]) != strtolower($regs[2]) && !in_array($dir, $arrayofspecialmainlanguages))
continue;
833 if (!empty($conf->global->MAIN_LANGUAGES_ALLOWED) && !in_array($dir, explode(
',', $conf->global->MAIN_LANGUAGES_ALLOWED)))
continue;
837 $langs_available[$dir] = $dir;
840 if ($usecode == 1 || !empty($conf->global->MAIN_SHOW_LANGUAGE_CODE))
842 $langs_available[$dir] = $dir.
': '.
dol_trunc($this->
trans(
'Language_'.$dir), $maxlength);
844 $langs_available[$dir] = $this->
trans(
'Language_'.$dir);
847 $langs_available[$dir] = str_replace(
' (United States)',
'', $langs_available[$dir]);
851 return $langs_available;
867 foreach ($this->dir as $searchdir)
869 if (is_readable(
dol_osencode($searchdir.
"/langs/".$this->defaultlang.
"/".$filename)))
return true;
874 if ($this->defaultlang !=
"en_US") $filenamealt = $searchdir.
"/langs/en_US/".$filename;
876 if (is_readable(
dol_osencode($filenamealt)))
return true;
899 $newnumber = $number;
901 $dirsubstitutions = array_merge(array(), $conf->modules_parts[
'substitutions']);
902 foreach ($dirsubstitutions as $reldir)
908 if (!is_dir($newdir))
continue;
910 $fonc =
'numberwords';
911 if (
file_exists($newdir.
'/functions_'.$fonc.
'.lib.php'))
913 include_once $newdir.
'/functions_'.$fonc.
'.lib.php';
914 $newnumber = numberwords_getLabelFromNumber($this, $number, $isamount);
938 public function getLabelFromKey($db, $key, $tablename, $fieldkey, $fieldlabel, $keyforselect =
'', $filteronentity = 0)
941 if ($key ==
'')
return '';
947 if ($tmp != $key && $tmp !=
'ErrorBadValueForParamNotAString')
953 if (isset($this->cache_labels[$tablename][$key]))
955 return $this->cache_labels[$tablename][$key];
958 $sql =
"SELECT ".$fieldlabel.
" as label";
959 $sql .=
" FROM ".MAIN_DB_PREFIX.$tablename;
960 $sql .=
" WHERE ".$fieldkey.
" = '".$db->escape($keyforselect ? $keyforselect : $key).
"'";
961 if ($filteronentity) $sql .=
" AND entity IN (".getEntity($tablename).
')';
962 dol_syslog(get_class($this).
'::getLabelFromKey', LOG_DEBUG);
963 $resql = $db->query($sql);
966 $obj = $db->fetch_object(
$resql);
967 if ($obj) $this->cache_labels[$tablename][$key] = $obj->label;
968 else $this->cache_labels[$tablename][$key] = $key;
971 return $this->cache_labels[$tablename][$key];
973 $this->error = $db->lasterror();
992 if (in_array($currency_code, array(
'USD')))
return $symbol.$amount;
993 else return $amount.$symbol;
1006 $currency_sign =
'';
1008 if (function_exists(
"mb_convert_encoding"))
1012 if (isset($this->cache_currencies[$currency_code]) && !empty($this->cache_currencies[$currency_code][
'unicode']) && is_array($this->cache_currencies[$currency_code][
'unicode']))
1014 foreach ($this->cache_currencies[$currency_code][
'unicode'] as $unicode)
1016 $currency_sign .= mb_convert_encoding(
"&#{$unicode};",
"UTF-8",
'HTML-ENTITIES');
1021 return ($currency_sign ? $currency_sign : $currency_code);
1034 if ($this->cache_currencies_all_loaded)
return 0;
1035 if (!empty($currency_code) && isset($this->cache_currencies[$currency_code]))
return 0;
1037 $sql =
"SELECT code_iso, label, unicode";
1038 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_currencies";
1039 $sql .=
" WHERE active = 1";
1040 if (!empty($currency_code)) $sql .=
" AND code_iso = '".$db->escape($currency_code).
"'";
1043 dol_syslog(get_class($this).
'::loadCacheCurrencies', LOG_DEBUG);
1044 $resql = $db->query($sql);
1047 $this->
load(
"dict");
1049 if (!empty($currency_code))
foreach ($this->cache_currencies as $key => $val) $label[$key] = $val[
'label'];
1051 $num = $db->num_rows(
$resql);
1055 $obj = $db->fetch_object(
$resql);
1058 $this->cache_currencies[$obj->code_iso][
'label'] = ($obj->code_iso && $this->
trans(
"Currency".$obj->code_iso) !=
"Currency".$obj->code_iso ? $this->
trans(
"Currency".$obj->code_iso) : ($obj->label !=
'-' ? $obj->label :
''));
1059 $this->cache_currencies[$obj->code_iso][
'unicode'] = (array) json_decode($obj->unicode,
true);
1060 $label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso][
'label'];
1063 if (empty($currency_code)) $this->cache_currencies_all_loaded =
true;
1067 array_multisort($label, SORT_ASC, $this->cache_currencies);
1086 $substitutionarray = array();
1088 foreach ($this->tab_translate as $code => $label) {
1089 $substitutionarray[
'lang_'.$code] = $label;
1090 $substitutionarray[
'__('.$code.
')__'] = $label;
1093 return $substitutionarray;
convToOutputCharset($str, $pagecodefrom= 'UTF-8')
Convert a string into output charset (this->charset_output that should be defined to conf->file->char...
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_getcache($memoryid)
Read a memory area shared by all users, all sessions on server.
dol_eval($s, $returnvalue=0, $hideerrors=1)
Replace eval function to add more security.
transnoentities($key, $param1= '', $param2= '', $param3= '', $param4= '', $param5= '')
Return translated value of a text string If there is no match for this text, we look in alternative f...
loadFromDatabase($db)
Load translation key-value from database into a memory array.
__construct($dir, $conf)
Constructor.
getLabelFromNumber($number, $isamount= '')
Return full text translated to language label for a key.
loadCacheCurrencies($currency_code)
Load into the cache this->cache_currencies, all currencies.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
transcountrynoentities($str, $countrycode)
Retourne la version traduite du texte passe en parametre complete du code pays.
file_exists($filename, $searchalt=0)
Return if a filename $filename exists for current language (or alternate language) ...
getCurrencySymbol($currency_code, $forceloadall=0)
Return a currency code into its symbol.
getLabelFromKey($db, $key, $tablename, $fieldkey, $fieldlabel, $keyforselect= '', $filteronentity=0)
Return a label for a key.
isLoaded($domain)
Get information with result of loading data for domain.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
dol_setcache($memoryid, $data)
Save data into a memory area shared by all users, all sessions on server.
Class to manage translations.
setDefaultLang($srclang= 'en_US')
Set accessor for this->defaultlang.
getCurrencyAmount($currency_code, $amount)
Return a currency code into its symbol.
get_available_languages($langdir=DOL_DOCUMENT_ROOT, $maxlength=0, $usecode=0, $mainlangonly=0)
Return list of all available languages.
print $_SERVER["PHP_SELF"]
Edit parameters.
getDefaultLang($mode=0)
Return active language code for current user It's an accessor for this->defaultlang.
get_translations_for_substitutions()
Return an array with content of all loaded translation keys (found into this->tab_translate) so we ge...
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
loadLangs($domains)
Load translation files.
load($domain, $alt=0, $stopafterdirection=0, $forcelangdir= '', $loadfromfileonly=0, $forceloadifalreadynotfound=0)
Load translation key-value for a particular file, into a memory array.
dol_trunc($string, $size=40, $trunc= 'right', $stringencoding= 'UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
getTradFromKey($key)
Return translated value of key for special keys ("Currency...", "Civility...", ...).
trans($key, $param1= '', $param2= '', $param3= '', $param4= '', $maxsize=0)
Return text translated of text received as parameter (and encode it into HTML) If there is no match f...
transcountry($str, $countrycode)
Return translation of a key depending on country.
transnoentitiesnoconv($key, $param1= '', $param2= '', $param3= '', $param4= '', $param5= '')
Return translated value of a text string If there is no match for this text, we look in alternative f...