PMCORE-3490 Custom Case List is displaying other Processes cases than the one belong to the Report Table of a Process PMCORE_3.7.0-5474

This commit is contained in:
Roly Gutierrez
2021-10-29 12:44:51 -04:00
parent bd7d2963f3
commit 232eb450aa

View File

@@ -278,6 +278,7 @@ class Home
->first(); ->first();
if (!empty($caseList)) { if (!empty($caseList)) {
$tableName = $caseList->ADD_TAB_NAME; $tableName = $caseList->ADD_TAB_NAME;
$proUid = $caseList->PRO_UID;
//this gets the configured columns //this gets the configured columns
$columns = json_decode($caseList->CAL_COLUMNS); $columns = json_decode($caseList->CAL_COLUMNS);
@@ -300,13 +301,18 @@ class Home
} }
//this modifies the query //this modifies the query
if (!empty($tableName) && !empty($fields)) { if (!empty($tableName)) {
$arguments[] = function ($query) use ($tableName, $fields, $customFilters, $types) { $arguments[] = function ($query) use ($tableName, $fields, $customFilters, $types, $proUid) {
//setting the related process
$query->where('PROCESS.PRO_UID', '=', $proUid);
//setting columns data from report table
$query->leftJoin($tableName, "{$tableName}.APP_UID", "=", "APP_DELEGATION.APP_UID"); $query->leftJoin($tableName, "{$tableName}.APP_UID", "=", "APP_DELEGATION.APP_UID");
foreach ($fields as $value) { foreach ($fields as $value) {
$query->addSelect($value); $query->addSelect($value);
} }
//filters for custom case list
//setting filters for custom case list
foreach ($customFilters as $key => $filter) { foreach ($customFilters as $key => $filter) {
if (in_array($key, $fields)) { if (in_array($key, $fields)) {
//special case for date range //special case for date range