PMCORE-3000

This commit is contained in:
Paula Quispe
2021-05-06 11:42:01 -04:00
parent ff13d14727
commit c73454dc9e

View File

@@ -38,11 +38,10 @@ class ProcessUser extends Model
*/ */
public function scopeProcessGroupSupervisor($query, $userUid) public function scopeProcessGroupSupervisor($query, $userUid)
{ {
$query->where('PU_TYPE', 'GROUP_SUPERVISOR'); // Ge the groups related to the user, Todo, implement the field PROCESS_USER.GRP_ID
$query->leftJoin('GROUP_USER', function ($leftJoin) use ($userUid) { $groups = GroupUser::getGroups($userUid, 'GRP_UID');
$leftJoin->on('PROCESS_USER.USR_UID', '=', 'GROUP_USER.GRP_UID') $query->where('PROCESS_USER.PU_TYPE', 'GROUP_SUPERVISOR');
->where('GROUP_USER.USR_UID', $userUid); $query->whereIn('PROCESS_USER.USR_UID', $groups);
});
$query->joinProcess(); $query->joinProcess();
return $query; return $query;