From acbf09ba596f8aac68c2ed204c65252e7e0618fc Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 30 Sep 2021 08:44:38 +0200 Subject: [PATCH] FIX : stickler feedbacks part 3 --- htdocs/hrm/class/skillrank.class.php | 2 +- htdocs/hrm/compare.php | 114 ++++++--------------------- 2 files changed, 24 insertions(+), 92 deletions(-) diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 2f0e2b5d0dd..e6f63bb7d68 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -361,7 +361,7 @@ class SkillRank extends CommonObject * Clone skillrank Object linked to job with user id * The skillrank table is a join table that is marked for multiple objects * - * @param SkillRank $currentSkill + * @param SkillRank $currentSkill line of evaluation (skill) we need to clone and add to user skills list * @param int $fk_user id of user linked to skillrank * @return int > 0 if ok, < 0 if ko */ diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index 83fc3a76ec6..d89534fa2cc 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -133,7 +133,18 @@ $fk_usergroup1 = GETPOST('fk_usergroup1'); trans('or'); ?> - trans('OrJobToCompare') . '' . select_jobs($fk_job, 'fk_job', 1); ?> + trans('OrJobToCompare') . ''; + $j = new Job($db); + $jobs = $j->fetchAll(); + $TJobs = array(); + + foreach ($jobs as &$j) { + $TJobs[$j->id] = $j->label; + } + + print $form->selectarray('fk_job', $TJobs, $fk_job, 1); + ?> @@ -253,7 +264,7 @@ llxFooter(); * * Return a html list element with diff between required rank and user rank * - * @param $TMergedSkills + * @param array $TMergedSkills skill list with all rate to add good picto * @return string */ function diff(&$TMergedSkills) @@ -282,8 +293,8 @@ function diff(&$TMergedSkills) /** * Return a html list with rank informations - * @param $TMergedSkills - * @param $field + * @param array $TMergedSkills skill list for display + * @param string $field which column of comparison we are working with * @return string */ function rate(&$TMergedSkills, $field) @@ -319,7 +330,7 @@ function rate(&$TMergedSkills, $field) /** * return a html ul list of skills * - * @param $TMergedSkills + * @param array $TMergedSkills skill list for display * @return string (ul list in html ) */ function skillList(&$TMergedSkills) @@ -342,8 +353,8 @@ function skillList(&$TMergedSkills) /** * create an array of lines [ skillLabel,dscription, maxrank on group1 , minrank needed for this skill ] * - * @param $TSkill1 - * @param $TSkill2 + * @param array $TSkill1 skill list of first column + * @param array $TSkill2 skill list of second column * @return array */ function mergeSkills($TSkill1, $TSkill2) @@ -373,9 +384,9 @@ function mergeSkills($TSkill1, $TSkill2) /** * Display a list of User with picto - * @param $TUser - * @param int $fk_usergroup - * @param string $namelist + * @param array $TUser list of users (employees) in selected usergroup of a column + * @param int $fk_usergroup selected usergroup id + * @param string $namelist html name * @return string */ function displayUsersListWithPicto(&$TUser, $fk_usergroup = 0, $namelist = 'list-user') @@ -453,7 +464,7 @@ function displayUsersListWithPicto(&$TUser, $fk_usergroup = 0, $namelist = 'list * * Allow to get skill(s) of a user * - * @param $TUser + * @param array $TUser array of employees we need to get skills * @return array|int */ function getSkillForUsers($TUser) @@ -509,7 +520,7 @@ function getSkillForUsers($TUser) /** * Allow to get skill(s) of a job * - * @param $fk_job + * @param int $fk_job job we need to get required skills * @return array|int */ function getSkillForJob($fk_job) @@ -554,82 +565,3 @@ function getSkillForJob($fk_job) return $Tab; } - -/** - * duplicated with modified data from $form Class - * - * @param string $selected - * @param string $htmlname - * @param int $show_empty - * @param int $disabled - * @param string $enableonly - * @param string $force_entity - * @param false $multiple - * @param string $morecss - * @return string - */ -function select_jobs($selected = '', $htmlname = 'groupid', $show_empty = 0, $disabled = 0, $enableonly = '', $force_entity = '0', $multiple = false, $morecss = '') -{ - // phpcs:enable - global $conf, $user, $langs,$db; - - if (!is_array($selected)) { - $selected = array($selected); - } - $out = ''; - - // On recherche les groupes - $sql = "SELECT j.rowid, j.label as name"; - $sql .= " FROM ".MAIN_DB_PREFIX."hrm_job as j "; - $sql .= " ORDER BY j.label ASC"; - - - $resql = $db->query($sql); - if ($resql) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname); - $out .= ''; - } else { - dol_print_error($db); - } - - return $out; -}