error message

This commit is contained in:
Florian HENRY 2021-12-03 10:59:47 +01:00
parent 1db52532ff
commit 2f4fe2b898
2 changed files with 27 additions and 17 deletions

View File

@ -410,7 +410,13 @@ class Skill extends CommonObject
$skilldet = new Skilldet($this->db); $skilldet = new Skilldet($this->db);
$this->lines = $skilldet->fetchAll('ASC', '', '', '', array('fk_skill' => $this->id), ''); $this->lines = $skilldet->fetchAll('ASC', '', '', '', array('fk_skill' => $this->id), '');
if (is_array($this->lines)) {
return (count($this->lines) > 0) ? $this->lines : array(); return (count($this->lines) > 0) ? $this->lines : array();
} elseif ($this->lines < 0) {
$this->errors = array_merge($this->errors, $skilldet->errors);
$this->error = $skilldet->error;
return $this->lines;
}
} }

View File

@ -115,10 +115,13 @@ function displayRankInfos($selected_rank, $fk_skill, $inputname = 'TNote', $mode
$skilldet = new Skilldet($db); $skilldet = new Skilldet($db);
$Lines = $skilldet->fetchAll('ASC', 'rank', 0, 0, array('customsql'=>'fk_skill = '.$fk_skill)); $Lines = $skilldet->fetchAll('ASC', 'rank', 0, 0, array('customsql'=>'fk_skill = '.$fk_skill));
if (!is_array($Lines) && $Lines<0) {
setEventMessages($skilldet->error, $skilldet->errors, 'errors');
}
if (empty($Lines)) return $langs->trans('SkillHasNoLines'); if (empty($Lines)) return $langs->trans('SkillHasNoLines');
$ret = '<!-- field jquery --><span title="'.$langs->trans('NA').'" class="radio_js_bloc_number '.$inputname.'_'.$fk_skill.(empty($selected_rank) ? ' selected' : '').'">0</span>'; $ret = '<!-- field jquery --><span title="'.$langs->trans('NA').'" class="radio_js_bloc_number '.$inputname.'_'.$fk_skill.(empty($selected_rank) ? ' selected' : '').'">0</span>';
if (is_array($Lines) && !empty($Lines)) {
foreach ($Lines as $line) { foreach ($Lines as $line) {
$MaxNumberSkill = isset($conf->global->HRM_MAXRANK) ? $conf->global->HRM_MAXRANK : Skill::DEFAULT_MAX_RANK_PER_SKILL; $MaxNumberSkill = isset($conf->global->HRM_MAXRANK) ? $conf->global->HRM_MAXRANK : Skill::DEFAULT_MAX_RANK_PER_SKILL;
if ($line->rank > $MaxNumberSkill) { if ($line->rank > $MaxNumberSkill) {
@ -154,6 +157,7 @@ function displayRankInfos($selected_rank, $fk_skill, $inputname = 'TNote', $mode
}); });
</script>'; </script>';
} }
}
return $ret; return $ret;
} }