Merged in feature/PMCORE-2536 (pull request #7623)
PMCORE-2536 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -25,8 +25,9 @@ $factory->define(\ProcessMaker\Model\Application::class, function(Faker $faker)
|
||||
'APP_CUR_USER' => $user->USR_UID,
|
||||
'APP_PIN' => G::generateUniqueID(),
|
||||
'APP_CREATE_DATE' => $faker->dateTime(),
|
||||
'APP_UPDATE_DATE' => $faker->dateTime(),
|
||||
'APP_INIT_DATE' => $faker->dateTime(),
|
||||
'APP_UPDATE_DATE' => $faker->dateTime(),
|
||||
'APP_FINISH_DATE' => $faker->dateTime(),
|
||||
'APP_DATA' => serialize(['APP_NUMBER' => $appNumber])
|
||||
];
|
||||
});
|
||||
@@ -59,8 +60,9 @@ $factory->state(\ProcessMaker\Model\Application::class, 'foreign_keys', function
|
||||
'APP_CUR_USER' => $user->USR_UID,
|
||||
'APP_PIN' => G::generateUniqueID(),
|
||||
'APP_CREATE_DATE' => $faker->dateTime(),
|
||||
'APP_UPDATE_DATE' => $faker->dateTime(),
|
||||
'APP_INIT_DATE' => $faker->dateTime(),
|
||||
'APP_UPDATE_DATE' => $faker->dateTime(),
|
||||
'APP_FINISH_DATE' => $faker->dateTime(),
|
||||
'APP_DATA' => serialize(['APP_NUMBER' => $appNumber])
|
||||
];
|
||||
});
|
||||
|
||||
@@ -678,11 +678,8 @@ class AbstractCasesTest extends TestCase
|
||||
'caseNumber' => rand(),
|
||||
'caseTitle' => G::generateUniqueID(),
|
||||
// Home - Search
|
||||
'priorities' => ['N'],
|
||||
'caseStatuses' => ['TO_DO','DRAFT'],
|
||||
'filterCases'=> '1,3-5,8,10-15',
|
||||
'delegationDateFrom' => date('Y-m-d'),
|
||||
'delegationDateTo' => date('Y-m-d'),
|
||||
// Home - My cases
|
||||
'filter'=> 'STARTED',
|
||||
'caseStatus' => 'TO_DO',
|
||||
@@ -691,8 +688,6 @@ class AbstractCasesTest extends TestCase
|
||||
'finishCaseFrom' => date('Y-m-d'),
|
||||
'finishCaseTo' => date('Y-m-d'),
|
||||
// Other
|
||||
'search' => G::generateUniqueID(),
|
||||
'category' => G::generateUniqueID(),
|
||||
'caseLink' => G::generateUniqueID(),
|
||||
'appUidCheck' => [G::generateUniqueID()],
|
||||
'sort' => 'APP_NUMBER',
|
||||
@@ -714,8 +709,6 @@ class AbstractCasesTest extends TestCase
|
||||
$actual = $absCases->getCaseTitle();
|
||||
$this->assertEquals($properties['caseTitle'], $actual);
|
||||
// Home - Search
|
||||
$actual = $absCases->getPriorities();
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getCaseStatuses();
|
||||
$this->assertNotEmpty($actual);
|
||||
$actual = $absCases->getFilterCases();
|
||||
@@ -724,28 +717,28 @@ class AbstractCasesTest extends TestCase
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getRangeCasesFromTo();
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getDelegateFrom();
|
||||
$actual = $absCases->getStartCaseFrom();
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getDelegateTo();
|
||||
$actual = $absCases->getStartCaseTo();
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getFinishCaseFrom();
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getFinishCaseTo();
|
||||
$this->assertEmpty($actual);
|
||||
// Home - My cases
|
||||
$actual = $absCases->getParticipatedStatus();
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getCaseStatus();
|
||||
$this->assertEquals(2, $actual);
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getStartCaseFrom();
|
||||
$this->assertEquals($properties['startCaseFrom'], $actual);
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getStartCaseTo();
|
||||
$this->assertEquals($properties['startCaseTo'], $actual);
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getFinishCaseFrom();
|
||||
$this->assertEquals($properties['finishCaseFrom'], $actual);
|
||||
$this->assertEmpty($actual);
|
||||
$actual = $absCases->getFinishCaseTo();
|
||||
$this->assertEquals($properties['finishCaseTo'], $actual);
|
||||
$this->assertEmpty($actual);
|
||||
// Other
|
||||
$actual = $absCases->getValueToSearch();
|
||||
$this->assertEquals($properties['search'], $actual);
|
||||
$actual = $absCases->getCategoryUid();
|
||||
$this->assertEquals($properties['category'], $actual);
|
||||
$actual = $absCases->getCaseUid();
|
||||
$this->assertEquals($properties['caseLink'], $actual);
|
||||
$actual = $absCases->getCasesUids();
|
||||
|
||||
@@ -44,7 +44,7 @@ class SearchTest extends TestCase
|
||||
* It tests the getData method without filters
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||
* @test
|
||||
*/
|
||||
public function it_get_result_without_filters()
|
||||
@@ -62,7 +62,7 @@ class SearchTest extends TestCase
|
||||
* It tests the getData with case number
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||
* @test
|
||||
*/
|
||||
@@ -84,7 +84,7 @@ class SearchTest extends TestCase
|
||||
* It tests the getData with process
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||
* @test
|
||||
*/
|
||||
@@ -106,7 +106,7 @@ class SearchTest extends TestCase
|
||||
* It tests the getData with task
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||
* @test
|
||||
*/
|
||||
@@ -128,7 +128,7 @@ class SearchTest extends TestCase
|
||||
* It tests the getData method with case title filter
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||
* @test
|
||||
*/
|
||||
@@ -153,7 +153,7 @@ class SearchTest extends TestCase
|
||||
* It tests the getData with user
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||
* @test
|
||||
*/
|
||||
@@ -175,17 +175,17 @@ class SearchTest extends TestCase
|
||||
* It tests the getData with priority
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getData()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Unassigned::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::getColumnsView()
|
||||
* @covers \ProcessMaker\BusinessModel\Cases\Search::filters()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_by_priority()
|
||||
public function it_filter_by_status()
|
||||
{
|
||||
// Create factories related to the delegation cases
|
||||
$cases = $this->createSearch();
|
||||
// Create new Search object
|
||||
$search = new Search();
|
||||
$search->setPriority('N');
|
||||
$search->setCaseStatuses(['TO_DO']);
|
||||
// Set order by column value
|
||||
$search->setOrderByColumn('APP_NUMBER');
|
||||
$result = $search->getData();
|
||||
|
||||
@@ -929,9 +929,9 @@ class UnassignedTest extends TestCase
|
||||
{
|
||||
// Create factories related to the unassigned cases
|
||||
$cases = $this->createSelfServiceUser();
|
||||
$usrUid = $cases->last()->USR_UID;
|
||||
$usrId = $cases->last()->USR_ID;
|
||||
$title = $cases->last()->DEL_TITLE;
|
||||
$usrUid = $cases['taskUser']->USR_UID;
|
||||
$usrId = $cases['delegation']->USR_ID;
|
||||
$title = $cases['delegation']->DEL_TITLE;
|
||||
// We need to commit the records inserted because is needed for the "fulltext" index
|
||||
DB::commit();
|
||||
// Create new Unassigned object
|
||||
|
||||
@@ -6,6 +6,7 @@ use Datetime;
|
||||
use Exception;
|
||||
use ProcessMaker\BusinessModel\Interfaces\CasesInterface;
|
||||
use ProcessMaker\BusinessModel\Validator;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
@@ -1091,33 +1092,60 @@ class AbstractCases implements CasesInterface
|
||||
/**
|
||||
* Get task color according the due date
|
||||
*
|
||||
* @param string $pending
|
||||
* @param string $pendingJson
|
||||
* @param bool $onlyTask
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function prepareTaskPending($pending)
|
||||
public function prepareTaskPending($pendingJson, $onlyTask = true)
|
||||
{
|
||||
$taskPending = json_decode($pending, true);
|
||||
$taskPending = json_decode($pendingJson, true);
|
||||
$result = [];
|
||||
$threadTasks = [];
|
||||
$threadUsers = [];
|
||||
$threadTitles = [];
|
||||
$i = 0;
|
||||
foreach ($taskPending as $thread) {
|
||||
foreach ($thread as $key => $row) {
|
||||
if($key === 'tas_id') {
|
||||
$result[$i][$key] = $row;
|
||||
$result[$i]['tas_title'] = (!empty($row)) ? Task::where('TAS_ID', $row)->first()->TAS_TITLE : '';
|
||||
// Thread tasks
|
||||
if ($key === 'tas_id') {
|
||||
$threadTasks[$i][$key] = $row;
|
||||
$threadTasks[$i]['tas_title'] = (!empty($row)) ? Task::where('TAS_ID', $row)->first()->TAS_TITLE : '';
|
||||
}
|
||||
if($key === 'user_id') {
|
||||
$result[$i][$key] = $row;
|
||||
}
|
||||
if($key === 'due_date') {
|
||||
$result[$i][$key] = $row;
|
||||
if ($key === 'due_date') {
|
||||
$threadTasks[$i][$key] = $row;
|
||||
// Get task color label
|
||||
$result[$i]['tas_color'] = (!empty($row)) ? $this->getTaskColor($row) : '';
|
||||
$result[$i]['tas_color_label'] = (!empty($row)) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
|
||||
$threadTasks[$i]['tas_color'] = (!empty($row)) ? $this->getTaskColor($row) : '';
|
||||
$threadTasks[$i]['tas_color_label'] = (!empty($row)) ? self::TASK_COLORS[$threadTasks[$i]['tas_color']] : '';
|
||||
}
|
||||
// Review if require other information
|
||||
if ($onlyTask) {
|
||||
// Thread tasks
|
||||
if($key === 'user_id') {
|
||||
$threadTasks[$i][$key] = $row;
|
||||
}
|
||||
} else {
|
||||
// Thread users
|
||||
if ($key === 'user_id') {
|
||||
$threadUsers[$i][$key] = $row;
|
||||
$user = (!empty($row)) ? User::where('USR_ID', $row)->first(): null;
|
||||
$threadUsers[$i]['usr_username'] = $user ? $user->USR_USERNAME : '';
|
||||
$threadUsers[$i]['usr_lastname'] = $user ? $user->USR_LASTNAME : '';
|
||||
$threadUsers[$i]['usr_firstname'] = $user ? $user->USR_FIRSTNAME : '';
|
||||
}
|
||||
// Thread titles
|
||||
if ($key === 'del_id') {
|
||||
$threadTitles[$i][$key] = $row;
|
||||
$threadTitles[$i]['thread_title'] = (!empty($row)) ? Delegation::where('DELEGATION_ID', $row)->first()->DEL_TITLE : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
// Define the array responses
|
||||
$result['THREAD_TASKS'] = $threadTasks;
|
||||
$result['THREAD_USERS'] = $threadUsers;
|
||||
$result['THREAD_TITLES'] = $threadTitles;
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1187,25 +1215,21 @@ class AbstractCases implements CasesInterface
|
||||
if (get_class($this) === Search::class && !empty($properties['caseStatuses'])) {
|
||||
$this->setCaseStatuses($properties['caseStatuses']);
|
||||
}
|
||||
// Filter by more than one priorities like ['VL', 'L', 'N']
|
||||
if (get_class($this) === Search::class && !empty($properties['priorities'])) {
|
||||
$this->setProperties($properties['priorities']);
|
||||
// Filter date related to started date from
|
||||
if (get_class($this) === Search::class && !empty($properties['startCaseFrom'])) {
|
||||
$this->setStartCaseFrom($properties['startCaseFrom']);
|
||||
}
|
||||
// Filter date newest related to delegation/started date
|
||||
if (get_class($this) === Search::class && !empty($properties['delegationDateFrom'])) {
|
||||
$this->setDelegateFrom($properties['delegationDateFrom']);
|
||||
// Filter date related to started date to
|
||||
if (get_class($this) === Search::class && !empty($properties['startCaseTo'])) {
|
||||
$this->setStartCaseTo($properties['startCaseTo']);
|
||||
}
|
||||
// Filter date oldest related to delegation/started date
|
||||
if (get_class($this) === Search::class && !empty($properties['delegationDateTo'])) {
|
||||
$this->setDelegateTo($properties['delegationDateTo']);
|
||||
// Filter date related to finish date from
|
||||
if (get_class($this) === Search::class && !empty($properties['finishCaseFrom'])) {
|
||||
$this->setFinishCaseFrom($properties['finishCaseFrom']);
|
||||
}
|
||||
// Filter date newest related to due date
|
||||
if (get_class($this) === Search::class && !empty($properties['dueDateFrom'])) {
|
||||
$this->setDueFrom($properties['dueDateFrom']);
|
||||
}
|
||||
// Filter date oldest related to due date
|
||||
if (get_class($this) === Search::class && !empty($properties['dueDateTo'])) {
|
||||
$this->setDueTo($properties['dueDateTo']);
|
||||
// Filter date related to finish date to
|
||||
if (get_class($this) === Search::class && !empty($properties['finishCaseTo'])) {
|
||||
$this->setFinishCaseTo($properties['finishCaseTo']);
|
||||
}
|
||||
// Filter by case uid
|
||||
if (!empty($properties['caseLink'])) {
|
||||
|
||||
@@ -164,6 +164,9 @@ class Participated extends AbstractCases
|
||||
$startDate = (string)$item['APP_CREATE_DATE'];
|
||||
$endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s");
|
||||
$item['DURATION'] = getDiffBetweenDates($startDate, $endDate);
|
||||
// todo: we will to complete the real count with other ticket
|
||||
$item['CASE_NOTES_COUNT'] = 0;
|
||||
// Define data according to the filters
|
||||
switch ($filter) {
|
||||
case 'STARTED':
|
||||
$result = [];
|
||||
@@ -192,7 +195,8 @@ class Participated extends AbstractCases
|
||||
case 'IN_PROGRESS':
|
||||
// Get the detail related to the open thread
|
||||
if (!empty($item['PENDING'])) {
|
||||
$item['PENDING'] = $this->prepareTaskPending($item['PENDING']);
|
||||
$result = $this->prepareTaskPending($item['PENDING']);
|
||||
$item['PENDING'] = !empty($result['THREAD_TASKS']) ? $result['THREAD_TASKS'] : [];
|
||||
}
|
||||
break;
|
||||
case 'COMPLETED':
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace ProcessMaker\BusinessModel\Cases;
|
||||
use G;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
class Search extends AbstractCases
|
||||
{
|
||||
@@ -14,14 +16,9 @@ class Search extends AbstractCases
|
||||
'APP_DELEGATION.APP_NUMBER', // Case #
|
||||
'APP_DELEGATION.DEL_TITLE', // Case Title
|
||||
'PROCESS.PRO_TITLE', // Process
|
||||
'TASK.TAS_TITLE', // Task
|
||||
'APPLICATION.APP_STATUS', // Status
|
||||
'USERS.USR_USERNAME', // Current UserName
|
||||
'USERS.USR_FIRSTNAME', // Current User FirstName
|
||||
'USERS.USR_LASTNAME', // Current User LastName
|
||||
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
|
||||
'APP_DELEGATION.DEL_DELEGATE_DATE', // Delegate Date
|
||||
'APP_DELEGATION.DEL_PRIORITY', // Priority
|
||||
'APPLICATION.APP_CREATE_DATE', // Case create date
|
||||
'APPLICATION.APP_FINISH_DATE', // Case finish date
|
||||
// Additional column for other functionalities
|
||||
'APP_DELEGATION.APP_UID', // Case Uid for Open case
|
||||
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
||||
@@ -75,25 +72,21 @@ class Search extends AbstractCases
|
||||
if ($this->getTaskId()) {
|
||||
$query->task($this->getTaskId());
|
||||
}
|
||||
// Filter one or more priorities like ['VL', 'L', 'N']
|
||||
if (!empty($this->getPriorities())) {
|
||||
$query->priorities($this->getPriorities());
|
||||
// Specific start case date from
|
||||
if (!empty($this->getStartCaseFrom())) {
|
||||
$query->startDateFrom($this->getStartCaseFrom());
|
||||
}
|
||||
// Filter by delegate from
|
||||
if (!empty($this->getDelegateFrom())) {
|
||||
$query->delegateDateFrom($this->getDelegateFrom());
|
||||
// Specific by start case date to
|
||||
if (!empty($this->getStartCaseTo())) {
|
||||
$query->startDateTo($this->getStartCaseTo());
|
||||
}
|
||||
// Filter by delegate to
|
||||
if (!empty($this->getDelegateTo())) {
|
||||
$query->delegateDateTo($this->getDelegateTo());
|
||||
// Specific finish case date from
|
||||
if (!empty($this->getFinishCaseFrom())) {
|
||||
$query->finishCaseFrom($this->getFinishCaseFrom());
|
||||
}
|
||||
// Filter by due from
|
||||
if (!empty($this->getDueFrom())) {
|
||||
$query->dueFrom($this->getDueFrom());
|
||||
}
|
||||
// Filter by due to
|
||||
if (!empty($this->getDueTo())) {
|
||||
$query->dueTo($this->getDueTo());
|
||||
// Filter by finish case date to
|
||||
if (!empty($this->getFinishCaseTo())) {
|
||||
$query->finishCaseTo($this->getFinishCaseTo());
|
||||
}
|
||||
/** This filter define the UNION */
|
||||
|
||||
@@ -141,14 +134,31 @@ class Search extends AbstractCases
|
||||
public function getData()
|
||||
{
|
||||
$query = Delegation::query()->select($this->getColumnsView());
|
||||
$query->selectRaw(
|
||||
'CONCAT(
|
||||
\'[\',
|
||||
GROUP_CONCAT(
|
||||
CONCAT(
|
||||
\'{"tas_id":\',
|
||||
APP_DELEGATION.TAS_ID,
|
||||
\', "user_id":\',
|
||||
APP_DELEGATION.USR_ID,
|
||||
\', "del_id":\',
|
||||
APP_DELEGATION.DELEGATION_ID,
|
||||
\', "due_date":"\',
|
||||
APP_DELEGATION.DEL_TASK_DUE_DATE,
|
||||
\'"}\'
|
||||
)
|
||||
),
|
||||
\']\'
|
||||
) AS THREADS'
|
||||
);
|
||||
// Join with process
|
||||
$query->joinProcess();
|
||||
// Join with task
|
||||
$query->joinTask();
|
||||
// Join with users
|
||||
$query->joinUser();
|
||||
// Join with application
|
||||
$query->joinApplication();
|
||||
// Group by AppNumber
|
||||
$query->groupBy('APP_NUMBER');
|
||||
/** Apply filters */
|
||||
$this->filters($query);
|
||||
/** Apply order and pagination */
|
||||
@@ -160,15 +170,22 @@ class Search extends AbstractCases
|
||||
$results = $query->get();
|
||||
// Prepare the result
|
||||
$results->transform(function ($item, $key) {
|
||||
// Get priority label
|
||||
$priorityLabel = self::PRIORITIES[$item['DEL_PRIORITY']];
|
||||
$item['DEL_PRIORITY_LABEL'] = G::LoadTranslation("ID_PRIORITY_{$priorityLabel}");
|
||||
// Get task color label
|
||||
$item['TAS_COLOR'] = $this->getTaskColor($item['DEL_TASK_DUE_DATE']);
|
||||
$item['TAS_COLOR_LABEL'] = self::TASK_COLORS[$item['TAS_COLOR']];
|
||||
// Apply the date format defined in environment
|
||||
$item['DEL_TASK_DUE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_TASK_DUE_DATE']);
|
||||
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
|
||||
$item['APP_CREATE_DATE_LABEL'] = !empty($item['APP_CREATE_DATE']) ? applyMaskDateEnvironment($item['APP_CREATE_DATE']): null;
|
||||
$item['APP_FINISH_DATE_LABEL'] = !empty($item['APP_FINISH_DATE']) ? applyMaskDateEnvironment($item['APP_FINISH_DATE']): null;
|
||||
// Calculate duration
|
||||
$startDate = (string)$item['APP_CREATE_DATE'];
|
||||
$endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s");
|
||||
$item['DURATION'] = getDiffBetweenDates($startDate, $endDate);
|
||||
// todo: we will to complete the real count with other ticket
|
||||
$item['CASE_NOTES_COUNT'] = 0;
|
||||
// Get the detail related to the open thread
|
||||
if (!empty($item['THREADS'])) {
|
||||
$result = $this->prepareTaskPending($item['THREADS'], false);
|
||||
$item['THREAD_TASKS'] = !empty($result['THREAD_TASKS']) ? $result['THREAD_TASKS'] : [];
|
||||
$item['THREAD_USERS'] = !empty($result['THREAD_USERS']) ? $result['THREAD_USERS'] : [];
|
||||
$item['THREAD_TITLES'] = !empty($result['THREAD_TITLES']) ? $result['THREAD_TITLES'] : [];
|
||||
}
|
||||
|
||||
return $item;
|
||||
});
|
||||
|
||||
@@ -154,9 +154,12 @@ class Supervising extends AbstractCases
|
||||
$startDate = (string)$item['APP_CREATE_DATE'];
|
||||
$endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s");
|
||||
$item['DURATION'] = getDiffBetweenDates($startDate, $endDate);
|
||||
// todo: we will to complete the real count with other ticket
|
||||
$item['CASE_NOTES_COUNT'] = 0;
|
||||
// Get the detail related to the open thread
|
||||
if (!empty($item['PENDING'])) {
|
||||
$item['PENDING'] = $this->prepareTaskPending($item['PENDING']);
|
||||
$result = $this->prepareTaskPending($item['PENDING']);
|
||||
$item['PENDING'] = !empty($result['THREAD_TASKS']) ? $result['THREAD_TASKS'] : [];
|
||||
}
|
||||
|
||||
return $item;
|
||||
|
||||
@@ -63,7 +63,7 @@ class Home extends Api
|
||||
int $task = 0,
|
||||
string $caseTitle = '',
|
||||
string $paged = '0,15',
|
||||
string $sort = 'APP_NUMBER,ASC'
|
||||
string $sort = 'APP_NUMBER,DESC'
|
||||
) {
|
||||
try {
|
||||
$list = new Draft();
|
||||
@@ -118,7 +118,7 @@ class Home extends Api
|
||||
int $task = 0,
|
||||
string $caseTitle = '',
|
||||
string $paged = '0,15',
|
||||
string $sort = 'APP_NUMBER,ASC'
|
||||
string $sort = 'APP_NUMBER,DESC'
|
||||
) {
|
||||
try {
|
||||
$list = new Inbox();
|
||||
@@ -173,7 +173,7 @@ class Home extends Api
|
||||
int $task = 0,
|
||||
string $caseTitle = '',
|
||||
string $paged = '0,15',
|
||||
string $sort = 'APP_NUMBER,ASC'
|
||||
string $sort = 'APP_NUMBER,DESC'
|
||||
) {
|
||||
try {
|
||||
$list = new Unassigned();
|
||||
@@ -230,7 +230,7 @@ class Home extends Api
|
||||
int $task = 0,
|
||||
string $caseTitle = '',
|
||||
string $paged = '0,15',
|
||||
string $sort = 'APP_NUMBER,ASC'
|
||||
string $sort = 'APP_NUMBER,DESC'
|
||||
) {
|
||||
try {
|
||||
$list = new Paused();
|
||||
@@ -269,11 +269,12 @@ class Home extends Api
|
||||
* @param int $process
|
||||
* @param int $task
|
||||
* @param string $caseTitle
|
||||
* @param string $filter
|
||||
* @param string $caseStatus
|
||||
* @param string $startCaseFrom
|
||||
* @param string $startCaseTo
|
||||
* @param string $finishCaseFrom
|
||||
* @param string $finishCaseTo
|
||||
* @param string $filter
|
||||
* @param string $paged
|
||||
* @param string $sort
|
||||
*
|
||||
@@ -290,12 +291,13 @@ class Home extends Api
|
||||
int $task = 0,
|
||||
string $caseTitle = '',
|
||||
string $filter = 'IN_PROGRESS',
|
||||
string $caseStatus = '',
|
||||
string $startCaseFrom = '',
|
||||
string $startCaseTo = '',
|
||||
string $finishCaseFrom = '',
|
||||
string $finishCaseTo = '',
|
||||
string $paged = '0,15',
|
||||
string $sort = 'APP_NUMBER,ASC'
|
||||
string $sort = 'APP_NUMBER,DESC'
|
||||
) {
|
||||
// Define the filters to apply
|
||||
$properties = [];
|
||||
@@ -307,6 +309,7 @@ class Home extends Api
|
||||
$usrUid = $this->getUserId();
|
||||
$properties['user'] = User::find($usrUid)->first()->USR_ID;
|
||||
$properties['filter'] = $filter;
|
||||
$properties['caseStatus'] = $caseStatus;
|
||||
$properties['startCaseFrom'] = $startCaseFrom;
|
||||
$properties['startCaseTo'] = $startCaseTo;
|
||||
$properties['finishCaseFrom'] = $finishCaseFrom;
|
||||
@@ -413,13 +416,12 @@ class Home extends Api
|
||||
* @param int $task
|
||||
* @param int $user
|
||||
* @param string $caseTitle
|
||||
* @param string $priorities
|
||||
* @param string $caseStatuses
|
||||
* @param string $filterCases
|
||||
* @param string $dueDateFrom
|
||||
* @param string $dueDateTo
|
||||
* @param string $delegationDateFrom
|
||||
* @param string $delegationDateTo
|
||||
* @param string $startCaseFrom
|
||||
* @param string $startCaseTo
|
||||
* @param string $finishCaseFrom
|
||||
* @param string $finishCaseTo
|
||||
* @param string $paged
|
||||
* @param string $sort
|
||||
*
|
||||
@@ -436,15 +438,14 @@ class Home extends Api
|
||||
int $task = 0,
|
||||
int $user = 0,
|
||||
string $caseTitle = '',
|
||||
string $priorities = '',
|
||||
string $caseStatuses = '',
|
||||
string $filterCases = '',
|
||||
string $dueDateFrom = '',
|
||||
string $dueDateTo = '',
|
||||
string $delegationDateFrom = '',
|
||||
string $delegationDateTo = '',
|
||||
string $startCaseFrom = '',
|
||||
string $startCaseTo = '',
|
||||
string $finishCaseFrom = '',
|
||||
string $finishCaseTo = '',
|
||||
string $paged = '0,15',
|
||||
string $sort = 'APP_NUMBER,ASC'
|
||||
string $sort = 'APP_NUMBER,DESC'
|
||||
) {
|
||||
try {
|
||||
$list = new Search();
|
||||
@@ -455,13 +456,12 @@ class Home extends Api
|
||||
$properties['process'] = $process;
|
||||
$properties['task'] = $task;
|
||||
$properties['user'] = $user;
|
||||
$properties['priorities'] = explode(',', $priorities);
|
||||
$properties['caseStatuses'] = explode(',', $caseStatuses);
|
||||
$properties['filterCases'] = $filterCases;
|
||||
$properties['dueDateFrom'] = $dueDateFrom;
|
||||
$properties['dueDateTo'] = $dueDateTo;
|
||||
$properties['delegationDateFrom'] = $delegationDateFrom;
|
||||
$properties['delegationDateTo'] = $delegationDateTo;
|
||||
$properties['startCaseFrom'] = $startCaseFrom;
|
||||
$properties['startCaseTo'] = $startCaseTo;
|
||||
$properties['finishCaseFrom'] = $finishCaseFrom;
|
||||
$properties['finishCaseTo'] = $finishCaseTo;
|
||||
// Set the pagination parameters
|
||||
$paged = explode(',', $paged);
|
||||
$sort = explode(',', $sort);
|
||||
|
||||
Reference in New Issue
Block a user