wip: add ref_employee and national_registration_number fields

This commit is contained in:
Steve 2022-03-02 11:20:07 +01:00
parent 5bf186c8ce
commit cb17f2029e
5 changed files with 61 additions and 1 deletions

View File

@ -272,4 +272,7 @@ ALTER TABLE llx_reception MODIFY COLUMN ref_supplier varchar(128);
ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER domiciliation;
-- Set default ticket type to OTHER if no default exists
UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1);
UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1);
ALTER TABLE llx_user ADD COLUMN ref_employee varchar(50) DEFAULT NULL;
ALTER TABLE llx_user ADD COLUMN national_registration_number varchar(50) DEFAULT NULL;

View File

@ -108,5 +108,7 @@ create table llx_user
import_key varchar(14), -- import key
default_range integer,
default_c_exp_tax_cat integer,
employee_number varchar(50),
national_registration_number varchar(50),
fk_warehouse integer -- default warehouse os user
)ENGINE=innodb;

View File

@ -508,6 +508,19 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
print '<td>'.$object->accountancy_code.'</td></tr>';
}
// Employee Number
if (!empty($conf->accounting->enabled)) {
print '<tr><td>'.$langs->trans("ref_employee").'</td>';
print '<td>'.$object->ref_employee.'</td></tr>';
}
// National registration number
if (!empty($conf->accounting->enabled)) {
print '<tr><td>'.$langs->trans("NationalRegistrationNumber").'</td>';
print '<td>'.$object->national_registration_number.'</td></tr>';
}
print '</table>';
print '</div><div class="fichehalfright">';

View File

@ -247,6 +247,8 @@ if (empty($reshook)) {
$object->civility_code = GETPOST("civility_code", 'aZ09');
$object->lastname = GETPOST("lastname", 'alphanohtml');
$object->firstname = GETPOST("firstname", 'alphanohtml');
$object->ref_employee = GETPOST("ref_employee", 'alphanohtml');
$object->national_registration_number = GETPOST("national_registration_number", 'alphanohtml');
$object->login = GETPOST("login", 'alphanohtml');
$object->api_key = GETPOST("api_key", 'alphanohtml');
$object->gender = GETPOST("gender", 'aZ09');
@ -259,6 +261,7 @@ if (empty($reshook)) {
$object->office_phone = GETPOST("office_phone", 'alphanohtml');
$object->office_fax = GETPOST("office_fax", 'alphanohtml');
$object->user_mobile = GETPOST("user_mobile", 'alphanohtml');
$object->ref_employee = GETPOST("ref_employee", 'alphanohtml');
if (!empty($conf->socialnetworks->enabled)) {
$object->socialnetworks = array();
@ -402,6 +405,7 @@ if (empty($reshook)) {
$object->civility_code = GETPOST("civility_code", 'aZ09');
$object->lastname = GETPOST("lastname", 'alphanohtml');
$object->firstname = GETPOST("firstname", 'alphanohtml');
$object->ref_employee = GETPOST("ref_employee", 'alphanohtml');
$object->gender = GETPOST("gender", 'aZ09');
$object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields
$object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key;
@ -845,6 +849,12 @@ if ($action == 'create' || $action == 'adduserldap') {
}
print '</td></tr>';
// Ref remployee
print '<tr><td>'.$langs->trans("ref_employee").'</td>';
print '<td>';
print '<input class="minwidth100 maxwidth150onsmartphone" type="text" name="ref_employee" value="'.dol_escape_htmltag(GETPOST('ref_employee', 'alphanohtml')).'">';
print '</td></tr>';
// Login
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").'</span></td>';
print '<td>';
@ -2089,6 +2099,17 @@ if ($action == 'create' || $action == 'adduserldap') {
}
print '</td></tr>';
// Ref employee
print "<tr>".'<td>'.$langs->trans("ref_employee").'</td>';
print '<td>';
if ($caneditfield && !$object->ldap_sid) {
print '<input class="minwidth100" type="text" class="flat" name="ref_employee" value="'.$object->ref_employee.'">';
} else {
print '<input type="hidden" name="ref_employee" value="'.$object->ref_employee.'">';
print $object->ref_employee;
}
print '</td></tr>';
// Login
print "<tr>".'<td><span class="fieldrequired">'.$langs->trans("Login").'</span></td>';
print '<td>';

View File

@ -339,6 +339,17 @@ class User extends CommonObject
public $dateemploymentend; // Define date of employment end by company
public $default_c_exp_tax_cat;
/**
* @var string ref for employee
*/
public $ref_employee;
/**
* @var string national registration number
*/
public $national_registration_number;
public $default_range;
/**
@ -350,6 +361,8 @@ class User extends CommonObject
'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'lastname'=>array('type'=>'varchar(50)', 'label'=>'LastName', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1),
'firstname'=>array('type'=>'varchar(50)', 'label'=>'FirstName', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
'ref_employee'=>array('type'=>'varchar(50)', 'label'=>'ref_employee', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30, 'searchall'=>1),
'national_registration_number'=>array('type'=>'varchar(50)', 'label'=>'national_registration_number', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>40, 'searchall'=>1)
);
@ -437,6 +450,8 @@ class User extends CommonObject
$sql .= " u.fk_warehouse,";
$sql .= " u.ref_ext,";
$sql .= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode
$sql .= " u.national_registration_number,";
$sql .= " u.ref_employee,";
$sql .= " c.code as country_code, c.label as country,";
$sql .= " d.code_departement as state_code, d.nom as state";
$sql .= " FROM ".$this->db->prefix()."user as u";
@ -488,6 +503,8 @@ class User extends CommonObject
$this->civility_code = $obj->civility_code;
$this->lastname = $obj->lastname;
$this->firstname = $obj->firstname;
$this->ref_employee = $obj->ref_employee;
$this->national_registration_number = $obj->national_registration_number;
$this->employee = $obj->employee;
@ -1755,6 +1772,8 @@ class User extends CommonObject
$this->civility_code = trim($this->civility_code);
$this->lastname = trim($this->lastname);
$this->firstname = trim($this->firstname);
$this->ref_employee = trim($this->ref_employee);
$this->national_registration_number = trim($this->national_registration_number);
$this->employee = $this->employee ? $this->employee : 0;
$this->login = trim($this->login);
$this->gender = trim($this->gender);
@ -1847,6 +1866,8 @@ class User extends CommonObject
$sql .= " civility = '".$this->db->escape($this->civility_code)."'";
$sql .= ", lastname = '".$this->db->escape($this->lastname)."'";
$sql .= ", firstname = '".$this->db->escape($this->firstname)."'";
$sql .= ", ref_employee = '".$this->db->escape($this->ref_employee)."'";
$sql .= ", national_registration_number = '".$this->db->escape($this->national_registration_number)."'";
$sql .= ", employee = ".(int) $this->employee;
$sql .= ", login = '".$this->db->escape($this->login)."'";
$sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null");