PMCORE-3832
This commit is contained in:
committed by
Paula.Quispe
parent
c4684271c6
commit
908e975d5f
@@ -4,7 +4,7 @@ use Faker\Generator as Faker;
|
|||||||
|
|
||||||
$factory->define(\ProcessMaker\Model\CaseList::class, function (Faker $faker) {
|
$factory->define(\ProcessMaker\Model\CaseList::class, function (Faker $faker) {
|
||||||
return [
|
return [
|
||||||
'CAL_ID' => $faker->unique()->numberBetween(1, 2000),
|
'CAL_ID' => $faker->unique()->numberBetween(1, 5000),
|
||||||
'CAL_TYPE' => 'inbox',
|
'CAL_TYPE' => 'inbox',
|
||||||
'CAL_NAME' => $faker->title,
|
'CAL_NAME' => $faker->title,
|
||||||
'CAL_DESCRIPTION' => $faker->text,
|
'CAL_DESCRIPTION' => $faker->text,
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class DraftTest extends TestCase
|
|||||||
'APP_INIT_USER_ID' => $user->USR_ID,
|
'APP_INIT_USER_ID' => $user->USR_ID,
|
||||||
'APP_CUR_USER' => $user->USR_UID,
|
'APP_CUR_USER' => $user->USR_UID,
|
||||||
]);
|
]);
|
||||||
factory(Delegation::class)->states('foreign_keys')->create([
|
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
'DEL_THREAD_STATUS' => 'OPEN',
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
'DEL_INDEX' => 1,
|
'DEL_INDEX' => 1,
|
||||||
'APP_UID' => $application->APP_UID,
|
'APP_UID' => $application->APP_UID,
|
||||||
@@ -82,7 +82,7 @@ class DraftTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $user;
|
return $delegation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -758,8 +758,9 @@ class DraftTest extends TestCase
|
|||||||
public function it_should_test_getCustomListCount_method()
|
public function it_should_test_getCustomListCount_method()
|
||||||
{
|
{
|
||||||
$cases = $this->createManyDraft(3);
|
$cases = $this->createManyDraft(3);
|
||||||
|
$additionalTables = factory(AdditionalTables::class)->create([
|
||||||
$additionalTables = factory(AdditionalTables::class)->create();
|
'PRO_UID' => $cases->PRO_UID
|
||||||
|
]);
|
||||||
$query = ""
|
$query = ""
|
||||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||||
. "`APP_UID` varchar(32) NOT NULL,"
|
. "`APP_UID` varchar(32) NOT NULL,"
|
||||||
@@ -792,7 +793,7 @@ class DraftTest extends TestCase
|
|||||||
$this->assertArrayHasKey('total', $res);
|
$this->assertArrayHasKey('total', $res);
|
||||||
|
|
||||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||||
$this->assertEquals(3, $res['total']);
|
$this->assertEquals(1, $res['total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -70,14 +70,14 @@ class InboxTest extends TestCase
|
|||||||
$user = factory(\ProcessMaker\Model\User::class)->create();
|
$user = factory(\ProcessMaker\Model\User::class)->create();
|
||||||
|
|
||||||
for ($i = 0; $i < $cases; $i = $i + 1) {
|
for ($i = 0; $i < $cases; $i = $i + 1) {
|
||||||
factory(Delegation::class)->states('foreign_keys')->create([
|
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
'DEL_THREAD_STATUS' => 'OPEN',
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
'DEL_INDEX' => 2,
|
'DEL_INDEX' => 2,
|
||||||
'USR_UID' => $user->USR_UID,
|
'USR_UID' => $user->USR_UID,
|
||||||
'USR_ID' => $user->USR_ID,
|
'USR_ID' => $user->USR_ID,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return $user;
|
return $delegation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -737,7 +737,9 @@ class InboxTest extends TestCase
|
|||||||
{
|
{
|
||||||
$cases = $this->createMultipleInbox(3);
|
$cases = $this->createMultipleInbox(3);
|
||||||
|
|
||||||
$additionalTables = factory(AdditionalTables::class)->create();
|
$additionalTables = factory(AdditionalTables::class)->create([
|
||||||
|
'PRO_UID' => $cases->PRO_UID
|
||||||
|
]);
|
||||||
$query = ""
|
$query = ""
|
||||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||||
. "`APP_UID` varchar(32) NOT NULL,"
|
. "`APP_UID` varchar(32) NOT NULL,"
|
||||||
@@ -770,7 +772,7 @@ class InboxTest extends TestCase
|
|||||||
$this->assertArrayHasKey('total', $res);
|
$this->assertArrayHasKey('total', $res);
|
||||||
|
|
||||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||||
$this->assertEquals(3, $res['total']);
|
$this->assertEquals(1, $res['total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ class PausedTest extends TestCase
|
|||||||
'APP_TYPE' => 'PAUSE'
|
'APP_TYPE' => 'PAUSE'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return $user;
|
return $delegation1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -691,7 +691,9 @@ class PausedTest extends TestCase
|
|||||||
{
|
{
|
||||||
$cases = $this->createMultiplePaused(3);
|
$cases = $this->createMultiplePaused(3);
|
||||||
|
|
||||||
$additionalTables = factory(AdditionalTables::class)->create();
|
$additionalTables = factory(AdditionalTables::class)->create([
|
||||||
|
'PRO_UID' => $cases->PRO_UID
|
||||||
|
]);
|
||||||
$query = ""
|
$query = ""
|
||||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||||
. "`APP_UID` varchar(32) NOT NULL,"
|
. "`APP_UID` varchar(32) NOT NULL,"
|
||||||
@@ -724,7 +726,7 @@ class PausedTest extends TestCase
|
|||||||
$this->assertArrayHasKey('total', $res);
|
$this->assertArrayHasKey('total', $res);
|
||||||
|
|
||||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||||
$this->assertEquals(3, $res['total']);
|
$this->assertEquals(1, $res['total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -208,16 +208,21 @@ class UnassignedTest extends TestCase
|
|||||||
'TU_RELATION' => 1, //Related to the user
|
'TU_RELATION' => 1, //Related to the user
|
||||||
'TU_TYPE' => 1
|
'TU_TYPE' => 1
|
||||||
]);
|
]);
|
||||||
factory(Delegation::class)->create([
|
$delegation = factory(Delegation::class)->create([
|
||||||
'APP_NUMBER' => $application->APP_NUMBER,
|
'APP_NUMBER' => $application->APP_NUMBER,
|
||||||
'TAS_ID' => $task->TAS_ID,
|
'TAS_ID' => $task->TAS_ID,
|
||||||
'PRO_ID' => $process->PRO_ID,
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
'DEL_THREAD_STATUS' => 'OPEN',
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
'USR_ID' => 0,
|
'USR_ID' => 0,
|
||||||
|
'USR_UID' => '',
|
||||||
'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-$i year"))
|
'DEL_DELEGATE_DATE' => date('Y-m-d H:i:s', strtotime("-$i year"))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return $user;
|
return [
|
||||||
|
'taskUser' => $user,
|
||||||
|
'delegation' => $delegation
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -525,8 +530,8 @@ class UnassignedTest extends TestCase
|
|||||||
// Create factories related to the unassigned cases
|
// Create factories related to the unassigned cases
|
||||||
$cases = $this->createMultipleUnassigned(3);
|
$cases = $this->createMultipleUnassigned(3);
|
||||||
$unassigned = new Unassigned();
|
$unassigned = new Unassigned();
|
||||||
$unassigned->setUserId($cases->USR_ID);
|
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||||
$unassigned->setUserUid($cases->USR_UID);
|
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||||
// Get the total for the pagination
|
// Get the total for the pagination
|
||||||
$res = $unassigned->getCounter();
|
$res = $unassigned->getCounter();
|
||||||
$this->assertEquals(3, $res);
|
$this->assertEquals(3, $res);
|
||||||
@@ -544,8 +549,8 @@ class UnassignedTest extends TestCase
|
|||||||
// Create factories related to the unassigned cases
|
// Create factories related to the unassigned cases
|
||||||
$cases = $this->createMultipleUnassigned(3);
|
$cases = $this->createMultipleUnassigned(3);
|
||||||
$unassigned = new Unassigned();
|
$unassigned = new Unassigned();
|
||||||
$unassigned->setUserId($cases->USR_ID);
|
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||||
$unassigned->setUserUid($cases->USR_UID);
|
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||||
// Get the total for the pagination
|
// Get the total for the pagination
|
||||||
$res = $unassigned->getPagingCounters();
|
$res = $unassigned->getPagingCounters();
|
||||||
$this->assertEquals(3, $res);
|
$this->assertEquals(3, $res);
|
||||||
@@ -575,8 +580,8 @@ class UnassignedTest extends TestCase
|
|||||||
{
|
{
|
||||||
$cases = $this->createMultipleUnassigned(3);
|
$cases = $this->createMultipleUnassigned(3);
|
||||||
$unassigned = new Unassigned();
|
$unassigned = new Unassigned();
|
||||||
$unassigned->setUserId($cases->USR_ID);
|
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||||
$unassigned->setUserUid($cases->USR_UID);
|
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||||
$res = $unassigned->getCountersByProcesses();
|
$res = $unassigned->getCountersByProcesses();
|
||||||
$this->assertCount(3, $res);
|
$this->assertCount(3, $res);
|
||||||
}
|
}
|
||||||
@@ -656,8 +661,8 @@ class UnassignedTest extends TestCase
|
|||||||
{
|
{
|
||||||
$cases = $this->createMultipleUnassigned(20);
|
$cases = $this->createMultipleUnassigned(20);
|
||||||
$unassigned = new Unassigned();
|
$unassigned = new Unassigned();
|
||||||
$unassigned->setUserId($cases->USR_ID);
|
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||||
$unassigned->setUserUid($cases->USR_UID);
|
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||||
$res = $unassigned->getCountersByProcesses(null, true);
|
$res = $unassigned->getCountersByProcesses(null, true);
|
||||||
$this->assertCount(10, $res);
|
$this->assertCount(10, $res);
|
||||||
}
|
}
|
||||||
@@ -812,9 +817,10 @@ class UnassignedTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function it_should_test_getCustomListCount_method()
|
public function it_should_test_getCustomListCount_method()
|
||||||
{
|
{
|
||||||
$cases = $this->createMultipleUnassigned(0);
|
$cases = $this->createMultipleUnassigned(1);
|
||||||
|
$additionalTables = factory(AdditionalTables::class)->create([
|
||||||
$additionalTables = factory(AdditionalTables::class)->create();
|
'PRO_UID' => $cases['delegation']->PRO_UID
|
||||||
|
]);
|
||||||
$query = ""
|
$query = ""
|
||||||
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||||
. "`APP_UID` varchar(32) NOT NULL,"
|
. "`APP_UID` varchar(32) NOT NULL,"
|
||||||
@@ -830,13 +836,12 @@ class UnassignedTest extends TestCase
|
|||||||
$caseList = factory(CaseList::class)->create([
|
$caseList = factory(CaseList::class)->create([
|
||||||
'CAL_TYPE' => 'unassigned',
|
'CAL_TYPE' => 'unassigned',
|
||||||
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
'USR_ID' => $cases->USR_ID
|
'USR_ID' => $cases['taskUser']->USR_ID
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$unassigned = new Unassigned();
|
$unassigned = new Unassigned();
|
||||||
$unassigned->setUserId($cases->USR_ID);
|
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||||
$unassigned->setUserUid($cases->USR_UID);
|
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||||
|
|
||||||
$res = $unassigned->getCustomListCount($caseList->CAL_ID, 'unassigned');
|
$res = $unassigned->getCustomListCount($caseList->CAL_ID, 'unassigned');
|
||||||
|
|
||||||
//assertions
|
//assertions
|
||||||
@@ -847,7 +852,7 @@ class UnassignedTest extends TestCase
|
|||||||
$this->assertArrayHasKey('total', $res);
|
$this->assertArrayHasKey('total', $res);
|
||||||
|
|
||||||
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
$this->assertEquals($additionalTables->ADD_TAB_NAME, $res['tableName']);
|
||||||
$this->assertEquals(0, $res['total']);
|
$this->assertNotEmpty($res);
|
||||||
|
|
||||||
//for user or group
|
//for user or group
|
||||||
$cases = $this->createSelfServiceUserOrGroup();
|
$cases = $this->createSelfServiceUserOrGroup();
|
||||||
|
|||||||
@@ -29,6 +29,34 @@ class CaseListTest extends TestCase
|
|||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This tests the getCaseList method.
|
||||||
|
* @test
|
||||||
|
* @covers \ProcessMaker\Model\CaseList::getCaseList()
|
||||||
|
*/
|
||||||
|
public function it_should_test_getCaseList()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'type' => 'inbox',
|
||||||
|
'name' => 'test1',
|
||||||
|
'description' => 'my description',
|
||||||
|
'tableUid' => '',
|
||||||
|
'columns' => [],
|
||||||
|
'userId' => 1,
|
||||||
|
'iconList' => 'deafult.png',
|
||||||
|
'iconColor' => 'red',
|
||||||
|
'iconColorScreen' => 'blue',
|
||||||
|
'createDate' => date('Y-m-d H:i:s'),
|
||||||
|
'updateDate' => date('Y-m-d H:i:s')
|
||||||
|
];
|
||||||
|
$model = CaseList::createSetting($data, $data['userId']);
|
||||||
|
|
||||||
|
$id = $model->CAL_ID;
|
||||||
|
$type = $model->CAL_TYPE;
|
||||||
|
$caseList = CaseList::getCaseList($id, $type);
|
||||||
|
$this->assertNotEmpty($caseList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This tests the getColumnNameFromAlias method.
|
* This tests the getColumnNameFromAlias method.
|
||||||
* @test
|
* @test
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use G;
|
use G;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use ProcessMaker\Model\Process;
|
use ProcessMaker\Model\Process;
|
||||||
@@ -254,6 +255,27 @@ class ProcessTest extends TestCase
|
|||||||
$this->assertEquals('PUBLIC', $p[0]->PRO_TYPE_PROCESS);
|
$this->assertEquals('PUBLIC', $p[0]->PRO_TYPE_PROCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the exception
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\Process::getProcessesFilter()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_test_exception_get_process()
|
||||||
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
|
$result = Process::getProcessesFilter(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
0,
|
||||||
|
25,
|
||||||
|
'ASC',
|
||||||
|
'OTHER_COLUMN_DOES_NOT_EXIST'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the process list
|
* It tests the process list
|
||||||
*
|
*
|
||||||
@@ -432,6 +454,19 @@ class ProcessTest extends TestCase
|
|||||||
$this->assertCount(1, Process::getProcessesForHome(null, null, 2, 1, true));
|
$this->assertCount(1, Process::getProcessesForHome(null, null, 2, 1, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It test get id
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\Process::getIds()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_get_id()
|
||||||
|
{
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$result = Process::getIds($process->PRO_UID, 'PRO_UID');
|
||||||
|
$this->assertEquals($process->PRO_ID, $result[0]['PRO_ID']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It tests the isActive process
|
* It tests the isActive process
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -157,9 +157,9 @@ class MetricsTest extends TestCase
|
|||||||
$unassignedTest = new UnassignedTest();
|
$unassignedTest = new UnassignedTest();
|
||||||
$cases = $unassignedTest->createMultipleUnassigned(3);
|
$cases = $unassignedTest->createMultipleUnassigned(3);
|
||||||
$unassigned = new Unassigned();
|
$unassigned = new Unassigned();
|
||||||
$unassigned->setUserId($cases->USR_ID);
|
$unassigned->setUserId($cases['taskUser']->USR_ID);
|
||||||
$unassigned->setUserUid($cases->USR_UID);
|
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||||
$this->initializeRestApi($cases->USR_UID);
|
$this->initializeRestApi($cases['taskUser']->USR_UID);
|
||||||
$metrics = new Metrics();
|
$metrics = new Metrics();
|
||||||
$res = $metrics->getCountersList();
|
$res = $metrics->getCountersList();
|
||||||
$this->assertNotEmpty($res);
|
$this->assertNotEmpty($res);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
|
|||||||
use ProcessMaker\Model\CaseList;
|
use ProcessMaker\Model\CaseList;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\Task;
|
use ProcessMaker\Model\Task;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
use ProcessMaker\Model\ProcessCategory;
|
use ProcessMaker\Model\ProcessCategory;
|
||||||
use ProcessMaker\Model\User;
|
use ProcessMaker\Model\User;
|
||||||
|
|
||||||
@@ -227,16 +228,7 @@ class Draft extends AbstractCases
|
|||||||
*/
|
*/
|
||||||
public function getCustomListCount(int $id, string $type): array
|
public function getCustomListCount(int $id, string $type): array
|
||||||
{
|
{
|
||||||
$caseList = CaseList::where('CAL_ID', '=', $id)
|
$caseList = CaseList::getCaseList($id, $type);
|
||||||
->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();
|
|
||||||
|
|
||||||
$query = Delegation::query()->select();
|
$query = Delegation::query()->select();
|
||||||
$query->draft($this->getUserId());
|
$query->draft($this->getUserId());
|
||||||
|
|
||||||
@@ -248,6 +240,9 @@ class Draft extends AbstractCases
|
|||||||
$description = $caseList->CAL_DESCRIPTION;
|
$description = $caseList->CAL_DESCRIPTION;
|
||||||
$tableName = $caseList->ADD_TAB_NAME;
|
$tableName = $caseList->ADD_TAB_NAME;
|
||||||
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
|
$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']);
|
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
|
|||||||
use ProcessMaker\Model\CaseList;
|
use ProcessMaker\Model\CaseList;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\Task;
|
use ProcessMaker\Model\Task;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
use ProcessMaker\Model\ProcessCategory;
|
use ProcessMaker\Model\ProcessCategory;
|
||||||
use ProcessMaker\Model\User;
|
use ProcessMaker\Model\User;
|
||||||
|
|
||||||
@@ -244,16 +245,7 @@ class Inbox extends AbstractCases
|
|||||||
*/
|
*/
|
||||||
public function getCustomListCount(int $id, string $type): array
|
public function getCustomListCount(int $id, string $type): array
|
||||||
{
|
{
|
||||||
$caseList = CaseList::where('CAL_ID', '=', $id)
|
$caseList = CaseList::getCaseList($id, $type);
|
||||||
->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();
|
|
||||||
|
|
||||||
$query = Delegation::query()->select();
|
$query = Delegation::query()->select();
|
||||||
$query->inbox($this->getUserId());
|
$query->inbox($this->getUserId());
|
||||||
|
|
||||||
@@ -265,6 +257,9 @@ class Inbox extends AbstractCases
|
|||||||
$description = $caseList->CAL_DESCRIPTION;
|
$description = $caseList->CAL_DESCRIPTION;
|
||||||
$tableName = $caseList->ADD_TAB_NAME;
|
$tableName = $caseList->ADD_TAB_NAME;
|
||||||
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
|
$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']);
|
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use G;
|
|||||||
use ProcessMaker\Model\CaseList;
|
use ProcessMaker\Model\CaseList;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\Task;
|
use ProcessMaker\Model\Task;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
use ProcessMaker\Model\ProcessCategory;
|
use ProcessMaker\Model\ProcessCategory;
|
||||||
use ProcessMaker\Model\User;
|
use ProcessMaker\Model\User;
|
||||||
|
|
||||||
@@ -238,16 +239,7 @@ class Paused extends AbstractCases
|
|||||||
*/
|
*/
|
||||||
public function getCustomListCount(int $id, string $type): array
|
public function getCustomListCount(int $id, string $type): array
|
||||||
{
|
{
|
||||||
$caseList = CaseList::where('CAL_ID', '=', $id)
|
$caseList = CaseList::getCaseList($id, $type);
|
||||||
->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();
|
|
||||||
|
|
||||||
$query = Delegation::query()->select();
|
$query = Delegation::query()->select();
|
||||||
$query->paused($this->getUserId());
|
$query->paused($this->getUserId());
|
||||||
|
|
||||||
@@ -259,6 +251,9 @@ class Paused extends AbstractCases
|
|||||||
$description = $caseList->CAL_DESCRIPTION;
|
$description = $caseList->CAL_DESCRIPTION;
|
||||||
$tableName = $caseList->ADD_TAB_NAME;
|
$tableName = $caseList->ADD_TAB_NAME;
|
||||||
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
|
$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']);
|
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
|
|||||||
use ProcessMaker\Model\CaseList;
|
use ProcessMaker\Model\CaseList;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\Task;
|
use ProcessMaker\Model\Task;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
use ProcessMaker\Model\ProcessCategory;
|
use ProcessMaker\Model\ProcessCategory;
|
||||||
use ProcessMaker\Model\User;
|
use ProcessMaker\Model\User;
|
||||||
|
|
||||||
@@ -247,16 +248,7 @@ class Unassigned extends AbstractCases
|
|||||||
*/
|
*/
|
||||||
public function getCustomListCount(int $id, string $type): array
|
public function getCustomListCount(int $id, string $type): array
|
||||||
{
|
{
|
||||||
$caseList = CaseList::where('CAL_ID', '=', $id)
|
$caseList = CaseList::getCaseList($id, $type);
|
||||||
->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();
|
|
||||||
|
|
||||||
$query = Delegation::query()->select();
|
$query = Delegation::query()->select();
|
||||||
$query->selfService($this->getUserId());
|
$query->selfService($this->getUserId());
|
||||||
|
|
||||||
@@ -268,6 +260,9 @@ class Unassigned extends AbstractCases
|
|||||||
$description = $caseList->CAL_DESCRIPTION;
|
$description = $caseList->CAL_DESCRIPTION;
|
||||||
$tableName = $caseList->ADD_TAB_NAME;
|
$tableName = $caseList->ADD_TAB_NAME;
|
||||||
$query->leftJoin($caseList->ADD_TAB_NAME, $caseList->ADD_TAB_NAME . '.APP_UID', '=', 'APP_DELEGATION.APP_UID');
|
$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']);
|
$count = $query->count(['APP_DELEGATION.APP_NUMBER']);
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -75,6 +75,30 @@ class CaseList extends Model
|
|||||||
*/
|
*/
|
||||||
public static $excludeColumns = ['APP_UID', 'APP_NUMBER', 'APP_STATUS'];
|
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.
|
* Get column name from alias.
|
||||||
* @param array $array
|
* @param array $array
|
||||||
|
|||||||
@@ -204,6 +204,25 @@ class Process extends Model
|
|||||||
return $query->where('PROCESS.PRO_STATUS', $status);
|
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
|
* Obtains the process list for an specific user and/or for the specific category
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user