mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Can set the language of a user.
This commit is contained in:
parent
dd510901a4
commit
1bb24de555
|
|
@ -117,3 +117,4 @@ ForceUserHolidayValidator=Force leave request validator
|
|||
ValidatorIsSupervisorByDefault=By default, the validator is the supervisor of the user. Keep empty to keep this behaviour.
|
||||
UserPersonalEmail=Personal email
|
||||
UserPersonalMobile=Personal mobile phone
|
||||
WarningNotLangOfInterface=Warning, this is the main language the user speak, not the language of the interface he choosed to see. To change the interface language visible by this user, go on tab %s
|
||||
|
|
@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
|
|
@ -253,6 +254,8 @@ if (empty($reshook)) {
|
|||
|
||||
$object->fk_warehouse = GETPOST('fk_warehouse', 'int');
|
||||
|
||||
$object->lang = GETPOST('default_lang', 'aZ09');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
if ($ret < 0) {
|
||||
|
|
@ -415,6 +418,8 @@ if (empty($reshook)) {
|
|||
$object->fk_warehouse = GETPOST('fk_warehouse', 'int');
|
||||
}
|
||||
|
||||
$object->lang = GETPOST('default_lang', 'aZ09');
|
||||
|
||||
if (!empty($conf->multicompany->enabled))
|
||||
{
|
||||
if (!empty($_POST["superadmin"]))
|
||||
|
|
@ -671,6 +676,7 @@ if (empty($reshook)) {
|
|||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formfile = new FormFile($db);
|
||||
if (!empty($conf->stock->enabled)) $formproduct = new FormProduct($db);
|
||||
|
||||
|
|
@ -1113,6 +1119,14 @@ if ($action == 'create' || $action == 'adduserldap')
|
|||
print "</td></tr>";
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
|
||||
print $formadmin->select_language(GETPOST('default_lang', 'alpha') ?GETPOST('default_lang', 'alpha') : ($object->lang ? $object->lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Multicompany
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc))
|
||||
{
|
||||
|
|
@ -1654,6 +1668,19 @@ if ($action == 'create' || $action == 'adduserldap')
|
|||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Default language
|
||||
if (!empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
print '<tr><td>'.$langs->trans("DefaultLang").'</td><td>';
|
||||
//$s=picto_from_langcode($object->default_lang);
|
||||
//print ($s?$s.' ':'');
|
||||
$langs->load("languages");
|
||||
$labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : '');
|
||||
print $form->textwithpicto($labellang, $langs->trans("WarningNotLangOfInterface", $langs->transnoentitiesnoconv("UserGUISetup")));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("OpenIDURL").'</td>';
|
||||
|
|
@ -2446,6 +2473,15 @@ if ($action == 'create' || $action == 'adduserldap')
|
|||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Default language
|
||||
if (!empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3">'."\n";
|
||||
print $formadmin->select_language($object->lang, 'default_lang', 0, 0, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
|
|
|
|||
|
|
@ -1549,6 +1549,7 @@ class User extends CommonObject
|
|||
$sql .= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null');
|
||||
$sql .= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null');
|
||||
$sql .= ", fk_warehouse = ".($this->fk_warehouse ? "'".$this->db->escape($this->fk_warehouse)."'" : "null");
|
||||
$sql .= ", lang = ".($this->lang ? "'".$this->db->escape($this->lang)."'" : "null");
|
||||
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user