Merged in bugfix/PMCORE-3832 (pull request #8446)
PMCORE-3832 Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\ProcessCategory;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
@@ -227,16 +228,7 @@ class Draft extends AbstractCases
|
||||
*/
|
||||
public function getCustomListCount(int $id, string $type): array
|
||||
{
|
||||
$caseList = CaseList::where('CAL_ID', '=', $id)
|
||||
->where('CAL_TYPE', '=', $type)
|
||||
->leftJoin('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
|
||||
->select([
|
||||
'CASE_LIST.*',
|
||||
'ADDITIONAL_TABLES.ADD_TAB_NAME'
|
||||
])
|
||||
->get()
|
||||
->first();
|
||||
|
||||
$caseList = CaseList::getCaseList($id, $type);
|
||||
$query = Delegation::query()->select();
|
||||
$query->draft($this->getUserId());
|
||||
|
||||
@@ -248,6 +240,9 @@ class Draft extends AbstractCases
|
||||
$description = $caseList->CAL_DESCRIPTION;
|
||||
$tableName = $caseList->ADD_TAB_NAME;
|
||||
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
|
||||
$process = Process::getIds($caseList->PRO_UID, 'PRO_UID');
|
||||
$proId = head($process)['PRO_ID'];
|
||||
$query->processId($proId);
|
||||
}
|
||||
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
return [
|
||||
|
||||
@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\ProcessCategory;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
@@ -244,16 +245,7 @@ class Inbox extends AbstractCases
|
||||
*/
|
||||
public function getCustomListCount(int $id, string $type): array
|
||||
{
|
||||
$caseList = CaseList::where('CAL_ID', '=', $id)
|
||||
->where('CAL_TYPE', '=', $type)
|
||||
->leftJoin('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
|
||||
->select([
|
||||
'CASE_LIST.*',
|
||||
'ADDITIONAL_TABLES.ADD_TAB_NAME'
|
||||
])
|
||||
->get()
|
||||
->first();
|
||||
|
||||
$caseList = CaseList::getCaseList($id, $type);
|
||||
$query = Delegation::query()->select();
|
||||
$query->inbox($this->getUserId());
|
||||
|
||||
@@ -265,6 +257,9 @@ class Inbox extends AbstractCases
|
||||
$description = $caseList->CAL_DESCRIPTION;
|
||||
$tableName = $caseList->ADD_TAB_NAME;
|
||||
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
|
||||
$process = Process::getIds($caseList->PRO_UID, 'PRO_UID');
|
||||
$proId = head($process)['PRO_ID'];
|
||||
$query->processId($proId);
|
||||
}
|
||||
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
return [
|
||||
|
||||
@@ -6,6 +6,7 @@ use G;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\ProcessCategory;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
@@ -238,16 +239,7 @@ class Paused extends AbstractCases
|
||||
*/
|
||||
public function getCustomListCount(int $id, string $type): array
|
||||
{
|
||||
$caseList = CaseList::where('CAL_ID', '=', $id)
|
||||
->where('CAL_TYPE', '=', $type)
|
||||
->leftJoin('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
|
||||
->select([
|
||||
'CASE_LIST.*',
|
||||
'ADDITIONAL_TABLES.ADD_TAB_NAME'
|
||||
])
|
||||
->get()
|
||||
->first();
|
||||
|
||||
$caseList = CaseList::getCaseList($id, $type);
|
||||
$query = Delegation::query()->select();
|
||||
$query->paused($this->getUserId());
|
||||
|
||||
@@ -259,6 +251,9 @@ class Paused extends AbstractCases
|
||||
$description = $caseList->CAL_DESCRIPTION;
|
||||
$tableName = $caseList->ADD_TAB_NAME;
|
||||
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
|
||||
$process = Process::getIds($caseList->PRO_UID, 'PRO_UID');
|
||||
$proId = head($process)['PRO_ID'];
|
||||
$query->processId($proId);
|
||||
}
|
||||
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
return [
|
||||
|
||||
@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\ProcessCategory;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
@@ -247,16 +248,7 @@ class Unassigned extends AbstractCases
|
||||
*/
|
||||
public function getCustomListCount(int $id, string $type): array
|
||||
{
|
||||
$caseList = CaseList::where('CAL_ID', '=', $id)
|
||||
->where('CAL_TYPE', '=', $type)
|
||||
->leftJoin('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
|
||||
->select([
|
||||
'CASE_LIST.*',
|
||||
'ADDITIONAL_TABLES.ADD_TAB_NAME'
|
||||
])
|
||||
->get()
|
||||
->first();
|
||||
|
||||
$caseList = CaseList::getCaseList($id, $type);
|
||||
$query = Delegation::query()->select();
|
||||
$query->selfService($this->getUserId());
|
||||
|
||||
@@ -268,6 +260,9 @@ class Unassigned extends AbstractCases
|
||||
$description = $caseList->CAL_DESCRIPTION;
|
||||
$tableName = $caseList->ADD_TAB_NAME;
|
||||
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
|
||||
$process = Process::getIds($caseList->PRO_UID, 'PRO_UID');
|
||||
$proId = head($process)['PRO_ID'];
|
||||
$query->processId($proId);
|
||||
}
|
||||
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||
return [
|
||||
|
||||
@@ -75,6 +75,30 @@ class CaseList extends Model
|
||||
*/
|
||||
public static $excludeColumns = ['APP_UID', 'APP_NUMBER', 'APP_STATUS'];
|
||||
|
||||
/**
|
||||
* Get case list
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $type
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public static function getCaseList($id, $type)
|
||||
{
|
||||
$caseList = CaseList::where('CAL_ID', '=', $id)
|
||||
->where('CAL_TYPE', '=', $type)
|
||||
->leftJoin('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
|
||||
->select([
|
||||
'CASE_LIST.*',
|
||||
'ADDITIONAL_TABLES.ADD_TAB_NAME',
|
||||
'ADDITIONAL_TABLES.PRO_UID'
|
||||
])
|
||||
->get()
|
||||
->first();
|
||||
|
||||
return $caseList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get column name from alias.
|
||||
* @param array $array
|
||||
|
||||
@@ -204,6 +204,25 @@ class Process extends Model
|
||||
return $query->where('PROCESS.PRO_STATUS', $status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return process
|
||||
* @param int|string $id
|
||||
* @param string $key
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getIds($id, $key)
|
||||
{
|
||||
$process = Process::query()
|
||||
->select()
|
||||
->where($key, $id)
|
||||
->get()
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
return $process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the process list for an specific user and/or for the specific category
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user