PMCORE-2698
This commit is contained in:
@@ -1123,15 +1123,15 @@ class AbstractCases implements CasesInterface
|
||||
// Thread tasks
|
||||
if($key === 'user_id') {
|
||||
$threadTasks[$i][$key] = $row;
|
||||
// Get the user tooltip information
|
||||
$threadTasks[$i] = User::getInformation($row);
|
||||
}
|
||||
} else {
|
||||
// Thread users
|
||||
if ($key === 'user_id') {
|
||||
$threadUsers[$i][$key] = $row;
|
||||
$user = (!empty($row)) ? User::where('USR_ID', $row)->first(): null;
|
||||
$threadUsers[$i]['usr_username'] = $user ? $user->USR_USERNAME : '';
|
||||
$threadUsers[$i]['usr_lastname'] = $user ? $user->USR_LASTNAME : '';
|
||||
$threadUsers[$i]['usr_firstname'] = $user ? $user->USR_FIRSTNAME : '';
|
||||
// Get the user tooltip information
|
||||
$threadTasks[$i] = User::getInformation($row);
|
||||
}
|
||||
// Thread titles
|
||||
if ($key === 'del_id') {
|
||||
|
||||
@@ -6,6 +6,7 @@ use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\AppNotes;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
class Participated extends AbstractCases
|
||||
{
|
||||
@@ -21,11 +22,6 @@ class Participated extends AbstractCases
|
||||
'APPLICATION.APP_FINISH_DATE', // Finish Date
|
||||
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date related to the colors
|
||||
'USERS.USR_ID', // Current UserId
|
||||
// Information for the user tooltip
|
||||
'USERS.USR_USERNAME', // UserName
|
||||
'USERS.USR_FIRSTNAME', // FirstName
|
||||
'USERS.USR_LASTNAME', // LastName
|
||||
'USERS.USR_EMAIL', // Mail
|
||||
// Additional column for other functionalities
|
||||
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
||||
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
||||
@@ -187,6 +183,8 @@ class Participated extends AbstractCases
|
||||
$result[$i]['delay'] = getDiffBetweenDates($thread['DEL_TASK_DUE_DATE'], date("Y-m-d H:i:s"));
|
||||
$result[$i]['tas_color'] = (!empty($thread['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($thread['DEL_TASK_DUE_DATE']) : '';
|
||||
$result[$i]['tas_color_label'] = (!empty($result[$i]['tas_color'])) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
|
||||
// Get the user tooltip information
|
||||
$result[$i] = User::getInformation($thread['USR_ID']);
|
||||
$i++;
|
||||
}
|
||||
$item['PENDING'] = $result;
|
||||
@@ -197,6 +195,8 @@ class Participated extends AbstractCases
|
||||
$result[$i]['delay'] = getDiffBetweenDates($item['DEL_TASK_DUE_DATE'], date("Y-m-d H:i:s"));
|
||||
$result[$i]['tas_color'] = (!empty($item['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($item['DEL_TASK_DUE_DATE']) : '';
|
||||
$result[$i]['tas_color_label'] = (!empty($result[$i]['tas_color'])) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
|
||||
// Get the user tooltip information
|
||||
$result[$i] = User::getInformation($item['USR_ID']);
|
||||
$item['PENDING'] = $result;
|
||||
}
|
||||
break;
|
||||
@@ -216,6 +216,8 @@ class Participated extends AbstractCases
|
||||
$result[$i]['delay'] = getDiffBetweenDates($item['DEL_TASK_DUE_DATE'], date("Y-m-d H:i:s"));
|
||||
$result[$i]['tas_color'] = (!empty($item['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($item['DEL_TASK_DUE_DATE']) : '';
|
||||
$result[$i]['tas_color_label'] = (!empty($result[$i]['tas_color'])) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
|
||||
// Get the user tooltip information
|
||||
$result[$i] = User::getInformation($item['USR_ID']);
|
||||
$item['PENDING'] = $result;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -20,11 +20,6 @@ class Supervising extends AbstractCases
|
||||
'APPLICATION.APP_FINISH_DATE', // Finish Date
|
||||
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date related to the colors
|
||||
'USERS.USR_ID', // Current UserId
|
||||
// Information for the user tooltip
|
||||
'USERS.USR_USERNAME', // UserName
|
||||
'USERS.USR_FIRSTNAME', // FirstName
|
||||
'USERS.USR_LASTNAME', // LastName
|
||||
'USERS.USR_EMAIL', // Mail
|
||||
// Additional column for other functionalities
|
||||
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
||||
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
||||
|
||||
@@ -45,6 +45,19 @@ class User extends Model
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope for query to get the user by USR_ID
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param int $usrId
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeUserId($query, string $usrId)
|
||||
{
|
||||
return $query->where('USR_ID', '=', $usrId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the groups from a user
|
||||
*
|
||||
@@ -171,6 +184,7 @@ class User extends Model
|
||||
throw new Exception("Error getting the users: {$e->getMessage()}.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user id
|
||||
*
|
||||
@@ -191,4 +205,33 @@ class User extends Model
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user information for the tooltip
|
||||
*
|
||||
* @param int $usrId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getInformation($usrId)
|
||||
{
|
||||
$query = User::query()->select([
|
||||
'USR_USERNAME',
|
||||
'USR_FIRSTNAME',
|
||||
'USR_LASTNAME',
|
||||
'USR_EMAIL',
|
||||
])
|
||||
->userId($usrId)
|
||||
->limit(1);
|
||||
$results = $query->get();
|
||||
$info = [];
|
||||
$results->each(function ($item) use (&$info) {
|
||||
$info['usr_username'] = $item->USR_USERNAME;
|
||||
$info['usr_firstname'] = $item->USR_FIRSTNAME;
|
||||
$info['usr_lastname'] = $item->USR_LASTNAME;
|
||||
$info['usr_email'] = $item->USR_EMAIL;
|
||||
});
|
||||
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user