PMCORE-3222 Service - Get custom case list schema and data
This commit is contained in:
@@ -0,0 +1,534 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel\Cases;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\Home;
|
||||||
|
use ProcessMaker\Model\AdditionalTables;
|
||||||
|
use ProcessMaker\Model\AppDelay;
|
||||||
|
use ProcessMaker\Model\Application;
|
||||||
|
use ProcessMaker\Model\CaseList;
|
||||||
|
use ProcessMaker\Model\Delegation;
|
||||||
|
use ProcessMaker\Model\Fields;
|
||||||
|
use ProcessMaker\Model\GroupUser;
|
||||||
|
use ProcessMaker\Model\Groupwf;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
|
use ProcessMaker\Model\User;
|
||||||
|
use ProcessMaker\Model\Task;
|
||||||
|
use ProcessMaker\Model\TaskUser;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases\Home
|
||||||
|
*/
|
||||||
|
class HomeTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setUp method.
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tearDown method.
|
||||||
|
*/
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the getDraft method.
|
||||||
|
* @test
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Home::getDraft()
|
||||||
|
*/
|
||||||
|
public function it_should_test_getDraft()
|
||||||
|
{
|
||||||
|
$application = factory(Application::class)->states('draft')->create();
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application->APP_INIT_USER,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'APP_NUMBER' => $application->APP_NUMBER,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$home = new Home($application->APP_INIT_USER);
|
||||||
|
$result = $home->getDraft();
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('data', $result);
|
||||||
|
$this->assertArrayHasKey('total', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the getInbox method.
|
||||||
|
* @test
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Home::getInbox()
|
||||||
|
*/
|
||||||
|
public function it_should_test_getInbox()
|
||||||
|
{
|
||||||
|
$application = factory(Application::class)->states('todo')->create();
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2
|
||||||
|
]);
|
||||||
|
|
||||||
|
$home = new Home($application->APP_INIT_USER);
|
||||||
|
$result = $home->getInbox();
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('data', $result);
|
||||||
|
$this->assertArrayHasKey('total', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the getUnassigned method.
|
||||||
|
* @test
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Home::getUnassigned()
|
||||||
|
*/
|
||||||
|
public function it_should_test_getUnassigned()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$group = factory(Groupwf::class)->create();
|
||||||
|
factory(GroupUser::class)->create([
|
||||||
|
'GRP_UID' => $group->GRP_UID,
|
||||||
|
'GRP_ID' => $group->GRP_ID,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
]);
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'APP_STATUS_ID' => 2
|
||||||
|
]);
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||||
|
'TAS_GROUP_VARIABLE' => '',
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
]);
|
||||||
|
factory(TaskUser::class)->create([
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'TU_RELATION' => 1,
|
||||||
|
'TU_TYPE' => 1
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->create([
|
||||||
|
'APP_NUMBER' => $application->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task->TAS_ID,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'USR_ID' => 0,
|
||||||
|
'DEL_DELEGATE_DATE' => date('Y-m-d H:m:s', strtotime("-1 year"))
|
||||||
|
]);
|
||||||
|
|
||||||
|
$home = new Home($user->USR_UID);
|
||||||
|
$result = $home->getUnassigned();
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('data', $result);
|
||||||
|
$this->assertArrayHasKey('total', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the getPaused method.
|
||||||
|
* @test
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Home::getPaused()
|
||||||
|
*/
|
||||||
|
public function it_should_test_getPaused()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$process1 = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'TAS_ASSIGN_TYPE' => '',
|
||||||
|
'TAS_GROUP_VARIABLE' => '',
|
||||||
|
'PRO_UID' => $process1->PRO_UID,
|
||||||
|
'TAS_TYPE' => 'NORMAL'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$application1 = factory(Application::class)->create();
|
||||||
|
$delegation1 = factory(Delegation::class)->create([
|
||||||
|
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task->TAS_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID,
|
||||||
|
'DEL_PREVIOUS' => 1,
|
||||||
|
'DEL_INDEX' => 2
|
||||||
|
]);
|
||||||
|
|
||||||
|
$process2 = factory(Process::class)->create();
|
||||||
|
$application2 = factory(Application::class)->create();
|
||||||
|
$delegation2 = factory(Delegation::class)->create([
|
||||||
|
'APP_NUMBER' => $application2->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task->TAS_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID,
|
||||||
|
'DEL_PREVIOUS' => 1,
|
||||||
|
'DEL_INDEX' => 2
|
||||||
|
]);
|
||||||
|
factory(AppDelay::class, 5)->create([
|
||||||
|
'APP_DELEGATION_USER' => $user->USR_UID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID,
|
||||||
|
'APP_NUMBER' => $delegation1->APP_NUMBER,
|
||||||
|
'APP_DEL_INDEX' => $delegation1->DEL_INDEX,
|
||||||
|
'APP_DISABLE_ACTION_USER' => 0,
|
||||||
|
'APP_TYPE' => 'PAUSE'
|
||||||
|
]);
|
||||||
|
factory(AppDelay::class, 5)->create([
|
||||||
|
'APP_DELEGATION_USER' => $user->USR_UID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID,
|
||||||
|
'APP_NUMBER' => $delegation2->APP_NUMBER,
|
||||||
|
'APP_DEL_INDEX' => $delegation2->DEL_INDEX,
|
||||||
|
'APP_DISABLE_ACTION_USER' => 0,
|
||||||
|
'APP_TYPE' => 'PAUSE'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$home = new Home($user->USR_UID);
|
||||||
|
$result = $home->getPaused();
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('data', $result);
|
||||||
|
$this->assertArrayHasKey('total', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the buildCustomCaseList method.
|
||||||
|
* @test
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Home::buildCustomCaseList()
|
||||||
|
*/
|
||||||
|
public function it_should_test_buildCustomCaseList()
|
||||||
|
{
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$additionalTables = factory(AdditionalTables::class)->create();
|
||||||
|
$query = ""
|
||||||
|
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||||
|
. "`APP_UID` varchar(32) NOT NULL,"
|
||||||
|
. "`APP_NUMBER` int(11) NOT NULL,"
|
||||||
|
. "`APP_STATUS` varchar(10) NOT NULL,"
|
||||||
|
. "`VAR1` varchar(255) DEFAULT NULL,"
|
||||||
|
. "`VAR2` varchar(255) DEFAULT NULL,"
|
||||||
|
. "`VAR3` varchar(255) DEFAULT NULL,"
|
||||||
|
. "PRIMARY KEY (`APP_UID`),"
|
||||||
|
. "KEY `indexTable` (`APP_UID`))";
|
||||||
|
DB::statement($query);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR1'
|
||||||
|
]);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR2'
|
||||||
|
]);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR3'
|
||||||
|
]);
|
||||||
|
|
||||||
|
//for inbox
|
||||||
|
$type = 'inbox';
|
||||||
|
$caseList = factory(CaseList::class)->create([
|
||||||
|
'CAL_TYPE' => $type,
|
||||||
|
'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]',
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'USR_ID' => $user->USR_ID
|
||||||
|
]);
|
||||||
|
$arguments = [$caseList->CAL_ID, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
|
||||||
|
$defaultColumns = CaseList::formattingColumns($type, '', []);
|
||||||
|
|
||||||
|
$home = new Home($user->USR_UID);
|
||||||
|
$home->buildCustomCaseList($type, $caseList->CAL_ID, $arguments, $defaultColumns);
|
||||||
|
|
||||||
|
$this->assertTrue(is_callable(array_pop($arguments)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the getCustomDraft method.
|
||||||
|
* @test
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Home::getCustomDraft()
|
||||||
|
*/
|
||||||
|
public function it_should_test_getCustomDraft()
|
||||||
|
{
|
||||||
|
$additionalTables = factory(AdditionalTables::class)->create();
|
||||||
|
$query = ""
|
||||||
|
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||||
|
. "`APP_UID` varchar(32) NOT NULL,"
|
||||||
|
. "`APP_NUMBER` int(11) NOT NULL,"
|
||||||
|
. "`APP_STATUS` varchar(10) NOT NULL,"
|
||||||
|
. "`VAR1` varchar(255) DEFAULT NULL,"
|
||||||
|
. "`VAR2` varchar(255) DEFAULT NULL,"
|
||||||
|
. "`VAR3` varchar(255) DEFAULT NULL,"
|
||||||
|
. "PRIMARY KEY (`APP_UID`),"
|
||||||
|
. "KEY `indexTable` (`APP_UID`))";
|
||||||
|
DB::statement($query);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR1'
|
||||||
|
]);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR2'
|
||||||
|
]);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR3'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$application = factory(Application::class)->states('draft')->create();
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 1,
|
||||||
|
'USR_UID' => $application->APP_INIT_USER,
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'APP_NUMBER' => $application->APP_NUMBER,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$caseList = factory(CaseList::class)->create([
|
||||||
|
'CAL_TYPE' => 'draft',
|
||||||
|
'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]',
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID
|
||||||
|
]);
|
||||||
|
$arguments = [$caseList->CAL_ID, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
|
||||||
|
|
||||||
|
$home = new Home($application->APP_INIT_USER);
|
||||||
|
$result = $home->getCustomDraft(...$arguments);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('data', $result);
|
||||||
|
$this->assertArrayHasKey('total', $result);
|
||||||
|
$this->assertArrayHasKey('columns', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the getCustomInbox method.
|
||||||
|
* @test
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Home::getCustomInbox()
|
||||||
|
*/
|
||||||
|
public function it_should_test_getCustomInbox()
|
||||||
|
{
|
||||||
|
$additionalTables = factory(AdditionalTables::class)->create();
|
||||||
|
$query = ""
|
||||||
|
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||||
|
. "`APP_UID` varchar(32) NOT NULL,"
|
||||||
|
. "`APP_NUMBER` int(11) NOT NULL,"
|
||||||
|
. "`APP_STATUS` varchar(10) NOT NULL,"
|
||||||
|
. "`VAR1` varchar(255) DEFAULT NULL,"
|
||||||
|
. "`VAR2` varchar(255) DEFAULT NULL,"
|
||||||
|
. "`VAR3` varchar(255) DEFAULT NULL,"
|
||||||
|
. "PRIMARY KEY (`APP_UID`),"
|
||||||
|
. "KEY `indexTable` (`APP_UID`))";
|
||||||
|
DB::statement($query);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR1'
|
||||||
|
]);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR2'
|
||||||
|
]);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR3'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$application = factory(Application::class)->states('todo')->create();
|
||||||
|
factory(Delegation::class)->states('foreign_keys')->create([
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'DEL_INDEX' => 2
|
||||||
|
]);
|
||||||
|
|
||||||
|
$caseList = factory(CaseList::class)->create([
|
||||||
|
'CAL_TYPE' => 'inbox',
|
||||||
|
'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]',
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID
|
||||||
|
]);
|
||||||
|
$arguments = [$caseList->CAL_ID, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
|
||||||
|
|
||||||
|
$home = new Home($application->APP_INIT_USER);
|
||||||
|
$result = $home->getCustomDraft(...$arguments);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('data', $result);
|
||||||
|
$this->assertArrayHasKey('total', $result);
|
||||||
|
$this->assertArrayHasKey('columns', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the getCustomUnassigned method.
|
||||||
|
* @test
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Home::getCustomUnassigned()
|
||||||
|
*/
|
||||||
|
public function it_should_test_getCustomUnassignedt()
|
||||||
|
{
|
||||||
|
$additionalTables = factory(AdditionalTables::class)->create();
|
||||||
|
$query = ""
|
||||||
|
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||||
|
. "`APP_UID` varchar(32) NOT NULL,"
|
||||||
|
. "`APP_NUMBER` int(11) NOT NULL,"
|
||||||
|
. "`APP_STATUS` varchar(10) NOT NULL,"
|
||||||
|
. "`VAR1` varchar(255) DEFAULT NULL,"
|
||||||
|
. "`VAR2` varchar(255) DEFAULT NULL,"
|
||||||
|
. "`VAR3` varchar(255) DEFAULT NULL,"
|
||||||
|
. "PRIMARY KEY (`APP_UID`),"
|
||||||
|
. "KEY `indexTable` (`APP_UID`))";
|
||||||
|
DB::statement($query);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR1'
|
||||||
|
]);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR2'
|
||||||
|
]);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR3'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$group = factory(Groupwf::class)->create();
|
||||||
|
factory(GroupUser::class)->create([
|
||||||
|
'GRP_UID' => $group->GRP_UID,
|
||||||
|
'GRP_ID' => $group->GRP_ID,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
]);
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
$application = factory(Application::class)->create([
|
||||||
|
'APP_STATUS_ID' => 2
|
||||||
|
]);
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
|
||||||
|
'TAS_GROUP_VARIABLE' => '',
|
||||||
|
'PRO_UID' => $process->PRO_UID,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
]);
|
||||||
|
factory(TaskUser::class)->create([
|
||||||
|
'TAS_UID' => $task->TAS_UID,
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'TU_RELATION' => 1,
|
||||||
|
'TU_TYPE' => 1
|
||||||
|
]);
|
||||||
|
factory(Delegation::class)->create([
|
||||||
|
'APP_NUMBER' => $application->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task->TAS_ID,
|
||||||
|
'PRO_ID' => $process->PRO_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'USR_ID' => 0,
|
||||||
|
'DEL_DELEGATE_DATE' => date('Y-m-d H:m:s', strtotime("-1 year"))
|
||||||
|
]);
|
||||||
|
|
||||||
|
$caseList = factory(CaseList::class)->create([
|
||||||
|
'CAL_TYPE' => 'unassigned',
|
||||||
|
'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]',
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID
|
||||||
|
]);
|
||||||
|
$arguments = [$caseList->CAL_ID, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
|
||||||
|
|
||||||
|
$home = new Home($application->APP_INIT_USER);
|
||||||
|
$result = $home->getCustomDraft(...$arguments);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('data', $result);
|
||||||
|
$this->assertArrayHasKey('total', $result);
|
||||||
|
$this->assertArrayHasKey('columns', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the getCustomPaused method.
|
||||||
|
* @test
|
||||||
|
* @covers \ProcessMaker\BusinessModel\Cases\Home::getCustomPaused()
|
||||||
|
*/
|
||||||
|
public function it_should_test_getCustomPaused()
|
||||||
|
{
|
||||||
|
$additionalTables = factory(AdditionalTables::class)->create();
|
||||||
|
$query = ""
|
||||||
|
. "CREATE TABLE IF NOT EXISTS `{$additionalTables->ADD_TAB_NAME}` ("
|
||||||
|
. "`APP_UID` varchar(32) NOT NULL,"
|
||||||
|
. "`APP_NUMBER` int(11) NOT NULL,"
|
||||||
|
. "`APP_STATUS` varchar(10) NOT NULL,"
|
||||||
|
. "`VAR1` varchar(255) DEFAULT NULL,"
|
||||||
|
. "`VAR2` varchar(255) DEFAULT NULL,"
|
||||||
|
. "`VAR3` varchar(255) DEFAULT NULL,"
|
||||||
|
. "PRIMARY KEY (`APP_UID`),"
|
||||||
|
. "KEY `indexTable` (`APP_UID`))";
|
||||||
|
DB::statement($query);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR1'
|
||||||
|
]);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR2'
|
||||||
|
]);
|
||||||
|
factory(Fields::class)->create([
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID,
|
||||||
|
'FLD_NAME' => 'VAR3'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$process1 = factory(Process::class)->create();
|
||||||
|
$task = factory(Task::class)->create([
|
||||||
|
'TAS_ASSIGN_TYPE' => '',
|
||||||
|
'TAS_GROUP_VARIABLE' => '',
|
||||||
|
'PRO_UID' => $process1->PRO_UID,
|
||||||
|
'TAS_TYPE' => 'NORMAL'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$application1 = factory(Application::class)->create();
|
||||||
|
$delegation1 = factory(Delegation::class)->create([
|
||||||
|
'APP_NUMBER' => $application1->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task->TAS_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process1->PRO_ID,
|
||||||
|
'PRO_UID' => $process1->PRO_UID,
|
||||||
|
'DEL_PREVIOUS' => 1,
|
||||||
|
'DEL_INDEX' => 2
|
||||||
|
]);
|
||||||
|
|
||||||
|
$process2 = factory(Process::class)->create();
|
||||||
|
$application2 = factory(Application::class)->create();
|
||||||
|
$delegation2 = factory(Delegation::class)->create([
|
||||||
|
'APP_NUMBER' => $application2->APP_NUMBER,
|
||||||
|
'TAS_ID' => $task->TAS_ID,
|
||||||
|
'DEL_THREAD_STATUS' => 'OPEN',
|
||||||
|
'USR_UID' => $user->USR_UID,
|
||||||
|
'USR_ID' => $user->USR_ID,
|
||||||
|
'PRO_ID' => $process2->PRO_ID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID,
|
||||||
|
'DEL_PREVIOUS' => 1,
|
||||||
|
'DEL_INDEX' => 2
|
||||||
|
]);
|
||||||
|
factory(AppDelay::class, 5)->create([
|
||||||
|
'APP_DELEGATION_USER' => $user->USR_UID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID,
|
||||||
|
'APP_NUMBER' => $delegation1->APP_NUMBER,
|
||||||
|
'APP_DEL_INDEX' => $delegation1->DEL_INDEX,
|
||||||
|
'APP_DISABLE_ACTION_USER' => 0,
|
||||||
|
'APP_TYPE' => 'PAUSE'
|
||||||
|
]);
|
||||||
|
factory(AppDelay::class, 5)->create([
|
||||||
|
'APP_DELEGATION_USER' => $user->USR_UID,
|
||||||
|
'PRO_UID' => $process2->PRO_UID,
|
||||||
|
'APP_NUMBER' => $delegation2->APP_NUMBER,
|
||||||
|
'APP_DEL_INDEX' => $delegation2->DEL_INDEX,
|
||||||
|
'APP_DISABLE_ACTION_USER' => 0,
|
||||||
|
'APP_TYPE' => 'PAUSE'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$caseList = factory(CaseList::class)->create([
|
||||||
|
'CAL_TYPE' => 'paused',
|
||||||
|
'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]',
|
||||||
|
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID
|
||||||
|
]);
|
||||||
|
$arguments = [$caseList->CAL_ID, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
|
||||||
|
|
||||||
|
$home = new Home($application1->APP_INIT_USER);
|
||||||
|
$result = $home->getCustomDraft(...$arguments);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('data', $result);
|
||||||
|
$this->assertArrayHasKey('total', $result);
|
||||||
|
$this->assertArrayHasKey('columns', $result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -84,10 +84,10 @@ class Draft extends AbstractCases
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get data self-services cases by user
|
* Get data self-services cases by user
|
||||||
*
|
* @param callable $callback
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getData()
|
public function getData(callable $callback = null)
|
||||||
{
|
{
|
||||||
$query = Delegation::query()->select($this->getColumnsView());
|
$query = Delegation::query()->select($this->getColumnsView());
|
||||||
// Join with process
|
// Join with process
|
||||||
@@ -105,6 +105,9 @@ class Draft extends AbstractCases
|
|||||||
}
|
}
|
||||||
// Add pagination to the query
|
// Add pagination to the query
|
||||||
$query->offset($this->getOffset())->limit($this->getLimit());
|
$query->offset($this->getOffset())->limit($this->getLimit());
|
||||||
|
if (is_callable($callback)) {
|
||||||
|
$callback($query);
|
||||||
|
}
|
||||||
// Get the data
|
// Get the data
|
||||||
$results = $query->get();
|
$results = $query->get();
|
||||||
// Prepare the result
|
// Prepare the result
|
||||||
|
|||||||
461
workflow/engine/src/ProcessMaker/BusinessModel/Cases/Home.php
Normal file
461
workflow/engine/src/ProcessMaker/BusinessModel/Cases/Home.php
Normal file
@@ -0,0 +1,461 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\BusinessModel\Cases;
|
||||||
|
|
||||||
|
use ProcessMaker\BusinessModel\Cases\Draft;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\Inbox;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\Paused;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\Unassigned;
|
||||||
|
use ProcessMaker\Model\CaseList;
|
||||||
|
use ProcessMaker\Model\User;
|
||||||
|
use ProcessMaker\Util\DateTime;
|
||||||
|
|
||||||
|
class Home
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This is the userId field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $userId = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor of the class.
|
||||||
|
* @param type $userId
|
||||||
|
*/
|
||||||
|
public function __construct($userId)
|
||||||
|
{
|
||||||
|
$this->userId = $userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the userId field.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUserId()
|
||||||
|
{
|
||||||
|
return $this->userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the draft cases.
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @param callable $callback
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getDraft(
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
callable $callback = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$list = new Draft();
|
||||||
|
// Define the filters to apply
|
||||||
|
$properties = [];
|
||||||
|
$properties['caseNumber'] = $caseNumber;
|
||||||
|
$properties['caseTitle'] = $caseTitle;
|
||||||
|
$properties['filterCases'] = $filterCases;
|
||||||
|
$properties['process'] = $process;
|
||||||
|
$properties['task'] = $task;
|
||||||
|
// Get the user that access to the API
|
||||||
|
$usrUid = $this->getUserId();
|
||||||
|
$properties['user'] = !empty($usrUid) ? User::getId($usrUid) : 0;
|
||||||
|
$properties['start'] = $offset;
|
||||||
|
$properties['limit'] = $limit;
|
||||||
|
// Set the sort parameters
|
||||||
|
$sort = explode(',', $sort);
|
||||||
|
$properties['sort'] = $sort[0];
|
||||||
|
$properties['dir'] = $sort[1];
|
||||||
|
$list->setProperties($properties);
|
||||||
|
$result = [];
|
||||||
|
$result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback));
|
||||||
|
$result['total'] = $list->getPagingCounters();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the inbox cases.
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $delegateFrom
|
||||||
|
* @param string $delegateTo
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @param callable $callback
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getInbox(
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $delegateFrom = '',
|
||||||
|
string $delegateTo = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
callable $callback = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$list = new Inbox();
|
||||||
|
// Define the filters to apply
|
||||||
|
$properties = [];
|
||||||
|
$properties['caseNumber'] = $caseNumber;
|
||||||
|
$properties['caseTitle'] = $caseTitle;
|
||||||
|
$properties['delegateFrom'] = $delegateFrom;
|
||||||
|
$properties['delegateTo'] = $delegateTo;
|
||||||
|
$properties['filterCases'] = $filterCases;
|
||||||
|
$properties['process'] = $process;
|
||||||
|
$properties['task'] = $task;
|
||||||
|
// Get the user that access to the API
|
||||||
|
$usrUid = $this->getUserId();
|
||||||
|
$properties['user'] = !empty($usrUid) ? User::getId($usrUid) : 0;
|
||||||
|
$properties['start'] = $offset;
|
||||||
|
$properties['limit'] = $limit;
|
||||||
|
// Set the pagination parameters
|
||||||
|
$sort = explode(',', $sort);
|
||||||
|
$properties['sort'] = $sort[0];
|
||||||
|
$properties['dir'] = $sort[1];
|
||||||
|
$list->setProperties($properties);
|
||||||
|
$result = [];
|
||||||
|
$result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback));
|
||||||
|
$result['total'] = $list->getPagingCounters();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the unassigned cases.
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $delegateFrom
|
||||||
|
* @param string $delegateTo
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @param callable $callback
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getUnassigned(
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $delegateFrom = '',
|
||||||
|
string $delegateTo = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
callable $callback = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$list = new Unassigned();
|
||||||
|
// Define the filters to apply
|
||||||
|
$properties = [];
|
||||||
|
$properties['caseNumber'] = $caseNumber;
|
||||||
|
$properties['caseTitle'] = $caseTitle;
|
||||||
|
$properties['delegateFrom'] = $delegateFrom;
|
||||||
|
$properties['delegateTo'] = $delegateTo;
|
||||||
|
$properties['filterCases'] = $filterCases;
|
||||||
|
$properties['process'] = $process;
|
||||||
|
$properties['task'] = $task;
|
||||||
|
// Get the user that access to the API
|
||||||
|
$usrUid = $this->getUserId();
|
||||||
|
$properties['user'] = !empty($usrUid) ? User::getId($usrUid) : 0;
|
||||||
|
$properties['start'] = $offset;
|
||||||
|
$properties['limit'] = $limit;
|
||||||
|
// Set the sort parameters
|
||||||
|
$sort = explode(',', $sort);
|
||||||
|
$properties['sort'] = $sort[0];
|
||||||
|
$properties['dir'] = $sort[1];
|
||||||
|
// todo: some queries related to the unassigned are using the USR_UID
|
||||||
|
$list->setUserUid($usrUid);
|
||||||
|
$list->setProperties($properties);
|
||||||
|
$result = [];
|
||||||
|
$result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback));
|
||||||
|
$result['total'] = $list->getPagingCounters();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the paused cases.
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $delegateFrom
|
||||||
|
* @param string $delegateTo
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @param callable $callback
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getPaused(
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $delegateFrom = '',
|
||||||
|
string $delegateTo = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC',
|
||||||
|
callable $callback = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$list = new Paused();
|
||||||
|
// Define the filters to apply
|
||||||
|
$properties = [];
|
||||||
|
$properties['caseNumber'] = $caseNumber;
|
||||||
|
$properties['caseTitle'] = $caseTitle;
|
||||||
|
$properties['delegateFrom'] = $delegateFrom;
|
||||||
|
$properties['delegateTo'] = $delegateTo;
|
||||||
|
$properties['filterCases'] = $filterCases;
|
||||||
|
$properties['process'] = $process;
|
||||||
|
$properties['task'] = $task;
|
||||||
|
// Get the user that access to the API
|
||||||
|
$usrUid = $this->getUserId();
|
||||||
|
$properties['user'] = !empty($usrUid) ? User::getId($usrUid) : 0;
|
||||||
|
$properties['start'] = $offset;
|
||||||
|
$properties['limit'] = $limit;
|
||||||
|
// Set the sort parameters
|
||||||
|
$sort = explode(',', $sort);
|
||||||
|
$properties['sort'] = $sort[0];
|
||||||
|
$properties['dir'] = $sort[1];
|
||||||
|
$list->setProperties($properties);
|
||||||
|
$result = [];
|
||||||
|
$result['data'] = DateTime::convertUtcToTimeZone($list->getData($callback));
|
||||||
|
$result['total'] = $list->getPagingCounters();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the columns and data from the custom list.
|
||||||
|
* @param string $type
|
||||||
|
* @param int $id
|
||||||
|
* @param array $arguments
|
||||||
|
* @param array $defaultColumns
|
||||||
|
*/
|
||||||
|
public function buildCustomCaseList(string $type, int $id, array &$arguments, array &$defaultColumns)
|
||||||
|
{
|
||||||
|
$caseList = CaseList::where('CAL_TYPE', '=', $type)
|
||||||
|
->where('CAL_ID', '=', $id)
|
||||||
|
->join('ADDITIONAL_TABLES', 'ADDITIONAL_TABLES.ADD_TAB_UID', '=', 'CASE_LIST.ADD_TAB_UID')
|
||||||
|
->get()
|
||||||
|
->first();
|
||||||
|
if (!empty($caseList)) {
|
||||||
|
$tableName = $caseList->ADD_TAB_NAME;
|
||||||
|
|
||||||
|
//this gets the configured columns
|
||||||
|
$columns = json_decode($caseList->CAL_COLUMNS);
|
||||||
|
$columns = CaseList::formattingColumns($type, $caseList->ADD_TAB_UID, $columns);
|
||||||
|
|
||||||
|
//this gets the visible columns from the custom List and the fields from the table
|
||||||
|
if (!empty($columns)) {
|
||||||
|
$defaultColumns = [];
|
||||||
|
}
|
||||||
|
$fields = [];
|
||||||
|
foreach ($columns as $value) {
|
||||||
|
if ($value['set'] === true) {
|
||||||
|
$defaultColumns[] = $value;
|
||||||
|
if ($value['source'] === $tableName) {
|
||||||
|
$fields[] = $value['field'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//this modifies the query
|
||||||
|
if (!empty($tableName) && !empty($fields)) {
|
||||||
|
$arguments[] = function ($query) use ($tableName, $fields) {
|
||||||
|
$query->leftJoin($tableName, "{$tableName}.APP_UID", "=", "APP_DELEGATION.APP_UID");
|
||||||
|
foreach ($fields as $value) {
|
||||||
|
$query->addSelect($value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the custom draft cases.
|
||||||
|
* @param int $id
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getCustomDraft(
|
||||||
|
int $id,
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$arguments = func_get_args();
|
||||||
|
array_shift($arguments);
|
||||||
|
|
||||||
|
$type = 'draft';
|
||||||
|
$defaultColumns = CaseList::formattingColumns($type, '', []);
|
||||||
|
$this->buildCustomCaseList($type, $id, $arguments, $defaultColumns);
|
||||||
|
|
||||||
|
$result = $this->getDraft(...$arguments);
|
||||||
|
$result['columns'] = $defaultColumns;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the custom inbox cases.
|
||||||
|
* @param int $id
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $delegateFrom
|
||||||
|
* @param string $delegateTo
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getCustomInbox(
|
||||||
|
int $id,
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $delegateFrom = '',
|
||||||
|
string $delegateTo = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$arguments = func_get_args();
|
||||||
|
array_shift($arguments);
|
||||||
|
|
||||||
|
$type = 'inbox';
|
||||||
|
$defaultColumns = CaseList::formattingColumns($type, '', []);
|
||||||
|
$this->buildCustomCaseList($type, $id, $arguments, $defaultColumns);
|
||||||
|
|
||||||
|
$result = $this->getInbox(...$arguments);
|
||||||
|
$result['columns'] = $defaultColumns;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the custom unassigned cases.
|
||||||
|
* @param int $id
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $delegateFrom
|
||||||
|
* @param string $delegateTo
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getCustomUnassigned(
|
||||||
|
int $id,
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $delegateFrom = '',
|
||||||
|
string $delegateTo = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$arguments = func_get_args();
|
||||||
|
array_shift($arguments);
|
||||||
|
|
||||||
|
$type = 'unassigned';
|
||||||
|
$defaultColumns = CaseList::formattingColumns($type, '', []);
|
||||||
|
$this->buildCustomCaseList($type, $id, $arguments, $defaultColumns);
|
||||||
|
|
||||||
|
$result = $this->getUnassigned(...$arguments);
|
||||||
|
$result['columns'] = $defaultColumns;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the custom paused cases.
|
||||||
|
* @param int $id
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $delegateFrom
|
||||||
|
* @param string $delegateTo
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getCustomPaused(
|
||||||
|
int $id,
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $delegateFrom = '',
|
||||||
|
string $delegateTo = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$arguments = func_get_args();
|
||||||
|
array_shift($arguments);
|
||||||
|
|
||||||
|
$type = 'paused';
|
||||||
|
$defaultColumns = CaseList::formattingColumns($type, '', []);
|
||||||
|
$this->buildCustomCaseList($type, $id, $arguments, $defaultColumns);
|
||||||
|
|
||||||
|
$result = $this->getPaused(...$arguments);
|
||||||
|
$result['columns'] = $defaultColumns;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -96,10 +96,10 @@ class Inbox extends AbstractCases
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data corresponding to List Inbox
|
* Get the data corresponding to List Inbox
|
||||||
*
|
* @param callable $callback
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getData()
|
public function getData(callable $callback = null)
|
||||||
{
|
{
|
||||||
// Start the query for get the cases related to the user
|
// Start the query for get the cases related to the user
|
||||||
$query = Delegation::query()->select($this->getColumnsView());
|
$query = Delegation::query()->select($this->getColumnsView());
|
||||||
@@ -120,6 +120,9 @@ class Inbox extends AbstractCases
|
|||||||
}
|
}
|
||||||
// The limit by clause
|
// The limit by clause
|
||||||
$query->offset($this->getOffset())->limit($this->getLimit());
|
$query->offset($this->getOffset())->limit($this->getLimit());
|
||||||
|
if (is_callable($callback)) {
|
||||||
|
$callback($query);
|
||||||
|
}
|
||||||
// Execute the query
|
// Execute the query
|
||||||
$results = $query->get();
|
$results = $query->get();
|
||||||
// Prepare the result
|
// Prepare the result
|
||||||
|
|||||||
@@ -95,10 +95,10 @@ class Paused extends AbstractCases
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the data for the paused cases list
|
* Gets the data for the paused cases list
|
||||||
*
|
* @param callable $callback
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getData()
|
public function getData(callable $callback = null)
|
||||||
{
|
{
|
||||||
$query = Delegation::query()->select($this->getColumnsView());
|
$query = Delegation::query()->select($this->getColumnsView());
|
||||||
// Join with process
|
// Join with process
|
||||||
@@ -114,6 +114,9 @@ class Paused extends AbstractCases
|
|||||||
$query->orderBy($this->getOrderByColumn(), $this->getOrderDirection());
|
$query->orderBy($this->getOrderByColumn(), $this->getOrderDirection());
|
||||||
// Add pagination to the query
|
// Add pagination to the query
|
||||||
$query->offset($this->getOffset())->limit($this->getLimit());
|
$query->offset($this->getOffset())->limit($this->getLimit());
|
||||||
|
if (is_callable($callback)) {
|
||||||
|
$callback($query);
|
||||||
|
}
|
||||||
//Execute the query
|
//Execute the query
|
||||||
$results = $query->get();
|
$results = $query->get();
|
||||||
// Prepare the result
|
// Prepare the result
|
||||||
|
|||||||
@@ -96,10 +96,10 @@ class Unassigned extends AbstractCases
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get data self-services cases by user
|
* Get data self-services cases by user
|
||||||
*
|
* @param callable $callback
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getData()
|
public function getData(callable $callback = null)
|
||||||
{
|
{
|
||||||
$query = Delegation::query()->select($this->getColumnsView());
|
$query = Delegation::query()->select($this->getColumnsView());
|
||||||
// Join with process
|
// Join with process
|
||||||
@@ -122,6 +122,9 @@ class Unassigned extends AbstractCases
|
|||||||
}
|
}
|
||||||
// Add pagination to the query
|
// Add pagination to the query
|
||||||
$query->offset($this->getOffset())->limit($this->getLimit());
|
$query->offset($this->getOffset())->limit($this->getLimit());
|
||||||
|
if (is_callable($callback)) {
|
||||||
|
$callback($query);
|
||||||
|
}
|
||||||
// Get the data
|
// Get the data
|
||||||
$results = $query->get();
|
$results = $query->get();
|
||||||
// Prepare the result
|
// Prepare the result
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ use Exception;
|
|||||||
use G;
|
use G;
|
||||||
use Luracast\Restler\RestException;
|
use Luracast\Restler\RestException;
|
||||||
use Menu;
|
use Menu;
|
||||||
use ProcessMaker\BusinessModel\Cases\CasesList;
|
|
||||||
use ProcessMaker\BusinessModel\Cases\Draft;
|
use ProcessMaker\BusinessModel\Cases\Draft;
|
||||||
use ProcessMaker\BusinessModel\Cases\Filter;
|
use ProcessMaker\BusinessModel\Cases\Filter;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\Home as BMHome;
|
||||||
use ProcessMaker\BusinessModel\Cases\Inbox;
|
use ProcessMaker\BusinessModel\Cases\Inbox;
|
||||||
use ProcessMaker\BusinessModel\Cases\Participated;
|
use ProcessMaker\BusinessModel\Cases\Participated;
|
||||||
use ProcessMaker\BusinessModel\Cases\Paused;
|
use ProcessMaker\BusinessModel\Cases\Paused;
|
||||||
@@ -60,7 +60,7 @@ class Home extends Api
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws RestException
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @class AccessControl {@permission PM_CASES}
|
* @class AccessControl {@permission PM_CASES}
|
||||||
@@ -74,30 +74,11 @@ class Home extends Api
|
|||||||
string $caseTitle = '',
|
string $caseTitle = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$list = new Draft();
|
$bmHome = new BMHome($this->getUserId());
|
||||||
// Define the filters to apply
|
return $bmHome->getDraft(...func_get_args());
|
||||||
$properties = [];
|
|
||||||
$properties['caseNumber'] = $caseNumber;
|
|
||||||
$properties['caseTitle'] = $caseTitle;
|
|
||||||
$properties['filterCases'] = $filterCases;
|
|
||||||
$properties['process'] = $process;
|
|
||||||
$properties['task'] = $task;
|
|
||||||
// Get the user that access to the API
|
|
||||||
$usrUid = $this->getUserId();
|
|
||||||
$properties['user'] = !empty($usrUid) ? User::getId($usrUid) : 0;
|
|
||||||
$properties['start'] = $offset;
|
|
||||||
$properties['limit'] = $limit;
|
|
||||||
// Set the sort parameters
|
|
||||||
$sort = explode(',', $sort);
|
|
||||||
$properties['sort'] = $sort[0];
|
|
||||||
$properties['dir'] = $sort[1];
|
|
||||||
$list->setProperties($properties);
|
|
||||||
$result = [];
|
|
||||||
$result['data'] = DateTime::convertUtcToTimeZone($list->getData());
|
|
||||||
$result['total'] = $list->getPagingCounters();
|
|
||||||
return $result;
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
}
|
}
|
||||||
@@ -121,7 +102,7 @@ class Home extends Api
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws RestException
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @class AccessControl {@permission PM_CASES}
|
* @class AccessControl {@permission PM_CASES}
|
||||||
@@ -137,32 +118,11 @@ class Home extends Api
|
|||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$list = new Inbox();
|
$bmHome = new BMHome($this->getUserId());
|
||||||
// Define the filters to apply
|
return $bmHome->getInbox(...func_get_args());
|
||||||
$properties = [];
|
|
||||||
$properties['caseNumber'] = $caseNumber;
|
|
||||||
$properties['caseTitle'] = $caseTitle;
|
|
||||||
$properties['delegateFrom'] = $delegateFrom;
|
|
||||||
$properties['delegateTo'] = $delegateTo;
|
|
||||||
$properties['filterCases'] = $filterCases;
|
|
||||||
$properties['process'] = $process;
|
|
||||||
$properties['task'] = $task;
|
|
||||||
// Get the user that access to the API
|
|
||||||
$usrUid = $this->getUserId();
|
|
||||||
$properties['user'] = !empty($usrUid) ? User::getId($usrUid) : 0;
|
|
||||||
$properties['start'] = $offset;
|
|
||||||
$properties['limit'] = $limit;
|
|
||||||
// Set the pagination parameters
|
|
||||||
$sort = explode(',', $sort);
|
|
||||||
$properties['sort'] = $sort[0];
|
|
||||||
$properties['dir'] = $sort[1];
|
|
||||||
$list->setProperties($properties);
|
|
||||||
$result = [];
|
|
||||||
$result['data'] = DateTime::convertUtcToTimeZone($list->getData());
|
|
||||||
$result['total'] = $list->getPagingCounters();
|
|
||||||
return $result;
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
}
|
}
|
||||||
@@ -186,7 +146,7 @@ class Home extends Api
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws RestException
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @class AccessControl {@permission PM_CASES}
|
* @class AccessControl {@permission PM_CASES}
|
||||||
@@ -202,34 +162,11 @@ class Home extends Api
|
|||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$list = new Unassigned();
|
$bmHome = new BMHome($this->getUserId());
|
||||||
// Define the filters to apply
|
return $bmHome->getUnassigned(...func_get_args());
|
||||||
$properties = [];
|
|
||||||
$properties['caseNumber'] = $caseNumber;
|
|
||||||
$properties['caseTitle'] = $caseTitle;
|
|
||||||
$properties['delegateFrom'] = $delegateFrom;
|
|
||||||
$properties['delegateTo'] = $delegateTo;
|
|
||||||
$properties['filterCases'] = $filterCases;
|
|
||||||
$properties['process'] = $process;
|
|
||||||
$properties['task'] = $task;
|
|
||||||
// Get the user that access to the API
|
|
||||||
$usrUid = $this->getUserId();
|
|
||||||
$properties['user'] = !empty($usrUid) ? User::getId($usrUid) : 0;
|
|
||||||
$properties['start'] = $offset;
|
|
||||||
$properties['limit'] = $limit;
|
|
||||||
// Set the sort parameters
|
|
||||||
$sort = explode(',', $sort);
|
|
||||||
$properties['sort'] = $sort[0];
|
|
||||||
$properties['dir'] = $sort[1];
|
|
||||||
// todo: some queries related to the unassigned are using the USR_UID
|
|
||||||
$list->setUserUid($usrUid);
|
|
||||||
$list->setProperties($properties);
|
|
||||||
$result = [];
|
|
||||||
$result['data'] = DateTime::convertUtcToTimeZone($list->getData());
|
|
||||||
$result['total'] = $list->getPagingCounters();
|
|
||||||
return $result;
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
}
|
}
|
||||||
@@ -253,7 +190,7 @@ class Home extends Api
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws RestException
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @class AccessControl {@permission PM_CASES}
|
* @class AccessControl {@permission PM_CASES}
|
||||||
@@ -269,32 +206,171 @@ class Home extends Api
|
|||||||
string $delegateTo = '',
|
string $delegateTo = '',
|
||||||
string $filterCases = '',
|
string $filterCases = '',
|
||||||
string $sort = 'APP_NUMBER,DESC'
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$list = new Paused();
|
$bmHome = new BMHome($this->getUserId());
|
||||||
// Define the filters to apply
|
return $bmHome->getPaused(...func_get_args());
|
||||||
$properties = [];
|
} catch (Exception $e) {
|
||||||
$properties['caseNumber'] = $caseNumber;
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
$properties['caseTitle'] = $caseTitle;
|
}
|
||||||
$properties['delegateFrom'] = $delegateFrom;
|
}
|
||||||
$properties['delegateTo'] = $delegateTo;
|
|
||||||
$properties['filterCases'] = $filterCases;
|
/**
|
||||||
$properties['process'] = $process;
|
* Get the custom draft cases.
|
||||||
$properties['task'] = $task;
|
* @url GET /draft/:id
|
||||||
// Get the user that access to the API
|
* @param int $id
|
||||||
$usrUid = $this->getUserId();
|
* @param int $caseNumber
|
||||||
$properties['user'] = !empty($usrUid) ? User::getId($usrUid) : 0;
|
* @param int $process
|
||||||
$properties['start'] = $offset;
|
* @param int $task
|
||||||
$properties['limit'] = $limit;
|
* @param int $limit
|
||||||
// Set the sort parameters
|
* @param int $offset
|
||||||
$sort = explode(',', $sort);
|
* @param string $caseTitle
|
||||||
$properties['sort'] = $sort[0];
|
* @param string $filterCases
|
||||||
$properties['dir'] = $sort[1];
|
* @param string $sort
|
||||||
$list->setProperties($properties);
|
* @return array
|
||||||
$result = [];
|
* @throws RestException
|
||||||
$result['data'] = DateTime::convertUtcToTimeZone($list->getData());
|
* @access protected
|
||||||
$result['total'] = $list->getPagingCounters();
|
* @class AccessControl {@permission PM_CASES}
|
||||||
return $result;
|
*/
|
||||||
|
public function doGetCustomDraftCases(
|
||||||
|
int $id,
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$bmHome = new BMHome($this->getUserId());
|
||||||
|
return $bmHome->getCustomDraft(...func_get_args());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the custom inbox cases.
|
||||||
|
* @url GET /inbox/:id
|
||||||
|
* @param int $id
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $delegateFrom
|
||||||
|
* @param string $delegateTo
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @return array
|
||||||
|
* @throws RestException
|
||||||
|
* @access protected
|
||||||
|
* @class AccessControl {@permission PM_CASES}
|
||||||
|
*/
|
||||||
|
public function doGetCustomTodoCases(
|
||||||
|
int $id,
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $delegateFrom = '',
|
||||||
|
string $delegateTo = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$bmHome = new BMHome($this->getUserId());
|
||||||
|
return $bmHome->getCustomInbox(...func_get_args());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the custom unassigned cases.
|
||||||
|
* @url GET /unassigned/:id
|
||||||
|
* @param int $id
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $delegateFrom
|
||||||
|
* @param string $delegateTo
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @return array
|
||||||
|
* @throws RestException
|
||||||
|
* @access protected
|
||||||
|
* @class AccessControl {@permission PM_CASES}
|
||||||
|
*/
|
||||||
|
public function doGetCustomUnassignedCases(
|
||||||
|
int $id,
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $delegateFrom = '',
|
||||||
|
string $delegateTo = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$bmHome = new BMHome($this->getUserId());
|
||||||
|
return $bmHome->getCustomUnassigned(...func_get_args());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the custom paused cases.
|
||||||
|
* @url GET /paused/:id
|
||||||
|
* @param int $id
|
||||||
|
* @param int $caseNumber
|
||||||
|
* @param int $process
|
||||||
|
* @param int $task
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @param string $caseTitle
|
||||||
|
* @param string $delegateFrom
|
||||||
|
* @param string $delegateTo
|
||||||
|
* @param string $filterCases
|
||||||
|
* @param string $sort
|
||||||
|
* @return array
|
||||||
|
* @throws RestException
|
||||||
|
* @access protected
|
||||||
|
* @class AccessControl {@permission PM_CASES}
|
||||||
|
*/
|
||||||
|
public function doGetCustomPausedCases(
|
||||||
|
int $id,
|
||||||
|
int $caseNumber = 0,
|
||||||
|
int $process = 0,
|
||||||
|
int $task = 0,
|
||||||
|
int $limit = 15,
|
||||||
|
int $offset = 0,
|
||||||
|
string $caseTitle = '',
|
||||||
|
string $delegateFrom = '',
|
||||||
|
string $delegateTo = '',
|
||||||
|
string $filterCases = '',
|
||||||
|
string $sort = 'APP_NUMBER,DESC'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$bmHome = new BMHome($this->getUserId());
|
||||||
|
return $bmHome->getCustomPaused(...func_get_args());
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user