forked from Wavyzz/dolibarr
New: HRM #3699 Add address informations in user card
This commit is contained in:
@@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.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.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
|
||||
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
@@ -183,6 +184,11 @@ if (empty($reshook)) {
|
||||
$object->api_key = GETPOST("api_key", 'alpha');
|
||||
$object->gender = GETPOST("gender", 'alpha');
|
||||
$object->admin = GETPOST("admin", 'alpha');
|
||||
$object->address = GETPOST('address', 'alpha');
|
||||
$object->zip = GETPOST('zipcode', 'alpha');
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->office_phone = GETPOST("office_phone", 'alpha');
|
||||
$object->office_fax = GETPOST("office_fax", 'alpha');
|
||||
$object->user_mobile = GETPOST("user_mobile");
|
||||
@@ -315,7 +321,12 @@ if (empty($reshook)) {
|
||||
$object->pass = GETPOST("password");
|
||||
$object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key;
|
||||
$object->admin = empty($user->admin) ? 0 : GETPOST("admin"); // A user can only be set admin by an admin
|
||||
$object->office_phone = GETPOST("office_phone", 'alpha');
|
||||
$object->address = GETPOST('address', 'alpha');
|
||||
$object->zip = GETPOST('zipcode', 'alpha');
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
$object->office_phone = GETPOST("office_phone", 'alpha');
|
||||
$object->office_fax = GETPOST("office_fax", 'alpha');
|
||||
$object->user_mobile = GETPOST("user_mobile");
|
||||
$object->skype = GETPOST("skype");
|
||||
@@ -578,6 +589,7 @@ if (empty($reshook)) {
|
||||
|
||||
$form = new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
|
||||
llxHeader('',$langs->trans("UserCard"));
|
||||
|
||||
@@ -865,6 +877,37 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
||||
print $form->textwithpicto($langs->trans("Internal"),$langs->trans("InternalExternalDesc"), 1, 'help', '', 0, 2);
|
||||
print '</td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr><td class="tdtop">'.fieldLabel('Address','address').'</td>';
|
||||
print '<td><textarea name="address" id="address" cols="80" rows="3" wrap="soft">';
|
||||
print $object->address;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
// Zip
|
||||
print '<tr><td>'.fieldLabel('Zip','zipcode').'</td><td>';
|
||||
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6);
|
||||
print '</td></tr>';
|
||||
|
||||
// Town
|
||||
print '<tr><td>'.fieldLabel('Town','town').'</td><td>';
|
||||
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.fieldLabel('Country','selectcountry_id').'</td><td class="maxwidthonsmartphone">';
|
||||
print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id));
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// State
|
||||
if (empty($conf->global->USER_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td>'.fieldLabel('State','state_id').'</td><td class="maxwidthonsmartphone">';
|
||||
if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code);
|
||||
else print $countrynotdefined;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Tel
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td>';
|
||||
print '<td>';
|
||||
@@ -1919,6 +1962,36 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr><td class="tdtop">'.fieldLabel('Address','address').'</td>';
|
||||
print '<td><textarea name="address" id="address" cols="80" rows="3" wrap="soft">';
|
||||
print $object->address;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
// Zip
|
||||
print '<tr><td>'.fieldLabel('Zip','zipcode').'</td><td>';
|
||||
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
|
||||
print '</td></tr>';
|
||||
|
||||
// Town
|
||||
print '<tr><td>'.fieldLabel('Town','town').'</td><td>';
|
||||
print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.fieldLabel('Country','selectcounty_id').'</td><td>';
|
||||
print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id),'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// State
|
||||
if (empty($conf->global->USER_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td>'.fieldLabel('State','state_id').'</td><td colspan="3">';
|
||||
print $formcompany->select_state($object->state_id,$object->country_code);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Tel pro
|
||||
print "<tr>".'<td>'.$langs->trans("PhonePro").'</td>';
|
||||
print '<td>';
|
||||
|
||||
@@ -52,6 +52,12 @@ class User extends CommonObject
|
||||
var $skype;
|
||||
var $job;
|
||||
var $signature;
|
||||
var $address;
|
||||
var $zip;
|
||||
var $town;
|
||||
var $state_id;
|
||||
var $state_code;
|
||||
var $state;
|
||||
var $office_phone;
|
||||
var $office_fax;
|
||||
var $user_mobile;
|
||||
@@ -156,13 +162,14 @@ class User extends CommonObject
|
||||
*/
|
||||
function fetch($id='', $login='',$sid='',$loadpersonalconf=1, $entity=-1)
|
||||
{
|
||||
global $conf, $user;
|
||||
global $langs, $conf, $user;
|
||||
|
||||
// Clean parameters
|
||||
$login=trim($login);
|
||||
|
||||
// Get user
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.email, u.job, u.skype, u.signature, u.office_phone, u.office_fax, u.user_mobile,";
|
||||
$sql.= " u.address, u.zip, u.town, u.fk_state, u.fk_country as country_id,";
|
||||
$sql.= " u.admin, u.login, u.note,";
|
||||
$sql.= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,";
|
||||
$sql.= " u.fk_soc, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid,";
|
||||
@@ -180,8 +187,12 @@ class User extends CommonObject
|
||||
$sql.= " u.salaryextra,";
|
||||
$sql.= " u.weeklyhours,";
|
||||
$sql.= " u.color,";
|
||||
$sql.= " u.ref_int, u.ref_ext";
|
||||
$sql.= " u.ref_int, u.ref_ext,";
|
||||
$sql.= " c.code as country_code, c.label as country,";
|
||||
$sql.= " d.code_departement as state_code, d.nom as state";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid";
|
||||
|
||||
if ($entity < 0)
|
||||
{
|
||||
@@ -238,6 +249,19 @@ class User extends CommonObject
|
||||
$this->pass = $obj->pass;
|
||||
$this->pass_temp = $obj->pass_temp;
|
||||
$this->api_key = $obj->api_key;
|
||||
|
||||
$this->address = $obj->address;
|
||||
$this->zip = $obj->zip;
|
||||
$this->town = $obj->town;
|
||||
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_id?$obj->country_code:'';
|
||||
$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):'';
|
||||
|
||||
$this->state_id = $obj->fk_departement;
|
||||
$this->state_code = $obj->state_code;
|
||||
$this->state = ($obj->state!='-'?$obj->state:'');
|
||||
|
||||
$this->office_phone = $obj->office_phone;
|
||||
$this->office_fax = $obj->office_fax;
|
||||
$this->user_mobile = $obj->user_mobile;
|
||||
@@ -960,7 +984,7 @@ class User extends CommonObject
|
||||
|
||||
$error=0;
|
||||
|
||||
// Positionne parametres
|
||||
// Define parameters
|
||||
$this->admin = 0;
|
||||
$this->lastname = $contact->lastname;
|
||||
$this->firstname = $contact->firstname;
|
||||
@@ -1165,6 +1189,11 @@ class User extends CommonObject
|
||||
$this->gender = trim($this->gender);
|
||||
$this->pass = trim($this->pass);
|
||||
$this->api_key = trim($this->api_key);
|
||||
$this->address = $this->address?trim($this->address):trim($this->address);
|
||||
$this->zip = $this->zip?trim($this->zip):trim($this->zip);
|
||||
$this->town = $this->town?trim($this->town):trim($this->town);
|
||||
$this->state_id = trim($this->state_id);
|
||||
$this->country_id = ($this->country_id > 0)?$this->country_id:0;
|
||||
$this->office_phone = trim($this->office_phone);
|
||||
$this->office_fax = trim($this->office_fax);
|
||||
$this->user_mobile = trim($this->user_mobile);
|
||||
|
||||
Reference in New Issue
Block a user