|
|
|
@ -68,7 +68,7 @@ $pagenext = $page + 1;
|
|
|
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
|
|
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
|
|
|
$object = new User($db);
|
|
|
|
$object = new User($db);
|
|
|
|
$extrafields = new ExtraFields($db);
|
|
|
|
$extrafields = new ExtraFields($db);
|
|
|
|
$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
|
|
|
|
$diroutputmassaction = $conf->user->dir_output.'/temp/massgeneration/'.$user->id;
|
|
|
|
$hookmanager->initHooks(array('userlist'));
|
|
|
|
$hookmanager->initHooks(array('userlist'));
|
|
|
|
|
|
|
|
|
|
|
|
// Fetch optionals attributes and labels
|
|
|
|
// Fetch optionals attributes and labels
|
|
|
|
@ -124,9 +124,9 @@ $arrayfields = array(
|
|
|
|
'u.office_phone'=>array('label'=>"PhonePro", 'checked'=>1, 'position'=>31),
|
|
|
|
'u.office_phone'=>array('label'=>"PhonePro", 'checked'=>1, 'position'=>31),
|
|
|
|
'u.user_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1, 'position'=>32),
|
|
|
|
'u.user_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1, 'position'=>32),
|
|
|
|
'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35),
|
|
|
|
'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35),
|
|
|
|
'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>($conf->api->enabled && $user->admin)),
|
|
|
|
'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>(!empty($conf->api->enabled) && $user->admin)),
|
|
|
|
'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45),
|
|
|
|
'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45),
|
|
|
|
'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>($conf->salaries->enabled && !empty($user->rights->salaries->readall))),
|
|
|
|
'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>(!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))),
|
|
|
|
'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100),
|
|
|
|
'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100),
|
|
|
|
'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110),
|
|
|
|
'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110),
|
|
|
|
'u.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
|
|
|
'u.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
|
|
|
@ -345,7 +345,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
|
|
|
|
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
|
|
|
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
|
|
|
$sql = preg_replace('/,\s*$/', '', $sql);
|
|
|
|
$sql = preg_replace('/,\s*$/', '', $sql);
|
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
|
|
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
|
|
|
if (key_exists('label', $extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (u.rowid = ef.fk_object)";
|
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (u.rowid = ef.fk_object)";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
|
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
|
|
|
|
@ -571,13 +571,13 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|
|
|
|
|
|
|
|
|
|
|
$url = DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu=';
|
|
|
|
$url = DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu=';
|
|
|
|
if (!empty($socid)) {
|
|
|
|
if (!empty($socid)) {
|
|
|
|
$url .= '&socid='.$socid;
|
|
|
|
$url .= '&socid='.urlencode($socid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$newcardbutton = dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
|
|
|
|
$newcardbutton = dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
|
|
|
|
|
|
|
|
|
|
|
|
$moreparam = array('morecss'=>'btnTitleSelected');
|
|
|
|
$moreparam = array('morecss'=>'btnTitleSelected');
|
|
|
|
$morehtmlright .= dolGetButtonTitle($langs->trans("List"), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam);
|
|
|
|
$morehtmlright = dolGetButtonTitle($langs->trans("List"), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam);
|
|
|
|
$moreparam = array('morecss'=>'marginleftonly');
|
|
|
|
$moreparam = array('morecss'=>'marginleftonly');
|
|
|
|
$morehtmlright .= dolGetButtonTitle($langs->trans("HierarchicView"), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam);
|
|
|
|
$morehtmlright .= dolGetButtonTitle($langs->trans("HierarchicView"), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam);
|
|
|
|
|
|
|
|
|
|
|
|
@ -808,7 +808,7 @@ print '</tr>'."\n";
|
|
|
|
|
|
|
|
|
|
|
|
// Detect if we need a fetch on each output line
|
|
|
|
// Detect if we need a fetch on each output line
|
|
|
|
$needToFetchEachLine = 0;
|
|
|
|
$needToFetchEachLine = 0;
|
|
|
|
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
|
|
|
if (key_exists('computed', $extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
|
|
|
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
|
|
|
|
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
|
|
|
|
if (preg_match('/\$object/', $val)) {
|
|
|
|
if (preg_match('/\$object/', $val)) {
|
|
|
|
$needToFetchEachLine++; // There is at least one compute field that use $object
|
|
|
|
$needToFetchEachLine++; // There is at least one compute field that use $object
|
|
|
|
@ -821,6 +821,7 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
$i = 0;
|
|
|
|
$i = 0;
|
|
|
|
$totalarray = array();
|
|
|
|
$totalarray = array();
|
|
|
|
|
|
|
|
$totalarray['nbfield'] = 0;
|
|
|
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
|
|
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
|
|
|
while ($i < ($limit ? min($num, $limit) : $num)) {
|
|
|
|
while ($i < ($limit ? min($num, $limit) : $num)) {
|
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
@ -828,12 +829,14 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|
|
|
break; // Should not happen
|
|
|
|
break; // Should not happen
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($obj->country_code)) $obj->country_code = ''; // TODO Add join in select with country table to get country_code
|
|
|
|
|
|
|
|
|
|
|
|
// Store properties in $object
|
|
|
|
// Store properties in $object
|
|
|
|
$object->setVarsFromFetchObj($obj);
|
|
|
|
$object->setVarsFromFetchObj($obj);
|
|
|
|
|
|
|
|
|
|
|
|
$userstatic->id = $obj->rowid;
|
|
|
|
$userstatic->id = $obj->rowid;
|
|
|
|
$userstatic->admin = $obj->admin;
|
|
|
|
$userstatic->admin = $obj->admin;
|
|
|
|
$userstatic->ref = $obj->label;
|
|
|
|
$userstatic->ref = $obj->rowid;
|
|
|
|
$userstatic->login = $obj->login;
|
|
|
|
$userstatic->login = $obj->login;
|
|
|
|
$userstatic->statut = $obj->statut;
|
|
|
|
$userstatic->statut = $obj->statut;
|
|
|
|
$userstatic->office_phone = $obj->office_phone;
|
|
|
|
$userstatic->office_phone = $obj->office_phone;
|
|
|
|
@ -928,6 +931,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|
|
|
$totalarray['nbfield']++;
|
|
|
|
$totalarray['nbfield']++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($arrayfields['u.office_phone']['checked'])) {
|
|
|
|
if (!empty($arrayfields['u.office_phone']['checked'])) {
|
|
|
|
print "<td>".dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n";
|
|
|
|
print "<td>".dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n";
|
|
|
|
if (!$i) {
|
|
|
|
if (!$i) {
|
|
|
|
@ -941,7 +945,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!empty($arrayfields['u.email']['checked'])) {
|
|
|
|
if (!empty($arrayfields['u.email']['checked'])) {
|
|
|
|
print '<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 0, 0, 1)."</td>\n";
|
|
|
|
print '<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->fk_soc, 'AC_EMAIL', 0, 0, 1)."</td>\n";
|
|
|
|
if (!$i) {
|
|
|
|
if (!$i) {
|
|
|
|
$totalarray['nbfield']++;
|
|
|
|
$totalarray['nbfield']++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|