diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d38cdc69104..ab3a6dc45a8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3186,9 +3186,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ // We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto $url = DOL_URL_ROOT; - $theme = $conf->theme; + $theme = isset($conf->theme) ? $conf->theme : null; $path = 'theme/'.$theme; - // Define fullpathpicto to use into src if ($pictoisfullpath) { // Clean parameters diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3c10988a2cf..4a22b211c5f 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -204,6 +204,7 @@ if (empty($reshook)) { } if (!$error) { + $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); $object->login = GETPOST("login", 'alphanohtml'); @@ -366,6 +367,7 @@ if (empty($reshook)) { $db->begin(); + $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); $object->login = GETPOST("login", 'alphanohtml'); @@ -791,6 +793,11 @@ if ($action == 'create' || $action == 'adduserldap') print '
| '; + print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'aZ09') : $object->civility_code, 'civility_code'); + print ' | |||
| '.$langs->trans("Lastname").' | '; @@ -2037,6 +2044,11 @@ if ($action == 'create' || $action == 'adduserldap') print '|||
| '; + print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'aZ09') : $object->civility_code, 'civility_code'); + print ' | |||
| '.$langs->trans("Lastname").' | '; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 36b50d82055..eb92bd51eb9 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -74,6 +74,7 @@ class User extends CommonObject public $ldap_sid; public $search_sid; public $employee; + public $civility_code; /** * @var string gender @@ -400,7 +401,7 @@ class User extends CommonObject $login = trim($login); // Get user - $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.personal_email, u.job,"; + $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.civility as civility_code, u.birth, u.email, u.personal_email, u.job,"; $sql .= " u.socialnetworks,"; $sql .= " u.signature, u.office_phone, u.office_fax, u.user_mobile, u.personal_mobile,"; $sql .= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,"; @@ -470,6 +471,7 @@ class User extends CommonObject $this->ref_ext = $obj->ref_ext; $this->ldap_sid = $obj->ldap_sid; + $this->civility_code = $obj->civility_code; $this->lastname = $obj->lastname; $this->firstname = $obj->firstname; @@ -1293,6 +1295,8 @@ class User extends CommonObject // Clean parameters $this->setUpperOrLowerCase(); + + $this->civility_code = trim($this->civility_code); $this->login = trim($this->login); if (!isset($this->entity)) { $this->entity = $conf->entity; // If not defined, we use default value @@ -1419,6 +1423,7 @@ class User extends CommonObject // Define parameters $this->admin = 0; + $this->civility_code = $contact->civility_code; $this->lastname = $contact->lastname; $this->firstname = $contact->firstname; $this->gender = $contact->gender; @@ -1447,6 +1452,7 @@ class User extends CommonObject if ($result > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql .= " SET fk_socpeople=".$contact->id; + $sql .= ", civility=".$contact->civility_code; if ($contact->socid) { $sql .= ", fk_soc=".$contact->socid; } @@ -1497,6 +1503,7 @@ class User extends CommonObject // Set properties on new user $this->admin = 0; + $this->civility_code = $member->civility_id; $this->lastname = $member->lastname; $this->firstname = $member->firstname; $this->gender = $member->gender; @@ -1632,6 +1639,7 @@ class User extends CommonObject dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncmember=".$nosyncmember.", nosyncmemberpass=".$nosyncmemberpass); // Clean parameters + $this->civility_code = trim($this->civility_code); $this->lastname = trim($this->lastname); $this->firstname = trim($this->firstname); $this->employee = $this->employee ? $this->employee : 0; @@ -1686,7 +1694,8 @@ class User extends CommonObject // Update datas $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; - $sql .= " lastname = '".$this->db->escape($this->lastname)."'"; + $sql .= " civility = '".$this->db->escape($this->civility_code)."'"; + $sql .= ", lastname = '".$this->db->escape($this->lastname)."'"; $sql .= ", firstname = '".$this->db->escape($this->firstname)."'"; $sql .= ", employee = ".(int) $this->employee; $sql .= ", login = '".$this->db->escape($this->login)."'"; @@ -1788,6 +1797,7 @@ class User extends CommonObject $result = $adh->fetch($this->fk_member); if ($result > 0) { + $adh->civility_code = $this->civility_code; $adh->firstname = $this->firstname; $adh->lastname = $this->lastname; $adh->login = $this->login; @@ -1838,6 +1848,7 @@ class User extends CommonObject $result = $tmpobj->fetch($this->contact_id); if ($result >= 0) { + $tmpobj->civility_code = $this->civility_code; $tmpobj->firstname = $this->firstname; $tmpobj->lastname = $this->lastname; $tmpobj->login = $this->login; diff --git a/htdocs/user/vcard.php b/htdocs/user/vcard.php index ada3a992f44..6cdcd04417f 100644 --- a/htdocs/user/vcard.php +++ b/htdocs/user/vcard.php @@ -61,7 +61,7 @@ $v = new vCard(); $v->setProdId('Dolibarr '.DOL_VERSION); $v->setUid('DOLIBARR-USERID-'.$user2->id); -$v->setName($user2->lastname, $user2->firstname, "", $user2->civility, ""); +$v->setName($user2->lastname, $user2->firstname, "", $user2->civility_code, ""); $v->setFormattedName($user2->getFullName($langs, 1)); $v->setPhoneNumber($user2->phone_pro, "TYPE=WORK;VOICE");|||