FIX : stickler feedbacks part 1

This commit is contained in:
Gauthier PC portable 024 2021-09-28 08:40:15 +02:00
parent fde0f1ac25
commit 9713f6afd9
6 changed files with 50 additions and 41 deletions

View File

@ -602,7 +602,7 @@ class Job extends CommonObject
/**
* Get last job for user
*
* @param $fk_user
* @param int $fk_user id of user we need to get last job
* @return mixed|string|null
*/
public function getLastJobForUser($fk_user)
@ -610,7 +610,7 @@ class Job extends CommonObject
global $db;
$j = new Job($db);
$Tab = $j->get_for_user($fk_user);
$Tab = $j->getForUser($fk_user);
if (empty($Tab)) return '';
@ -622,16 +622,16 @@ class Job extends CommonObject
/**
* Get jobs for user
*
* @param $userid
* @param int $userid id of user we need to get job list
* @return array of jobs
*/
public function get_for_user($userid)
public function getForUser($userid)
{
global $db;
$TReturn = array();
$position = new Position($db);
$TPosition = $position->get_for_user($userid);
$TPosition = $position->getForUser($userid);
foreach ($TPosition as $UPosition) {
$TReturn[$UPosition->Job->rowid] = $UPosition->Job->ref;
}

View File

@ -981,10 +981,10 @@ class Position extends CommonObject
}
/**
* @param $userid
* @param int $userid id of user we need to get position list
* @return array|int of positions of user with for each of them the job fetched into that array
*/
public function get_for_user($userid)
public function getForUser($userid)
{
$TPosition = array();

View File

@ -240,6 +240,10 @@ class Skill extends CommonObject
return $resultcreate;
}
/**
* @param int $i rank from which we want to create skilldets
* @return null
*/
public function createSkills($i = 1)
{
@ -1086,40 +1090,45 @@ class Skill extends CommonObject
return $error;
}
/**
* Permet de retourner un select html du dictionnaire llx_c_skill_type
*
* @global type $conf
* @param string $selected
* @param string $htmlname
* @param bool $emptyvalue
* @param string $selected preselected element
* @param string $htmlname html name of input
* @param bool $emptyvalue true if we need to put an empty value
* @param string $moreattr used to add more html attributes into input
* @param string $more_class used if we want to add new css class to input
* @return string
*/
public function select_skill_type($selected = '', $htmlname = 'code_c_skill_type', $emptyvalue = true, $moreattr = '', $more_class = '')
{
global $conf;
$out = '<select class="flat select_skill_type ' . $more_class . '" name="' . $htmlname . '" id="' . $htmlname . '" ' . $moreattr . '>';
if ($emptyvalue)
$out .= '<option value=""></options>';
$sql = 'SELECT code, label FROM ' . MAIN_DB_PREFIX . 'c_skill_type WHERE active = 1 AND entity IN (0,' . $conf->entity.')';
$resql = $this->db->query($sql);
if ($resql) {
while ( $obj = $this->db->fetch_object($resql) ) {
$out .= '<option value="' . $obj->code . '" ' . ($selected == $obj->code ? 'selected' : '') . '>' . $obj->label . '</options>';
}
} else {
dol_print_error($this->db);
}
$out .= '</select>';
return $out;
}
// public function select_skill_type($selected = '', $htmlname = 'code_c_skill_type', $emptyvalue = true, $moreattr = '', $more_class = '')
// {
// global $conf;
//
// $out = '<select class="flat select_skill_type ' . $more_class . '" name="' . $htmlname . '" id="' . $htmlname . '" ' . $moreattr . '>';
// if ($emptyvalue)
// $out .= '<option value=""></options>';
//
//
// $sql = 'SELECT code, label FROM ' . MAIN_DB_PREFIX . 'c_skill_type WHERE active = 1 AND entity IN (0,' . $conf->entity.')';
// $resql = $this->db->query($sql);
// if ($resql) {
// while ( $obj = $this->db->fetch_object($resql) ) {
// $out .= '<option value="' . $obj->code . '" ' . ($selected == $obj->code ? 'selected' : '') . '>' . $obj->label . '</options>';
// }
// } else {
// dol_print_error($this->db);
// }
//
// $out .= '</select>';
//
// return $out;
// }
/**
* @param int $code number of code label
* @return int|string
*/
public static function typeCodeToLabel($code)
{
global $langs;

View File

@ -362,10 +362,10 @@ class SkillRank extends CommonObject
* The skillrank table is a join table that is marked for multiple objects
*
* @param SkillRank $currentSkill
* @param $user
* @return int
* @param int $fk_user id of user linked to skillrank
* @return int > 0 if ok, < 0 if ko
*/
public function cloneFromCurrentSkill($currentSkill, $user, $fk_user)
public function cloneFromCurrentSkill($currentSkill, $fk_user)
{
global $user;

View File

@ -223,7 +223,7 @@ if (empty($reshook)) {
if (count($SkillrecordsForActiveUser) == 0) {
if ($res > 0) {
$newSkill = new SkillRank($db);
$resCreate = $newSkill->cloneFromCurrentSkill($line, $user, $object->fk_user);
$resCreate = $newSkill->cloneFromCurrentSkill($line, $object->fk_user);
if ($resCreate <= 0) {
$errors++;
@ -251,7 +251,7 @@ if (empty($reshook)) {
$updSkill->update($user);
} else { // sinon on ajoute la skill
$newSkill = new SkillRank($db);
$resCreate = $newSkill->cloneFromCurrentSkill($line, $user, $object->fk_user);
$resCreate = $newSkill->cloneFromCurrentSkill($line, $object->fk_user);
}
}
}

View File

@ -339,7 +339,7 @@ if (($id || $ref) && $action == 'edit') {
// if (!empty($val['help'])) {
// print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
// } else {
print $langs->trans($val['label']).'&nbsp;'.$langs->trans('Rank').'&nbsp;'.$sk->rank;
print $langs->trans($val['label']).'&nbsp;'.$langs->trans('rank').'&nbsp;'.$sk->rank;
// }
print '</td>';
print '<td class="valuefieldcreate">';