PMCORE-2477
This commit is contained in:
@@ -6,6 +6,7 @@ use DateTime;
|
|||||||
use G;
|
use G;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\AbstractCases;
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
use ProcessMaker\Model\Task;
|
use ProcessMaker\Model\Task;
|
||||||
|
|
||||||
@@ -1808,4 +1809,45 @@ class Delegation extends Model
|
|||||||
$res = $query->first();
|
$res = $query->first();
|
||||||
return $res->DEL_TITLE;
|
return $res->DEL_TITLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the pending task related to the appNumber
|
||||||
|
*
|
||||||
|
* @param int $appNumber
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getPendingTask(int $appNumber)
|
||||||
|
{
|
||||||
|
$query = Delegation::query()->select([
|
||||||
|
'TASK.TAS_TITLE', // Task
|
||||||
|
'APP_DELEGATION.DEL_TITLE', // Thread title
|
||||||
|
'APP_DELEGATION.DEL_THREAD_STATUS', // Thread status
|
||||||
|
'APP_DELEGATION.USR_ID', // Current UserId
|
||||||
|
'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.APP_UID', // Case Uid for Open case
|
||||||
|
'APP_DELEGATION.DEL_INDEX', // Del Index for Open case
|
||||||
|
]);
|
||||||
|
// Join with task
|
||||||
|
$query->joinTask();
|
||||||
|
// Join with task
|
||||||
|
$query->joinUser();
|
||||||
|
// Get the open threads
|
||||||
|
$query->threadOpen();
|
||||||
|
// Related to the specific case number
|
||||||
|
$query->case($appNumber);
|
||||||
|
// Get the results
|
||||||
|
$results = $query->get();
|
||||||
|
$results->transform(function ($item) {
|
||||||
|
$abs = new AbstractCases();
|
||||||
|
$item['TAS_COLOR'] = $abs->getTaskColor($item['DEL_TASK_DUE_DATE']);
|
||||||
|
$item['TAS_COLOR_LABEL'] = AbstractCases::TASK_COLORS[$item['TAS_COLOR']];
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use ProcessMaker\BusinessModel\Cases\Paused;
|
|||||||
use ProcessMaker\BusinessModel\Cases\Search;
|
use ProcessMaker\BusinessModel\Cases\Search;
|
||||||
use ProcessMaker\BusinessModel\Cases\Supervising;
|
use ProcessMaker\BusinessModel\Cases\Supervising;
|
||||||
use ProcessMaker\BusinessModel\Cases\Unassigned;
|
use ProcessMaker\BusinessModel\Cases\Unassigned;
|
||||||
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\User;
|
use ProcessMaker\Model\User;
|
||||||
use ProcessMaker\Services\Api;
|
use ProcessMaker\Services\Api;
|
||||||
use RBAC;
|
use RBAC;
|
||||||
@@ -535,4 +536,25 @@ class Home extends Api
|
|||||||
// Return menu
|
// Return menu
|
||||||
return $menuHome;
|
return $menuHome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the search cases
|
||||||
|
*
|
||||||
|
* @url GET /:app_number/pending-tasks
|
||||||
|
*
|
||||||
|
* @param int $app_number
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
* @class AccessControl {@permission PM_CASES}
|
||||||
|
*/
|
||||||
|
public function getPendingTasks(int $app_number)
|
||||||
|
{
|
||||||
|
$result = Delegation::getPendingTask($app_number);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user