FIX : stickler feedbacks part 1
This commit is contained in:
parent
fde0f1ac25
commit
9713f6afd9
@ -602,7 +602,7 @@ class Job extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Get last job for user
|
* 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
|
* @return mixed|string|null
|
||||||
*/
|
*/
|
||||||
public function getLastJobForUser($fk_user)
|
public function getLastJobForUser($fk_user)
|
||||||
@ -610,7 +610,7 @@ class Job extends CommonObject
|
|||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$j = new Job($db);
|
$j = new Job($db);
|
||||||
$Tab = $j->get_for_user($fk_user);
|
$Tab = $j->getForUser($fk_user);
|
||||||
|
|
||||||
if (empty($Tab)) return '';
|
if (empty($Tab)) return '';
|
||||||
|
|
||||||
@ -622,16 +622,16 @@ class Job extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Get jobs for user
|
* Get jobs for user
|
||||||
*
|
*
|
||||||
* @param $userid
|
* @param int $userid id of user we need to get job list
|
||||||
* @return array of jobs
|
* @return array of jobs
|
||||||
*/
|
*/
|
||||||
public function get_for_user($userid)
|
public function getForUser($userid)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$TReturn = array();
|
$TReturn = array();
|
||||||
$position = new Position($db);
|
$position = new Position($db);
|
||||||
$TPosition = $position->get_for_user($userid);
|
$TPosition = $position->getForUser($userid);
|
||||||
foreach ($TPosition as $UPosition) {
|
foreach ($TPosition as $UPosition) {
|
||||||
$TReturn[$UPosition->Job->rowid] = $UPosition->Job->ref;
|
$TReturn[$UPosition->Job->rowid] = $UPosition->Job->ref;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
* @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();
|
$TPosition = array();
|
||||||
|
|
||||||
|
|||||||
@ -240,6 +240,10 @@ class Skill extends CommonObject
|
|||||||
return $resultcreate;
|
return $resultcreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $i rank from which we want to create skilldets
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
public function createSkills($i = 1)
|
public function createSkills($i = 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1086,40 +1090,45 @@ class Skill extends CommonObject
|
|||||||
|
|
||||||
return $error;
|
return $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permet de retourner un select html du dictionnaire llx_c_skill_type
|
* Permet de retourner un select html du dictionnaire llx_c_skill_type
|
||||||
*
|
*
|
||||||
* @global type $conf
|
* @param string $selected preselected element
|
||||||
* @param string $selected
|
* @param string $htmlname html name of input
|
||||||
* @param string $htmlname
|
* @param bool $emptyvalue true if we need to put an empty value
|
||||||
* @param bool $emptyvalue
|
* @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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function select_skill_type($selected = '', $htmlname = 'code_c_skill_type', $emptyvalue = true, $moreattr = '', $more_class = '')
|
// public function select_skill_type($selected = '', $htmlname = 'code_c_skill_type', $emptyvalue = true, $moreattr = '', $more_class = '')
|
||||||
{
|
// {
|
||||||
global $conf;
|
// global $conf;
|
||||||
|
//
|
||||||
$out = '<select class="flat select_skill_type ' . $more_class . '" name="' . $htmlname . '" id="' . $htmlname . '" ' . $moreattr . '>';
|
// $out = '<select class="flat select_skill_type ' . $more_class . '" name="' . $htmlname . '" id="' . $htmlname . '" ' . $moreattr . '>';
|
||||||
if ($emptyvalue)
|
// if ($emptyvalue)
|
||||||
$out .= '<option value=""></options>';
|
// $out .= '<option value=""></options>';
|
||||||
|
//
|
||||||
|
//
|
||||||
$sql = 'SELECT code, label FROM ' . MAIN_DB_PREFIX . 'c_skill_type WHERE active = 1 AND entity IN (0,' . $conf->entity.')';
|
// $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);
|
// $resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
// if ($resql) {
|
||||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
// while ( $obj = $this->db->fetch_object($resql) ) {
|
||||||
$out .= '<option value="' . $obj->code . '" ' . ($selected == $obj->code ? 'selected' : '') . '>' . $obj->label . '</options>';
|
// $out .= '<option value="' . $obj->code . '" ' . ($selected == $obj->code ? 'selected' : '') . '>' . $obj->label . '</options>';
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
dol_print_error($this->db);
|
// dol_print_error($this->db);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
$out .= '</select>';
|
// $out .= '</select>';
|
||||||
|
//
|
||||||
return $out;
|
// return $out;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $code number of code label
|
||||||
|
* @return int|string
|
||||||
|
*/
|
||||||
public static function typeCodeToLabel($code)
|
public static function typeCodeToLabel($code)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|||||||
@ -362,10 +362,10 @@ class SkillRank extends CommonObject
|
|||||||
* The skillrank table is a join table that is marked for multiple objects
|
* The skillrank table is a join table that is marked for multiple objects
|
||||||
*
|
*
|
||||||
* @param SkillRank $currentSkill
|
* @param SkillRank $currentSkill
|
||||||
* @param $user
|
* @param int $fk_user id of user linked to skillrank
|
||||||
* @return int
|
* @return int > 0 if ok, < 0 if ko
|
||||||
*/
|
*/
|
||||||
public function cloneFromCurrentSkill($currentSkill, $user, $fk_user)
|
public function cloneFromCurrentSkill($currentSkill, $fk_user)
|
||||||
{
|
{
|
||||||
|
|
||||||
global $user;
|
global $user;
|
||||||
|
|||||||
@ -223,7 +223,7 @@ if (empty($reshook)) {
|
|||||||
if (count($SkillrecordsForActiveUser) == 0) {
|
if (count($SkillrecordsForActiveUser) == 0) {
|
||||||
if ($res > 0) {
|
if ($res > 0) {
|
||||||
$newSkill = new SkillRank($db);
|
$newSkill = new SkillRank($db);
|
||||||
$resCreate = $newSkill->cloneFromCurrentSkill($line, $user, $object->fk_user);
|
$resCreate = $newSkill->cloneFromCurrentSkill($line, $object->fk_user);
|
||||||
|
|
||||||
if ($resCreate <= 0) {
|
if ($resCreate <= 0) {
|
||||||
$errors++;
|
$errors++;
|
||||||
@ -251,7 +251,7 @@ if (empty($reshook)) {
|
|||||||
$updSkill->update($user);
|
$updSkill->update($user);
|
||||||
} else { // sinon on ajoute la skill
|
} else { // sinon on ajoute la skill
|
||||||
$newSkill = new SkillRank($db);
|
$newSkill = new SkillRank($db);
|
||||||
$resCreate = $newSkill->cloneFromCurrentSkill($line, $user, $object->fk_user);
|
$resCreate = $newSkill->cloneFromCurrentSkill($line, $object->fk_user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -339,7 +339,7 @@ if (($id || $ref) && $action == 'edit') {
|
|||||||
// if (!empty($val['help'])) {
|
// if (!empty($val['help'])) {
|
||||||
// print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
|
// print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
|
||||||
// } else {
|
// } else {
|
||||||
print $langs->trans($val['label']).' '.$langs->trans('Rank').' '.$sk->rank;
|
print $langs->trans($val['label']).' '.$langs->trans('rank').' '.$sk->rank;
|
||||||
// }
|
// }
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="valuefieldcreate">';
|
print '<td class="valuefieldcreate">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user