From e41910b1467bec10038f034dabcbb202e52e59f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 9 Nov 2025 04:19:18 +0100 Subject: [PATCH] NEW add hourly rate in list of users --- htdocs/user/list.php | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index a9abb53fafa..8e291e0b689 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -31,11 +31,6 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -if (isModEnabled('category')) { - require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -} - /** * @var Conf $conf * @var DoliDB $db @@ -43,6 +38,10 @@ if (isModEnabled('category')) { * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +if (isModEnabled('category')) { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +} // Load translation files required by page $langs->loadLangs(array('users', 'companies', 'hrm', 'salaries')); @@ -153,6 +152,7 @@ $arrayfields = array( 'u.national_registration_number' => array('label' => "NationalRegistrationNumber", 'checked' => '-1', 'position' => 51, 'enabled' => (string) (int) (isModEnabled('hrm') && $permissiontoreadhr)), 'u.job' => array('label' => "PostOrFunction", 'checked' => '-1', 'position' => 60), 'u.salary' => array('label' => "Salary", 'checked' => '-1', 'position' => 80, 'enabled' => (string) (int) (isModEnabled('salaries') && $user->hasRight("salaries", "readall")), 'isameasure' => 1), + 'u.thm' => array('label' => "THM", 'langs' => 'salaries', 'checked' => '-1', 'position' => 82, 'enabled' => '1', 'isameasure' => 1), 'u.datec' => array('label' => "DateCreation", 'checked' => '0', 'position' => 500), 'date_modification' => array('label' => "DateModificationShort", 'checked' => '0', 'position' => 500), 'u.statut' => array('label' => "Status", 'checked' => '1', 'position' => 1000), @@ -389,7 +389,7 @@ $morehtmlright = ""; // -------------------------------------------------------------------- $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.office_phone, u.user_mobile, u.email, u.api_key, u.accountancy_code, u.gender, u.employee, u.photo,"; $sql .= " u.fk_user,"; -$sql .= " u.ref_employee, u.national_registration_number, u.job, u.salary, u.datelastlogin, u.datepreviouslogin,"; +$sql .= " u.ref_employee, u.national_registration_number, u.job, u.salary, u.thm, u.datelastlogin, u.datepreviouslogin,"; $sql .= " u.datestartvalidity, u.dateendvalidity,"; $sql .= " u.ldap_sid, u.statut as status, u.entity,"; $sql .= " GREATEST(u.tms, ef.tms) as date_modification, u.datec as date_creation,"; @@ -844,6 +844,9 @@ if (!empty($arrayfields['u.job']['checked'])) { if (!empty($arrayfields['u.salary']['checked'])) { print ''; } +if (!empty($arrayfields['u.thm']['checked'])) { + print ''; +} if (!empty($arrayfields['u.datelastlogin']['checked']) && getDolGlobalInt('MAIN_ENABLE_LOGINS_PRIVACY') == 0) { print ''; } @@ -968,6 +971,10 @@ if (!empty($arrayfields['u.salary']['checked'])) { print_liste_field_titre("Salary", $_SERVER['PHP_SELF'], "u.salary", $param, "", "", $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } +if (!empty($arrayfields['u.thm']['checked'])) { + print_liste_field_titre("THM", $_SERVER['PHP_SELF'], "u.thm", $param, "", "", $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} if (!empty($arrayfields['u.datelastlogin']['checked']) && getDolGlobalInt('MAIN_ENABLE_LOGINS_PRIVACY') == 0) { print_liste_field_titre("LastConnexion", $_SERVER['PHP_SELF'], "u.datelastlogin", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; @@ -1343,6 +1350,18 @@ while ($i < $imaxinloop) { $totalarray['val']['u.salary'] += $obj->salary; } + // Hourly rate + if (!empty($arrayfields['u.thm']['checked'])) { + print ''; + if (!is_null($obj->thm)) { + print price($obj->thm); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date last login if (!empty($arrayfields['u.datelastlogin']['checked']) && getDolGlobalInt('MAIN_ENABLE_LOGINS_PRIVACY') == 0) { print ''.dol_print_date($db->jdate($obj->datelastlogin), "dayhour").'';