New #8472 personal and professional titles added

personal and professional titles added for employee users
This commit is contained in:
Zebedeu 2020-12-05 11:30:18 +01:00
parent 0536ed87a2
commit 6d2159e8f0
2 changed files with 25 additions and 2 deletions

View File

@ -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');
@ -789,6 +791,11 @@ if ($action == 'create' || $action == 'adduserldap')
print '<table class="border centpercent">';
// Civility
print '<tr><td><label for="civility_code">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'aZ09') : $object->civility_code, 'civility_code');
print '</td></tr>';
// Lastname
print '<tr>';
print '<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Lastname").'</span></td>';
@ -2037,6 +2044,11 @@ if ($action == 'create' || $action == 'adduserldap')
print '</tr>';
}
// Civility
print '<tr><td><label for="civility_code">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
print $formcompany->select_civility( GETPOSTISSET( "civility_code" ) ? GETPOST( "civility_code" , 'aZ09' ) : $object->civility_code , 'civility_code' );
print '</td></tr>';
// Lastname
print "<tr>";
print '<td class="titlefield fieldrequired">'.$langs->trans("Lastname").'</td>';

View File

@ -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;