Debug v13
This commit is contained in:
parent
a2ede3573e
commit
9137713056
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
@ -265,7 +265,7 @@ if ($action == 'create')
|
||||
// Date payment
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
print $form->selectDate((empty($datep) ?-1 : $datep), "datep", '', '', '', 'add', 1, 1);
|
||||
print $form->selectDate((empty($datep) ? '' : $datep), "datep", 0, 0, 0, 'add', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date value for bank
|
||||
@ -305,16 +305,6 @@ if ($action == 'create')
|
||||
print '<input name="amount" id="amount" class="minwidth100" value="'.GETPOST("amount").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Bank
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
@ -340,6 +330,16 @@ if ($action == 'create')
|
||||
print '<td><input name="num_payment" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||
}
|
||||
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
@ -476,9 +476,8 @@ if ($id)
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* Action buttons
|
||||
*/
|
||||
// Action buttons
|
||||
|
||||
print '<div class="tabsAction">'."\n";
|
||||
if ($object->rappro == 0)
|
||||
{
|
||||
|
||||
@ -113,17 +113,17 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.rowid = s.fk_user";
|
||||
$sql .= " AND s.entity = ".$conf->entity;
|
||||
$sql .= " AND s.entity IN (".getEntity('payment_salaries').")";
|
||||
if (empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")";
|
||||
|
||||
// Search criteria
|
||||
if ($search_ref) $sql .= " AND s.rowid=".$search_ref;
|
||||
if ($search_ref) $sql .= " AND s.rowid=".((int) $search_ref);
|
||||
if ($search_user) $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
|
||||
if ($search_label) $sql .= natural_search(array('s.label'), $search_label);
|
||||
if ($search_date_start) $sql .= " AND s.datep >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND s.datep <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_amount) $sql .= natural_search("s.amount", $search_amount, 1);
|
||||
if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account;
|
||||
if ($search_account > 0) $sql .= " AND b.fk_account=".((int) $search_account);
|
||||
if ($filtre) {
|
||||
$filtre = str_replace(":", "=", $filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
|
||||
@ -342,8 +342,8 @@ class User extends CommonObject
|
||||
|
||||
public $fields = array(
|
||||
'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1),
|
||||
'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -109,45 +109,32 @@ if (!empty($conf->api->enabled))
|
||||
|
||||
// Definition of fields for list
|
||||
$arrayfields = array(
|
||||
'u.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
|
||||
'u.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'u.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'u.gender'=>array('label'=>$langs->trans("Gender"), 'checked'=>0),
|
||||
'u.employee'=>array('label'=>$langs->trans("Employee"), 'checked'=>($mode == 'employee' ? 1 : 0)),
|
||||
'u.accountancy_code'=>array('label'=>$langs->trans("AccountancyCode"), 'checked'=>0),
|
||||
'u.email'=>array('label'=>$langs->trans("EMail"), 'checked'=>1),
|
||||
'u.api_key'=>array('label'=>$langs->trans("ApiKey"), 'checked'=>0, "enabled"=>($conf->api->enabled && $user->admin)),
|
||||
'u.fk_soc'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
|
||||
'u.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))),
|
||||
'u.fk_user'=>array('label'=>$langs->trans("HierarchicalResponsible"), 'checked'=>1),
|
||||
'u.datelastlogin'=>array('label'=>$langs->trans("LastConnexion"), 'checked'=>1, 'position'=>100),
|
||||
'u.datepreviouslogin'=>array('label'=>$langs->trans("PreviousConnexion"), 'checked'=>0, 'position'=>110),
|
||||
'u.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'u.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'u.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
'u.login'=>array('label'=>"Login", 'checked'=>1, 'position'=>10),
|
||||
'u.lastname'=>array('label'=>"Lastname", 'checked'=>1, 'position'=>15),
|
||||
'u.firstname'=>array('label'=>"Firstname", 'checked'=>1, 'position'=>20),
|
||||
'u.entity'=>array('label'=>"Entity", 'checked'=>1, 'position'=>50, 'enabled'=>(!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))),
|
||||
'u.gender'=>array('label'=>"Gender", 'checked'=>0, 'position'=>22),
|
||||
'u.employee'=>array('label'=>"Employee", 'checked'=>($mode == 'employee' ? 1 : 0), 'position'=>25),
|
||||
'u.fk_user'=>array('label'=>"HierarchicalResponsible", 'checked'=>1, 'position'=>27),
|
||||
'u.accountancy_code'=>array('label'=>"AccountancyCode", 'checked'=>0, 'position'=>30),
|
||||
'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.fk_soc'=>array('label'=>"Company", 'checked'=>1, 'position'=>45),
|
||||
'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>($conf->salaries->enabled && !empty($user->rights->salaries->readall))),
|
||||
'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100),
|
||||
'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110),
|
||||
'u.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'u.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'u.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
{
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
$arrayfields["ef.".$key] = array(
|
||||
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
|
||||
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
|
||||
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
|
||||
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]),
|
||||
'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key],
|
||||
'help'=>$extrafields->attributes[$object->table_element]['help'][$key]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
// Init search fields
|
||||
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$search_user = GETPOST('search_user', 'alpha');
|
||||
$search_login = GETPOST('search_login', 'alpha');
|
||||
$search_lastname = GETPOST('search_lastname', 'alpha');
|
||||
@ -183,6 +170,8 @@ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||
|
||||
$error = 0;
|
||||
|
||||
$childids = $user->getAllChildIds(1);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -308,7 +297,7 @@ if ($contextpage == 'employeelist' && $search_employee == 1) {
|
||||
$user2 = new User($db);
|
||||
|
||||
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.api_key, u.accountancy_code, u.gender, u.employee, u.photo,";
|
||||
$sql .= " u.datelastlogin, u.datepreviouslogin,";
|
||||
$sql .= " u.salary, u.datelastlogin, u.datepreviouslogin,";
|
||||
$sql .= " u.ldap_sid, u.statut, u.entity,";
|
||||
$sql .= " u.tms as date_update, u.datec as date_creation,";
|
||||
$sql .= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2, u2.statut as statut2,";
|
||||
@ -356,6 +345,7 @@ if ($catid > 0) $sql .= " AND cu.fk_categorie = ".((int) $catid);
|
||||
if ($catid == -2) $sql .= " AND cu.fk_categorie IS NULL";
|
||||
if ($search_categ > 0) $sql .= " AND cu.fk_categorie = ".$db->escape($search_categ);
|
||||
if ($search_categ == -2) $sql .= " AND cu.fk_categorie IS NULL";
|
||||
if ($mode == 'employee' && empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")";
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
@ -541,6 +531,13 @@ if (!empty($arrayfields['u.employee']['checked']))
|
||||
print $form->selectyesno('search_employee', $search_employee, 1, false, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Supervisor
|
||||
if (!empty($arrayfields['u.fk_user']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_dolusers($search_supervisor, 'search_supervisor', 1, array(), 0, '', 0, 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['u.accountancy_code']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"><input type="text" name="search_accountancy_code" class="maxwidth50" value="'.$search_accountancy_code.'"></td>';
|
||||
@ -561,12 +558,9 @@ if (!empty($arrayfields['u.entity']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
// Supervisor
|
||||
if (!empty($arrayfields['u.fk_user']['checked']))
|
||||
if (!empty($arrayfields['u.salary']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_dolusers($search_supervisor, 'search_supervisor', 1, array(), 0, '', 0, 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['u.datelastlogin']['checked']))
|
||||
{
|
||||
@ -615,12 +609,13 @@ if (!empty($arrayfields['u.lastname']['checked'])) print_liste_field_titre
|
||||
if (!empty($arrayfields['u.firstname']['checked'])) print_liste_field_titre("FirstName", $_SERVER['PHP_SELF'], "u.firstname", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.gender']['checked'])) print_liste_field_titre("Gender", $_SERVER['PHP_SELF'], "u.gender", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.employee']['checked'])) print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.employee", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.fk_user']['checked'])) print_liste_field_titre("HierarchicalResponsible", $_SERVER['PHP_SELF'], "u.fk_user", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.accountancy_code']['checked'])) print_liste_field_titre("AccountancyCode", $_SERVER['PHP_SELF'], "u.accountancy_code", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.email']['checked'])) print_liste_field_titre("EMail", $_SERVER['PHP_SELF'], "u.email", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.api_key']['checked'])) print_liste_field_titre("ApiKey", $_SERVER['PHP_SELF'], "u.api_key", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.fk_soc']['checked'])) print_liste_field_titre("Company", $_SERVER['PHP_SELF'], "u.fk_soc", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.entity']['checked'])) print_liste_field_titre("Entity", $_SERVER['PHP_SELF'], "u.entity", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.fk_user']['checked'])) print_liste_field_titre("HierarchicalResponsible", $_SERVER['PHP_SELF'], "u.fk_user", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.salary']['checked'])) print_liste_field_titre("Salary", $_SERVER['PHP_SELF'], "u.salary", $param, "", "", $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['u.datelastlogin']['checked'])) print_liste_field_titre("LastConnexion", $_SERVER['PHP_SELF'], "u.datelastlogin", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_titre("PreviousConnexion", $_SERVER['PHP_SELF'], "u.datepreviouslogin", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||
// Extra fields
|
||||
@ -713,6 +708,37 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
print '<td>'.yn($obj->employee).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Supervisor
|
||||
if (!empty($arrayfields['u.fk_user']['checked']))
|
||||
{
|
||||
// Resp
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->login2)
|
||||
{
|
||||
$user2->id = $obj->id2;
|
||||
$user2->login = $obj->login2;
|
||||
$user2->lastname = $obj->lastname2;
|
||||
$user2->firstname = $obj->firstname2;
|
||||
$user2->gender = $obj->gender2;
|
||||
$user2->photo = $obj->photo2;
|
||||
$user2->admin = $obj->admin2;
|
||||
$user2->email = $obj->email2;
|
||||
$user2->socid = $obj->fk_soc2;
|
||||
$user2->statut = $obj->statut2;
|
||||
print $user2->getNomUrl(-1, '', 0, 0, 24, 0, '', '', 1);
|
||||
if (!empty($conf->multicompany->enabled) && $obj->admin2 && !$obj->entity2)
|
||||
{
|
||||
print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"');
|
||||
} elseif ($obj->admin2)
|
||||
{
|
||||
print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"');
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['u.accountancy_code']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->accountancy_code.'</td>';
|
||||
@ -763,34 +789,12 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Supervisor
|
||||
if (!empty($arrayfields['u.fk_user']['checked']))
|
||||
|
||||
// Salary
|
||||
if (!empty($arrayfields['u.salary']['checked']))
|
||||
{
|
||||
// Resp
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->login2)
|
||||
{
|
||||
$user2->id = $obj->id2;
|
||||
$user2->login = $obj->login2;
|
||||
$user2->lastname = $obj->lastname2;
|
||||
$user2->firstname = $obj->firstname2;
|
||||
$user2->gender = $obj->gender2;
|
||||
$user2->photo = $obj->photo2;
|
||||
$user2->admin = $obj->admin2;
|
||||
$user2->email = $obj->email2;
|
||||
$user2->socid = $obj->fk_soc2;
|
||||
$user2->statut = $obj->statut2;
|
||||
print $user2->getNomUrl(-1, '', 0, 0, 24, 0, '', '', 1);
|
||||
if (!empty($conf->multicompany->enabled) && $obj->admin2 && !$obj->entity2)
|
||||
{
|
||||
print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"');
|
||||
} elseif ($obj->admin2)
|
||||
{
|
||||
print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"');
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
print '<td class="nowraponall right">'.($obj->salary ? price($obj->salary) : '').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date last login
|
||||
|
||||
Loading…
Reference in New Issue
Block a user