PMCORE-3542
This commit is contained in:
@@ -64,14 +64,15 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function
|
||||
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
|
||||
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
|
||||
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
|
||||
$index = $faker->unique()->numberBetween(2000);
|
||||
|
||||
// Return with default values
|
||||
return [
|
||||
'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
|
||||
'APP_UID' => $application->APP_UID,
|
||||
'DEL_INDEX' => $faker->unique()->numberBetween(2000),
|
||||
'DEL_INDEX' => $index,
|
||||
'APP_NUMBER' => $application->APP_NUMBER,
|
||||
'DEL_PREVIOUS' => 0,
|
||||
'DEL_PREVIOUS' => $index - 1,
|
||||
'PRO_UID' => $process->PRO_UID,
|
||||
'TAS_UID' => $task->TAS_UID,
|
||||
'USR_UID' => $user->USR_UID,
|
||||
|
||||
@@ -44,6 +44,7 @@ class InboxTest extends TestCase
|
||||
{
|
||||
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'DEL_THREAD_STATUS' => 'OPEN',
|
||||
'DEL_PREVIOUS' => 1,
|
||||
'DEL_INDEX' => 2,
|
||||
]);
|
||||
|
||||
@@ -118,6 +119,7 @@ class InboxTest extends TestCase
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setProcessId()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_process()
|
||||
@@ -126,9 +128,11 @@ class InboxTest extends TestCase
|
||||
$cases = $this->createInbox();
|
||||
// Create new Inbox object
|
||||
$inbox = new Inbox();
|
||||
// Apply filters
|
||||
$inbox->setUserId($cases->USR_ID);
|
||||
$inbox->setProcessId($cases->PRO_ID);
|
||||
$inbox->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $inbox->getData();
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
@@ -139,6 +143,7 @@ class InboxTest extends TestCase
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setCaseNumber()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_app_number()
|
||||
@@ -147,9 +152,11 @@ class InboxTest extends TestCase
|
||||
$cases = $this->createInbox();
|
||||
// Create new Inbox object
|
||||
$inbox = new Inbox();
|
||||
// Apply filters
|
||||
$inbox->setUserId($cases->USR_ID);
|
||||
$inbox->setCaseNumber($cases->APP_NUMBER);
|
||||
$inbox->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $inbox->getData();
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
@@ -160,6 +167,7 @@ class InboxTest extends TestCase
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setCasesNumbers()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_specific_cases()
|
||||
@@ -168,9 +176,11 @@ class InboxTest extends TestCase
|
||||
$cases = $this->createInbox();
|
||||
// Create new Inbox object
|
||||
$inbox = new Inbox();
|
||||
// Apply filters
|
||||
$inbox->setUserId($cases->USR_ID);
|
||||
$inbox->setCasesNumbers([$cases->APP_NUMBER]);
|
||||
$inbox->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $inbox->getData();
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
@@ -181,6 +191,8 @@ class InboxTest extends TestCase
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setCasesNumbers()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setRangeCasesFromTo()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_range_cases()
|
||||
@@ -189,10 +201,13 @@ class InboxTest extends TestCase
|
||||
$cases = $this->createInbox();
|
||||
// Create new Inbox object
|
||||
$inbox = new Inbox();
|
||||
// Apply filters
|
||||
$inbox->setUserId($cases->USR_ID);
|
||||
$rangeOfCases = $cases->APP_NUMBER . "-" . $cases->APP_NUMBER;
|
||||
$inbox->setCasesNumbers([$cases->APP_NUMBER]);
|
||||
$inbox->setRangeCasesFromTo([$rangeOfCases]);
|
||||
$inbox->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $inbox->getData();
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
@@ -212,18 +227,46 @@ class InboxTest extends TestCase
|
||||
$cases = $this->createInbox();
|
||||
// Create new Inbox object
|
||||
$inbox = new Inbox();
|
||||
// Apply filters
|
||||
$inbox->setUserId($cases->USR_ID);
|
||||
$inbox->setTaskId($cases->TAS_ID);
|
||||
// Call to getData method
|
||||
$res = $inbox->getData();
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getData method with setDelegateFrom and setDelegateTo filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setDelegateFrom()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setDelegateTo()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_delegate_from_to()
|
||||
{
|
||||
// Create factories related to the to_do cases
|
||||
$cases = $this->createInbox();
|
||||
// Create new Inbox object
|
||||
$inbox = new Inbox();
|
||||
// Apply filters
|
||||
$inbox->setUserId($cases->USR_ID);
|
||||
$inbox->setDelegateFrom($cases->DEL_DELEGATE_DATE->format("Y-m-d"));
|
||||
$inbox->setDelegateTo($cases->DEL_DELEGATE_DATE->format("Y-m-d"));
|
||||
// Call to getData method
|
||||
$res = $inbox->getData();
|
||||
$this->assertEmpty($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getData method with case title filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setCaseTitle()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_thread_title()
|
||||
@@ -245,12 +288,44 @@ class InboxTest extends TestCase
|
||||
$this->assertNotEmpty($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getData method with send by filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setSendBy()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_send_by()
|
||||
{
|
||||
// Create factories related to the to_do cases
|
||||
$cases = $this->createInbox();
|
||||
// Create the previous thread with the same user
|
||||
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
|
||||
'APP_NUMBER' => $cases->APP_NUMBER,
|
||||
'APP_UID' => $cases->APP_UID,
|
||||
'USR_ID' => $cases->USR_ID,
|
||||
'DEL_THREAD_STATUS' => 'CLOSED',
|
||||
'DEL_INDEX' => 1,
|
||||
]);
|
||||
// Create new Inbox object
|
||||
$inbox = new Inbox();
|
||||
// Apply filters
|
||||
$inbox->setUserId($cases->USR_ID);
|
||||
$inbox->setSendBy($cases->USR_ID);
|
||||
// Call to getData method
|
||||
$res = $inbox->getData();
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getData method using order by column
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::filters()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Inbox::setOrderByColumn()
|
||||
* @test
|
||||
*/
|
||||
public function it_order_by_column()
|
||||
|
||||
@@ -201,7 +201,7 @@ class PausedTest extends TestCase
|
||||
* It tests the getData method without filters
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
|
||||
* @covers \ProcessMaker\Model\Delegation::scopePaused()
|
||||
* @test
|
||||
*/
|
||||
@@ -225,7 +225,7 @@ class PausedTest extends TestCase
|
||||
* It tests the getData method with case number filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
|
||||
* @test
|
||||
*/
|
||||
@@ -251,7 +251,7 @@ class PausedTest extends TestCase
|
||||
* It tests the getData method with case number filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
|
||||
* @test
|
||||
*/
|
||||
@@ -277,7 +277,7 @@ class PausedTest extends TestCase
|
||||
* It tests the getData method with taskId filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
|
||||
* @test
|
||||
*/
|
||||
@@ -303,7 +303,7 @@ class PausedTest extends TestCase
|
||||
* It tests the getData method with processId filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
|
||||
* @test
|
||||
*/
|
||||
@@ -328,7 +328,7 @@ class PausedTest extends TestCase
|
||||
* It tests the getData method with case title filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
|
||||
* @test
|
||||
*/
|
||||
@@ -348,6 +348,51 @@ class PausedTest extends TestCase
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getData method with setDelegateFrom and setDelegateTo filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_delegate_from_to()
|
||||
{
|
||||
// Create factories related to the paused cases
|
||||
$cases = $this->createPaused();
|
||||
// Create new Paused object
|
||||
$paused = new Paused();
|
||||
$paused->setUserUid($cases->USR_UID);
|
||||
$paused->setUserId($cases->USR_ID);
|
||||
$paused->setDelegateFrom($cases->DEL_DELEGATE_DATE->format("Y-m-d"));
|
||||
$paused->setDelegateTo($cases->DEL_DELEGATE_DATE->format("Y-m-d"));
|
||||
// Get data
|
||||
$res = $paused->getData();
|
||||
$this->assertEmpty($res);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* It tests the getData method with send by filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::filters()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Paused::setSendBy()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_send_by()
|
||||
{
|
||||
// Create factories related to the to_do cases
|
||||
$cases = $this->createPaused();
|
||||
// Create new Paused object
|
||||
$paused = new Paused();
|
||||
$paused->setUserId($cases->USR_ID);
|
||||
$paused->setSendBy($cases->USR_ID);
|
||||
$res = $paused->getData();
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getCounter() method
|
||||
*
|
||||
|
||||
@@ -211,6 +211,7 @@ class UnassignedTest extends TestCase
|
||||
$cases = $this->createSelfServiceUserOrGroup();
|
||||
//Review the count self-service
|
||||
$unassigned = new Unassigned;
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$unassigned->setUserId($cases['delegation']->USR_ID);
|
||||
$result = $unassigned->getCounter();
|
||||
@@ -229,6 +230,7 @@ class UnassignedTest extends TestCase
|
||||
$cases = $this->createSelfServiceByVariable();
|
||||
//Review the count self-service
|
||||
$unassigned = new Unassigned;
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($cases['user']->USR_UID);
|
||||
$unassigned->setUserId($cases['delegation']->USR_ID);
|
||||
$result = $unassigned->getCounter();
|
||||
@@ -247,6 +249,7 @@ class UnassignedTest extends TestCase
|
||||
$cases = $this->createSelfServiceUserOrGroup(2);
|
||||
//Review the count self-service
|
||||
$unassigned = new Unassigned;
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$unassigned->setUserId($cases['delegation']->USR_ID);
|
||||
$result = $unassigned->getCounter();
|
||||
@@ -265,6 +268,7 @@ class UnassignedTest extends TestCase
|
||||
$cases = $this->createSelfServiceByVariable(2, false);
|
||||
//Review the count self-service
|
||||
$unassigned = new Unassigned;
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($cases['user']->USR_UID);
|
||||
$unassigned->setUserId($cases['delegation']->USR_ID);
|
||||
$result = $unassigned->getCounter();
|
||||
@@ -284,10 +288,12 @@ class UnassignedTest extends TestCase
|
||||
$casesGroup = $this->createSelfServiceUserOrGroup(2);
|
||||
//Review the count self-service
|
||||
$unassigned = new Unassigned;
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($casesUser['taskUser']->USR_UID);
|
||||
$unassigned->setUserId($casesUser['delegation']->USR_ID);
|
||||
$result = $unassigned->getCounter();
|
||||
$this->assertNotEmpty($result);
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($casesGroup['taskUser']->USR_UID);
|
||||
$unassigned->setUserId($casesGroup['delegation']->USR_ID);
|
||||
$result = $unassigned->getCounter();
|
||||
@@ -307,11 +313,13 @@ class UnassignedTest extends TestCase
|
||||
$casesGroup = $this->createSelfServiceByVariable(2, false);
|
||||
// Review the count self-service
|
||||
$unassigned = new Unassigned;
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($casesUser['user']->USR_UID);
|
||||
$unassigned->setUserId($casesUser['delegation']->USR_ID);
|
||||
$result = $unassigned->getCounter();
|
||||
$this->assertNotEmpty($result);
|
||||
$unassigned = new Unassigned;
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($casesGroup['user']->USR_UID);
|
||||
$unassigned->setUserId($casesGroup['delegation']->USR_ID);
|
||||
$result = $unassigned->getCounter();
|
||||
@@ -331,9 +339,34 @@ class UnassignedTest extends TestCase
|
||||
$cases = $this->createSelfServiceUserOrGroup();
|
||||
// Create new object
|
||||
$unassigned = new Unassigned();
|
||||
// Set the user UID
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$unassigned->setUserId($cases['delegation']->USR_ID);
|
||||
// Set OrderByColumn value
|
||||
$unassigned->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
$res = $unassigned->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures get data from self-service-user-assigned with filter setCasesNumbers
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::filters()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_case_numbers()
|
||||
{
|
||||
// Create factories related to the unassigned cases
|
||||
$cases = $this->createSelfServiceUserOrGroup();
|
||||
// Create new object
|
||||
$unassigned = new Unassigned();
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$unassigned->setUserId($cases['delegation']->USR_ID);
|
||||
$unassigned->setCasesNumbers([$cases['delegation']->APP_NUMBER]);
|
||||
// Set OrderBYColumn value
|
||||
$unassigned->setOrderByColumn('APP_NUMBER');
|
||||
// Call to getData method
|
||||
@@ -342,6 +375,54 @@ class UnassignedTest extends TestCase
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures get data from self-service-user-assigned with filter setRangeCasesFromTo
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::filters()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_range_cases()
|
||||
{
|
||||
// Create factories related to the unassigned cases
|
||||
$cases = $this->createSelfServiceUserOrGroup();
|
||||
// Create new object
|
||||
$unassigned = new Unassigned();
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$unassigned->setUserId($cases['delegation']->USR_ID);
|
||||
$rangeOfCases = $cases['delegation']->APP_NUMBER . "-" . $cases['delegation']->APP_NUMBER;
|
||||
$unassigned->setRangeCasesFromTo([$rangeOfCases]);
|
||||
// Call to getData method
|
||||
$res = $unassigned->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
$this->assertNotEmpty($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* This ensures get data from self-service-user-assigned with setDelegateFrom and setDelegateTo filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::filters()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_delegate_from_to()
|
||||
{
|
||||
// Create factories related to the unassigned cases
|
||||
$cases = $this->createSelfServiceUserOrGroup();
|
||||
// Create new object
|
||||
$unassigned = new Unassigned();
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($cases['taskUser']->USR_UID);
|
||||
$unassigned->setUserId($cases['delegation']->USR_ID);
|
||||
$unassigned->setDelegateFrom(date('Y-m-d'));
|
||||
$unassigned->setDelegateTo(date('Y-m-d'));
|
||||
// Call to getData method
|
||||
$res = $unassigned->getData();
|
||||
// This assert that the expected numbers of results are returned
|
||||
$this->assertEmpty($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getData method with case title filter
|
||||
*
|
||||
@@ -361,9 +442,9 @@ class UnassignedTest extends TestCase
|
||||
DB::commit();
|
||||
// Create new Unassigned object
|
||||
$unassigned = new Unassigned();
|
||||
// Apply filters
|
||||
$unassigned->setUserUid($usrUid);
|
||||
$unassigned->setUserId($usrId);
|
||||
// Set the title
|
||||
$unassigned->setCaseTitle($title);
|
||||
// Get the data
|
||||
$res = $unassigned->getData();
|
||||
|
||||
@@ -34,28 +34,28 @@ class TaskTest extends TestCase
|
||||
]);
|
||||
$taskInstance = new Task();
|
||||
$title = $taskInstance->title($task->TAS_ID);
|
||||
$this->assertEquals($title, G::LoadTranslation('ID_INTERMEDIATE_THROW_EMAIL_EVENT'));
|
||||
$this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_THROW_EMAIL_EVENT'));
|
||||
// Intermediate throw message event
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_TITLE' => 'INTERMEDIATE-THROW-MESSAGE-EVENT'
|
||||
]);
|
||||
$taskInstance = new Task();
|
||||
$title = $taskInstance->title($task->TAS_ID);
|
||||
$this->assertEquals($title, G::LoadTranslation('ID_INTERMEDIATE_THROW_MESSAGE_EVENT'));
|
||||
$this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_THROW_MESSAGE_EVENT'));
|
||||
// Intermediate catch message event
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_TITLE' => 'INTERMEDIATE-CATCH-MESSAGE-EVENT'
|
||||
]);
|
||||
$taskInstance = new Task();
|
||||
$title = $taskInstance->title($task->TAS_ID);
|
||||
$this->assertEquals($title, G::LoadTranslation('ID_INTERMEDIATE_CATCH_MESSAGE_EVENT'));
|
||||
$this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_CATCH_MESSAGE_EVENT'));
|
||||
// Intermediate timer event
|
||||
$task = factory(Task::class)->create([
|
||||
'TAS_TITLE' => 'INTERMEDIATE-CATCH-TIMER-EVENT'
|
||||
]);
|
||||
$taskInstance = new Task();
|
||||
$title = $taskInstance->title($task->TAS_ID);
|
||||
$this->assertEquals($title, G::LoadTranslation('ID_INTERMEDIATE_CATCH_TIMER_EVENT'));
|
||||
$this->assertEquals($title['title'], G::LoadTranslation('ID_INTERMEDIATE_CATCH_TIMER_EVENT'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24383,6 +24383,12 @@ msgstr "Screen Color Icon"
|
||||
msgid "Script Task"
|
||||
msgstr "Script Task"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SCRIPT_TASK_UNTITLED
|
||||
#: LABEL/ID_SCRIPT_TASK_UNTITLED
|
||||
msgid "Untitled - Script Task"
|
||||
msgstr "Untitled - Script Task"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SCRIPT_TASK_ACTIVITY_ALREADY_REGISTERED
|
||||
#: LABEL/ID_SCRIPT_TASK_ACTIVITY_ALREADY_REGISTERED
|
||||
@@ -24965,6 +24971,18 @@ msgstr "Server reported"
|
||||
msgid "Service"
|
||||
msgstr "Service"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SERVICE_TASK
|
||||
#: LABEL/ID_SERVICE_TASK
|
||||
msgid "Service Task"
|
||||
msgstr "Service Task"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SERVICE_TASK_UNTITLED
|
||||
#: LABEL/ID_SERVICE_TASKUNTITLED
|
||||
msgid "Untitled - Service Task"
|
||||
msgstr "Untitled - Service Task"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SESSION
|
||||
#: LABEL/ID_SESSION
|
||||
|
||||
@@ -60988,6 +60988,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_SCHEMA','en','Schema','2014-01-15') ,
|
||||
( 'LABEL','ID_SCREEN_COLOR_ICON','en','Screen Color Icon','2021-08-10') ,
|
||||
( 'LABEL','ID_SCRIPT_TASK','en','Script Task','2015-10-19') ,
|
||||
( 'LABEL','ID_SCRIPT_TASK_UNTITLED','en','Untitled - Script Task','2021-11-23') ,
|
||||
( 'LABEL','ID_SCRIPT_TASK_ACTIVITY_ALREADY_REGISTERED','en','The Script-Task with {0}: "{1}" already registered','2016-08-01') ,
|
||||
( 'LABEL','ID_SEARCH','en','Search','2014-01-15') ,
|
||||
( 'LABEL','ID_SEARCHING','en','Searching...','2019-05-03') ,
|
||||
@@ -61090,6 +61091,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_SERVER_PROTOCOL','en','Server Protocol','2014-01-15') ,
|
||||
( 'LABEL','ID_SERVER_REPORTED','en','Server reported','2014-01-15') ,
|
||||
( 'LABEL','ID_SERVICE','en','Service','2014-01-15') ,
|
||||
( 'LABEL','ID_SERVICE_TASK','en','Service','2021-11-23') ,
|
||||
( 'LABEL','ID_SERVICE_TASK_UNTITLED','en','Service','2021-11-23') ,
|
||||
( 'LABEL','ID_SESSION','en','Session','2014-01-15') ,
|
||||
( 'LABEL','ID_SESSION_ACTIVE','en','Session active','2014-01-15') ,
|
||||
( 'LABEL','ID_SESSION_DIRECTORY','en','Session directory','2015-11-05') ,
|
||||
|
||||
@@ -78,8 +78,7 @@ if (
|
||||
|
||||
// Get the label of previous task
|
||||
if (!empty($fieldsDelegation['TAS_ID'])) {
|
||||
$taskInstance = new ModelTask();
|
||||
$fieldsCase['PREVIOUS_TASK'] = $taskInstance->title($fieldsDelegation['TAS_ID']);
|
||||
$fieldsCase['PREVIOUS_TASK'] = ModelTask::title($fieldsDelegation['TAS_ID'])['title'];
|
||||
}
|
||||
|
||||
// To enable information (dynaforms, steps) before claim a case
|
||||
|
||||
@@ -6,6 +6,7 @@ use G;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
class Draft extends AbstractCases
|
||||
@@ -127,10 +128,25 @@ class Draft extends AbstractCases
|
||||
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
||||
// Get the send by related to the previous index
|
||||
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
|
||||
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||
$userInfo = [];
|
||||
$dummyInfo = [];
|
||||
if (!empty($previousThread)) {
|
||||
// When the task has an user
|
||||
$userInfo = ($previousThread['USR_ID'] !== 0) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||
// When the task does not have users refers to dummy task
|
||||
$taskInfo = ($previousThread['USR_ID'] === 0) ? Task::title($previousThread['TAS_ID']) : [];
|
||||
if (!empty($taskInfo)) {
|
||||
$dummyInfo = [
|
||||
'task_id' => $previousThread['TAS_ID'],
|
||||
'name' => $taskInfo['title'],
|
||||
'type' => $taskInfo['type']
|
||||
];
|
||||
}
|
||||
}
|
||||
$result = [];
|
||||
$result['del_previous'] = $item['DEL_PREVIOUS'];
|
||||
$result['user_tooltip'] = $userInfo;
|
||||
$result['dummy_task'] = $dummyInfo;
|
||||
$item['SEND_BY_INFO'] = $result;
|
||||
|
||||
return $item;
|
||||
|
||||
@@ -6,6 +6,7 @@ use G;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
class Inbox extends AbstractCases
|
||||
@@ -81,7 +82,6 @@ class Inbox extends AbstractCases
|
||||
if (!empty($this->getCaseUid())) {
|
||||
$query->appUid($this->getCaseUid());
|
||||
}
|
||||
|
||||
// Specific delegate date from
|
||||
if (!empty($this->getDelegateFrom())) {
|
||||
$query->delegateDateFrom($this->getDelegateFrom());
|
||||
@@ -90,8 +90,7 @@ class Inbox extends AbstractCases
|
||||
if (!empty($this->getDelegateTo())) {
|
||||
$query->delegateDateTo($this->getDelegateTo());
|
||||
}
|
||||
|
||||
// Specific usrId represented by sendBy.
|
||||
// Specific usrId represented by sendBy
|
||||
if (!empty($this->getSendBy())) {
|
||||
$query->sendBy($this->getSendBy());
|
||||
}
|
||||
@@ -113,7 +112,7 @@ class Inbox extends AbstractCases
|
||||
// Join with users
|
||||
$query->joinUser();
|
||||
// Join with task
|
||||
$query->JoinTask();
|
||||
$query->joinTask();
|
||||
// Join with application for add the initial scope for TO_DO cases
|
||||
$query->inbox($this->getUserId());
|
||||
/** Apply filters */
|
||||
@@ -147,10 +146,25 @@ class Inbox extends AbstractCases
|
||||
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
||||
// Get the send by related to the previous index
|
||||
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
|
||||
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||
$userInfo = [];
|
||||
$dummyInfo = [];
|
||||
if (!empty($previousThread)) {
|
||||
// When the task has an user
|
||||
$userInfo = ($previousThread['USR_ID'] !== 0) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||
// When the task does not have users refers to dummy task
|
||||
$taskInfo = ($previousThread['USR_ID'] === 0) ? Task::title($previousThread['TAS_ID']) : [];
|
||||
if (!empty($taskInfo)) {
|
||||
$dummyInfo = [
|
||||
'task_id' => $previousThread['TAS_ID'],
|
||||
'name' => $taskInfo['title'],
|
||||
'type' => $taskInfo['type']
|
||||
];
|
||||
}
|
||||
}
|
||||
$result = [];
|
||||
$result['del_previous'] = $item['DEL_PREVIOUS'];
|
||||
$result['user_tooltip'] = $userInfo;
|
||||
$result['dummy_task'] = $dummyInfo;
|
||||
$item['SEND_BY_INFO'] = $result;
|
||||
|
||||
return $item;
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel\Cases;
|
||||
use G;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
class Paused extends AbstractCases
|
||||
@@ -80,7 +81,6 @@ class Paused extends AbstractCases
|
||||
if (!empty($this->getCaseUid())) {
|
||||
$query->appUid($this->getCaseUid());
|
||||
}
|
||||
|
||||
// Specific delegate date from
|
||||
if (!empty($this->getDelegateFrom())) {
|
||||
$query->delegateDateFrom($this->getDelegateFrom());
|
||||
@@ -89,8 +89,7 @@ class Paused extends AbstractCases
|
||||
if (!empty($this->getDelegateTo())) {
|
||||
$query->delegateDateTo($this->getDelegateTo());
|
||||
}
|
||||
|
||||
// Specific usrId represented by sendBy.
|
||||
// Specific usrId represented by sendBy
|
||||
if (!empty($this->getSendBy())) {
|
||||
$query->sendBy($this->getSendBy());
|
||||
}
|
||||
@@ -109,7 +108,7 @@ class Paused extends AbstractCases
|
||||
// Join with process
|
||||
$query->joinProcess();
|
||||
// Join with task
|
||||
$query->JoinTask();
|
||||
$query->joinTask();
|
||||
// Scope that set the paused cases
|
||||
$query->paused($this->getUserId());
|
||||
/** Apply filters */
|
||||
@@ -141,10 +140,25 @@ class Paused extends AbstractCases
|
||||
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
||||
// Get the send by related to the previous index
|
||||
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
|
||||
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||
$userInfo = [];
|
||||
$dummyInfo = [];
|
||||
if (!empty($previousThread)) {
|
||||
// When the task has an user
|
||||
$userInfo = ($previousThread['USR_ID'] !== 0) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||
// When the task does not have users refers to dummy task
|
||||
$taskInfo = ($previousThread['USR_ID'] === 0) ? Task::title($previousThread['TAS_ID']) : [];
|
||||
if (!empty($taskInfo)) {
|
||||
$dummyInfo = [
|
||||
'task_id' => $previousThread['TAS_ID'],
|
||||
'name' => $taskInfo['title'],
|
||||
'type' => $taskInfo['type']
|
||||
];
|
||||
}
|
||||
}
|
||||
$result = [];
|
||||
$result['del_previous'] = $item['DEL_PREVIOUS'];
|
||||
$result['user_tooltip'] = $userInfo;
|
||||
$result['dummy_task'] = $dummyInfo;
|
||||
$item['SEND_BY_INFO'] = $result;
|
||||
|
||||
return $item;
|
||||
|
||||
@@ -6,6 +6,7 @@ use G;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\CaseList;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
class Unassigned extends AbstractCases
|
||||
@@ -90,8 +91,7 @@ class Unassigned extends AbstractCases
|
||||
if (!empty($this->getDelegateTo())) {
|
||||
$query->delegateDateTo($this->getDelegateTo());
|
||||
}
|
||||
|
||||
// Specific usrId represented by sendBy.
|
||||
// Specific usrId represented by sendBy
|
||||
if (!empty($this->getSendBy())) {
|
||||
$query->sendBy($this->getSendBy());
|
||||
}
|
||||
@@ -149,10 +149,25 @@ class Unassigned extends AbstractCases
|
||||
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
||||
// Get the send by related to the previous index
|
||||
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
|
||||
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||
$userInfo = [];
|
||||
$dummyInfo = [];
|
||||
if (!empty($previousThread)) {
|
||||
// When the task has an user
|
||||
$userInfo = ($previousThread['USR_ID'] !== 0) ? User::getInformation($previousThread['USR_ID']) : [];
|
||||
// When the task does not have users refers to dummy task
|
||||
$taskInfo = ($previousThread['USR_ID'] === 0) ? Task::title($previousThread['TAS_ID']) : [];
|
||||
if (!empty($taskInfo)) {
|
||||
$dummyInfo = [
|
||||
'task_id' => $previousThread['TAS_ID'],
|
||||
'name' => $taskInfo['title'],
|
||||
'type' => $taskInfo['type']
|
||||
];
|
||||
}
|
||||
}
|
||||
$result = [];
|
||||
$result['del_previous'] = $item['DEL_PREVIOUS'];
|
||||
$result['user_tooltip'] = $userInfo;
|
||||
$result['dummy_task'] = $dummyInfo;
|
||||
$item['SEND_BY_INFO'] = $result;
|
||||
|
||||
return $item;
|
||||
|
||||
@@ -120,16 +120,18 @@ class Task extends Model
|
||||
*
|
||||
* @param integer $tasId
|
||||
*
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
public function title($tasId)
|
||||
public static function title($tasId)
|
||||
{
|
||||
$query = Task::query()->select('TAS_TITLE');
|
||||
$query = Task::query()->select('TAS_TITLE', 'TAS_TYPE');
|
||||
$query->where('TAS_ID', $tasId);
|
||||
$results = $query->get();
|
||||
$title = '';
|
||||
$results->each(function ($item, $key) use (&$title) {
|
||||
$type = '';
|
||||
$results->each(function ($item, $key) use (&$title, &$type) {
|
||||
$title = $item->TAS_TITLE;
|
||||
$type = $item->TAS_TYPE;
|
||||
switch ($title) {
|
||||
case "INTERMEDIATE-THROW-EMAIL-EVENT":
|
||||
$title = G::LoadTranslation('ID_INTERMEDIATE_THROW_EMAIL_EVENT');
|
||||
@@ -143,10 +145,37 @@ class Task extends Model
|
||||
case "INTERMEDIATE-CATCH-TIMER-EVENT":
|
||||
$title = G::LoadTranslation('ID_INTERMEDIATE_CATCH_TIMER_EVENT');
|
||||
break;
|
||||
case "SCRIPT-TASK":
|
||||
$title = G::LoadTranslation('ID_SCRIPT_TASK_UNTITLED');
|
||||
break;
|
||||
case "SERVICE-TASK":
|
||||
$title = G::LoadTranslation('ID_SERVICE_TASK_UNTITLED');
|
||||
break;
|
||||
}
|
||||
switch ($type) {
|
||||
case "INTERMEDIATE-THROW-EMAIL-EVENT":
|
||||
$type = G::LoadTranslation('ID_EMAIL_EVENT');
|
||||
break;
|
||||
case "INTERMEDIATE-THROW-MESSAGE-EVENT":
|
||||
case "INTERMEDIATE-CATCH-MESSAGE-EVENT":
|
||||
$type = G::LoadTranslation('ID_MESSAGE_EVENT');
|
||||
break;
|
||||
case "INTERMEDIATE-CATCH-TIMER-EVENT":
|
||||
$type = G::LoadTranslation('ID_TIMER_EVENT');
|
||||
break;
|
||||
case "SCRIPT-TASK":
|
||||
$type = G::LoadTranslation('ID_SCRIPT_TASK');
|
||||
break;
|
||||
case "SERVICE-TASK":
|
||||
$type = G::LoadTranslation('ID_SERVICE_TASK');
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
return $title;
|
||||
return [
|
||||
'title' => $title,
|
||||
'type' => $type,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user