fix conflicts

This commit is contained in:
Rodrigo Quelca
2021-12-08 13:16:38 +00:00
39 changed files with 1038 additions and 431 deletions

View File

@@ -3401,10 +3401,11 @@ class Cases
$lastFields = $this->executeTriggerFromList($triggersList, $fieldsCase, $stepType, $stepUidObj, $triggerType);
/*----------------------------------********---------------------------------*/
$usrUid = empty($fieldsCase['USER_LOGGED']) ? '' : $fieldsCase['USER_LOGGED'];
$usrUid = empty($_SESSION['USER_LOGGED']) ? '' : $_SESSION['USER_LOGGED'];
ChangeLog::getChangeLog()
->setObjectUid($stepUidObj)
->getUsrIdByUsrUid($usrUid)
->getUsrIdByUsrUid($usrUid, true)
->getTasIdByTasUid($tasUid, true)
->getExecutedAtIdByTriggerType($triggerType);
/*----------------------------------********---------------------------------*/

View File

@@ -4403,6 +4403,12 @@ msgstr "The category name with {0}: \"{1}\" already exists."
msgid "The category with {0}: '{1}' does not exist."
msgstr "The category with {0}: '{1}' does not exist."
# TRANSLATION
# LABEL/ID_CATEGORY_PROCESS
#: LABEL/ID_CATEGORY_PROCESS
msgid "Process Category"
msgstr "Process Category"
# TRANSLATION
# LABEL/ID_CATEGORY_SUCCESS_DELETE
#: LABEL/ID_CATEGORY_SUCCESS_DELETE

View File

@@ -393,6 +393,11 @@ class AppProxy extends HttpProxyController
'label' => G::LoadTranslation('ID_PROCESS_NAME') . ': ',
'value' => $processInfo['PRO_TITLE'],
],
$i++ => [ // Process Category
'id' => 'CATEGORY',
'label' => G::LoadTranslation('ID_CATEGORY_PROCESS') . ': ',
'value' => $processInfo['PRO_CATEGORY_LABEL'],
],
$i++ => [ // Process description
'id' => 'PRO_DESCRIPTION',
'label' => G::LoadTranslation('ID_PRO_DESCRIPTION') . ': ',

View File

@@ -57548,6 +57548,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_CATEGORY_NAME','en','Category Name','2014-01-15') ,
( 'LABEL','ID_CATEGORY_NAME_ALREADY_EXISTS','en','The category name with {0}: "{1}" already exists.','2014-06-12') ,
( 'LABEL','ID_CATEGORY_NOT_EXIST','en','The category with {0}: ''{1}'' does not exist.','2014-05-29') ,
( 'LABEL','ID_CATEGORY_PROCESS','en','Process Category','2021-11-25') ,
( 'LABEL','ID_CATEGORY_SUCCESS_DELETE','en','Process category has been deleted correctly.','2014-01-15') ,
( 'LABEL','ID_CATEGORY_SUCCESS_NEW','en','Process category has been created correctly.','2014-01-15') ,
( 'LABEL','ID_CATEGORY_SUCCESS_UPDATE','en','Process category has been updated correctly.','2014-01-15') ,

View File

@@ -1343,6 +1343,10 @@ class AbstractCases implements CasesInterface
*/
public function setProperties(array $properties)
{
// Filter by category
if (!empty($properties['category'])) {
$this->setCategoryId($properties['category']);
}
// Filter by process
if (!empty($properties['process'])) {
$this->setProcessId($properties['process']);

View File

@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Draft extends AbstractCases
@@ -16,6 +17,7 @@ class Draft extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process
'TASK.TAS_TITLE', // Task
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
@@ -67,6 +69,10 @@ class Draft extends AbstractCases
if (!empty($this->getCaseTitle())) {
$query->title($this->getCaseTitle());
}
// Specific category
if ($this->getCategoryId()) {
$query->categoryId($this->getCategoryId());
}
// Specific process
if ($this->getProcessId()) {
$query->processId($this->getProcessId());
@@ -113,6 +119,9 @@ class Draft extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Get priority label
$priorityLabel = self::PRIORITIES[$item['DEL_PRIORITY']];
$item['DEL_PRIORITY_LABEL'] = G::LoadTranslation("ID_PRIORITY_{$priorityLabel}");
@@ -199,6 +208,11 @@ class Draft extends AbstractCases
$query = Delegation::query()->select();
// Add the initial scope for draft cases
$query->draft($this->getUserId());
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -38,7 +38,9 @@ class Home
/**
* Get the draft cases.
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -47,10 +49,12 @@ class Home
* @param string $filterCases
* @param string $sort
* @param callable $callback
*
* @return array
*/
public function getDraft(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -67,6 +71,7 @@ class Home
$properties['caseNumber'] = $caseNumber;
$properties['caseTitle'] = $caseTitle;
$properties['filterCases'] = $filterCases;
$properties['category'] = $category;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -87,7 +92,9 @@ class Home
/**
* Get the inbox cases.
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -99,10 +106,12 @@ class Home
* @param string $sort
* @param string $sendBy
* @param callable $callback
*
* @return array
*/
public function getInbox(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -124,6 +133,7 @@ class Home
$properties['delegateFrom'] = $delegateFrom;
$properties['delegateTo'] = $delegateTo;
$properties['filterCases'] = $filterCases;
$properties['category'] = $category;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -145,7 +155,9 @@ class Home
/**
* Get the unassigned cases.
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -157,10 +169,12 @@ class Home
* @param string $sort
* @param string $sendBy
* @param callable $callback
*
* @return array
*/
public function getUnassigned(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -182,6 +196,7 @@ class Home
$properties['delegateFrom'] = $delegateFrom;
$properties['delegateTo'] = $delegateTo;
$properties['filterCases'] = $filterCases;
$properties['category'] = $category;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -205,7 +220,9 @@ class Home
/**
* Get the paused cases.
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -217,10 +234,12 @@ class Home
* @param string $sort
* @param string $sendBy
* @param callable $callback
*
* @return array
*/
public function getPaused(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -242,6 +261,7 @@ class Home
$properties['delegateFrom'] = $delegateFrom;
$properties['delegateTo'] = $delegateTo;
$properties['filterCases'] = $filterCases;
$properties['category'] = $category;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -263,6 +283,7 @@ class Home
/**
* Build the columns and data from the custom list.
*
* @param string $type
* @param int $id
* @param array $arguments
@@ -339,14 +360,16 @@ class Home
}
};
}
$arguments[1] = $proId;
$arguments[2] = $proId;
}
}
/**
* Get the custom draft cases.
*
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -355,11 +378,13 @@ class Home
* @param string $filterCases
* @param string $sort
* @param array $customFilters
*
* @return array
*/
public function getCustomDraft(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -372,6 +397,7 @@ class Home
{
$arguments = [
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -382,7 +408,7 @@ class Home
];
//clear duplicate indexes
$keys = ['caseNumber', 'process', 'task', 'limit', 'offset', 'caseTitle', 'filterCases', 'sort'];
$keys = ['caseNumber', 'category', 'process', 'task', 'limit', 'offset', 'caseTitle', 'filterCases', 'sort'];
foreach ($keys as $value) {
unset($customFilters[$value]);
}
@@ -398,8 +424,10 @@ class Home
/**
* Get the custom inbox cases.
*
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -411,11 +439,13 @@ class Home
* @param string $sort
* @param string $sendBy
* @param array $customFilters
*
* @return array
*/
public function getCustomInbox(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -431,6 +461,7 @@ class Home
{
$arguments = [
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -444,7 +475,7 @@ class Home
];
//clear duplicate indexes
$keys = ['caseNumber', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
$keys = ['caseNumber', 'category', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
foreach ($keys as $value) {
unset($customFilters[$value]);
}
@@ -460,8 +491,10 @@ class Home
/**
* Get the custom unassigned cases.
*
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -473,11 +506,13 @@ class Home
* @param string $sort
* @param string $sendBy
* @param array $customFilters
*
* @return array
*/
public function getCustomUnassigned(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -493,6 +528,7 @@ class Home
{
$arguments = [
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -506,7 +542,7 @@ class Home
];
//clear duplicate indexes
$keys = ['caseNumber', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
$keys = ['caseNumber', 'category', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
foreach ($keys as $value) {
unset($customFilters[$value]);
}
@@ -522,8 +558,10 @@ class Home
/**
* Get the custom paused cases.
*
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -535,11 +573,13 @@ class Home
* @param string $sort
* @param string $sendBy
* @param array $customFilters
*
* @return array
*/
public function getCustomPaused(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -555,6 +595,7 @@ class Home
{
$arguments = [
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -568,7 +609,7 @@ class Home
];
//clear duplicate indexes
$keys = ['caseNumber', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
$keys = ['caseNumber', 'category', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
foreach ($keys as $value) {
unset($customFilters[$value]);
}

View File

@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Inbox extends AbstractCases
@@ -16,6 +17,7 @@ class Inbox extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process
'TASK.TAS_TITLE', // Task
'USERS.USR_USERNAME', // Current UserName
@@ -70,6 +72,10 @@ class Inbox extends AbstractCases
if (!empty($this->getCaseTitle())) {
$query->title($this->getCaseTitle());
}
// Specific category
if ($this->getCategoryId()) {
$query->categoryId($this->getCategoryId());
}
// Specific process
if ($this->getProcessId()) {
$query->processId($this->getProcessId());
@@ -131,6 +137,9 @@ class Inbox extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Get priority label
$priorityLabel = self::PRIORITIES[$item['DEL_PRIORITY']];
$item['DEL_PRIORITY_LABEL'] = G::LoadTranslation("ID_PRIORITY_{$priorityLabel}");
@@ -216,6 +225,11 @@ class Inbox extends AbstractCases
$query = Delegation::query()->select();
// Scope that sets the queries for List Inbox
$query->inbox($this->getUserId());
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -2,10 +2,12 @@
namespace ProcessMaker\BusinessModel\Cases;
use G;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\AppNotes;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Participated extends AbstractCases
@@ -15,6 +17,7 @@ class Participated extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process Name
'TASK.TAS_TITLE', // Pending Task
'TASK.TAS_ASSIGN_TYPE', // Task assign rule
@@ -68,10 +71,14 @@ class Participated extends AbstractCases
// Specific case title
if (!empty($this->getCaseTitle())) {
// Get the result
$result = Delegation::casesThreadTitle($this->getCaseTitle(), $this->getOffset(), $this->getLimit());
$result = Delegation::casesThreadTitle($this->getCaseTitle());
// Add the filter
$query->specificCases($result);
}
// Specific category
if ($this->getCategoryId()) {
$query->categoryId($this->getCategoryId());
}
// Scope to search for an specific process
if ($this->getProcessId()) {
$query->processId($this->getProcessId());
@@ -168,6 +175,9 @@ class Participated extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) use ($filter) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Apply the date format defined in environment
$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;
@@ -367,6 +377,11 @@ class Participated extends AbstractCases
$query->lastThread();
break;
}
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -6,6 +6,7 @@ use G;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Paused extends AbstractCases
@@ -15,6 +16,7 @@ class Paused extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process
'TASK.TAS_TITLE', // Task
'USERS.USR_USERNAME', // Current UserName
@@ -125,6 +127,9 @@ class Paused extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Get priority label
$priorityLabel = self::PRIORITIES[$item['DEL_PRIORITY']];
$item['DEL_PRIORITY_LABEL'] = G::LoadTranslation("ID_PRIORITY_{$priorityLabel}");
@@ -210,6 +215,11 @@ class Paused extends AbstractCases
$query = Delegation::query()->select();
// Scope that set the paused cases
$query->paused($this->getUserId());
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -7,8 +7,7 @@ use ProcessMaker\Model\Application;
use ProcessMaker\Model\AppNotes;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
use ProcessMaker\Model\ProcessCategory;
class Search extends AbstractCases
{
@@ -17,6 +16,7 @@ class Search extends AbstractCases
// Columns view in the cases list
'APPLICATION.APP_NUMBER', // Case #
'APPLICATION.APP_TITLE AS DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process
'APPLICATION.APP_STATUS', // Status
'APPLICATION.APP_CREATE_DATE', // Case create date
@@ -156,6 +156,9 @@ class Search extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Apply the date format defined in environment
$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;

View File

@@ -2,9 +2,11 @@
namespace ProcessMaker\BusinessModel\Cases;
use G;
use ProcessMaker\Model\AppNotes;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\ProcessUser;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Supervising extends AbstractCases
@@ -14,6 +16,7 @@ class Supervising extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process Name
'TASK.TAS_TITLE', // Pending Task
'APPLICATION.APP_STATUS', // Status
@@ -66,10 +69,14 @@ class Supervising extends AbstractCases
// Specific case title
if (!empty($this->getCaseTitle())) {
// Get the result
$result = Delegation::casesThreadTitle($this->getCaseTitle(), $this->getOffset(), $this->getLimit());
$result = Delegation::casesThreadTitle($this->getCaseTitle());
// Add the filter
$query->specificCases($result);
}
// Specific category
if ($this->getCategoryId()) {
$query->categoryId($this->getCategoryId());
}
// Scope to search for an specific process
if ($this->getProcessId()) {
$query->processId($this->getProcessId());
@@ -144,6 +151,9 @@ class Supervising extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Get task color label
$item['TAS_COLOR'] = $this->getTaskColor($item['DEL_TASK_DUE_DATE']);
$item['TAS_COLOR_LABEL'] = self::TASK_COLORS[$item['TAS_COLOR']];
@@ -243,6 +253,11 @@ class Supervising extends AbstractCases
$processes = ProcessUser::getProcessesOfSupervisor($this->getUserUid());
// Scope the specific array of processes supervising
$query->processInList($processes);
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Unassigned extends AbstractCases
@@ -16,6 +17,7 @@ class Unassigned extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process
'TASK.TAS_TITLE', // Task
'USERS.USR_USERNAME', // Current UserName
@@ -70,6 +72,10 @@ class Unassigned extends AbstractCases
if ($this->getCaseTitle()) {
$query->title($this->getCaseTitle());
}
// Specific category
if ($this->getCategoryId()) {
$query->categoryId($this->getCategoryId());
}
// Specific process
if ($this->getProcessId()) {
$query->processId($this->getProcessId());
@@ -134,6 +140,9 @@ class Unassigned extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Get priority label
$priorityLabel = self::PRIORITIES[$item['DEL_PRIORITY']];
$item['DEL_PRIORITY_LABEL'] = G::LoadTranslation("ID_PRIORITY_{$priorityLabel}");
@@ -219,6 +228,11 @@ class Unassigned extends AbstractCases
$query = Delegation::query()->select();
// Add the initial scope for self-service cases
$query->selfService($this->getUserUid());
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -390,6 +390,15 @@ class CaseList extends Model
'typeSearch' => 'search text',
'enableFilter' => false,
'set' => true
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'process_category',
'name' => G::LoadTranslation('ID_PROCESS_CATEGORY'),
'type' => 'string',
'source' => 'APPLICATION',
'typeSearch' => 'search text',
'enableFilter' => false,
'set' => true
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'task',

View File

@@ -2181,12 +2181,10 @@ class Delegation extends Model
* Get cases filter by thread title
*
* @param string $search
* @param int $offset
* @param int $limit
*
* @return array
*/
public static function casesThreadTitle(string $search, int $offset = 0, int $limit = 15)
public static function casesThreadTitle(string $search)
{
// Get the case numbers related to this filter
$query = Delegation::query()->select(['APP_NUMBER']);
@@ -2194,8 +2192,6 @@ class Delegation extends Model
$query->title($search);
// Group by
$query->groupBy('APP_NUMBER');
// Apply the limit
$query->offset($offset)->limit($limit);
// Get the result
$results = $query->get();

View File

@@ -17,6 +17,18 @@ class ProcessCategory extends Model
public $timestamps = false;
/**
* Scope a query to specific category id
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param int $category
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeCategory($query, $category)
{
return $query->where('CATEGORY_ID', $category);
}
/**
* Scope a query to specific category name
*
@@ -92,4 +104,22 @@ class ProcessCategory extends Model
return $query->first()->CATEGORY_ID;
}
}
/**
* Get category name
*
* @param int $category
*
* @return string
*/
public static function getCategory(int $category)
{
$query = ProcessCategory::query()->select(['CATEGORY_NAME']);
$query->category($category);
if ($query->first()) {
return $query->first()->CATEGORY_NAME;
} else {
return '';
}
}
}

View File

@@ -51,6 +51,7 @@ class Home extends Api
* @url GET /draft
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -68,6 +69,7 @@ class Home extends Api
*/
public function doGetDraftCases(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -81,6 +83,7 @@ class Home extends Api
$bmHome = new BMHome($this->getUserId());
return $bmHome->getDraft(
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -101,6 +104,7 @@ class Home extends Api
* @url GET /todo [This is kept for compatibility should not be used 'todo', the reason is to only handle the same verb (inbox) for all 'normal case list' and 'custom case list']
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -121,6 +125,7 @@ class Home extends Api
*/
public function doGetTodoCases(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -137,6 +142,7 @@ class Home extends Api
$bmHome = new BMHome($this->getUserId());
return $bmHome->getInbox(
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -159,6 +165,7 @@ class Home extends Api
* @url GET /unassigned
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -179,6 +186,7 @@ class Home extends Api
*/
public function doGetUnassignedCases(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -195,6 +203,7 @@ class Home extends Api
$bmHome = new BMHome($this->getUserId());
return $bmHome->getUnassigned(
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -217,6 +226,7 @@ class Home extends Api
* @url GET /paused
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -237,6 +247,7 @@ class Home extends Api
*/
public function doGetPausedCases(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -253,6 +264,7 @@ class Home extends Api
$bmHome = new BMHome($this->getUserId());
return $bmHome->getPaused(
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -274,6 +286,7 @@ class Home extends Api
* @url POST /draft/:id
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -290,6 +303,7 @@ class Home extends Api
public function doGetCustomDraftCases(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -305,6 +319,7 @@ class Home extends Api
return $bmHome->getCustomDraft(
$id,
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -324,6 +339,7 @@ class Home extends Api
* @url POST /inbox/:id
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -343,6 +359,7 @@ class Home extends Api
public function doGetCustomInboxCases(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -361,6 +378,7 @@ class Home extends Api
return $bmHome->getCustomInbox(
$id,
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -383,6 +401,7 @@ class Home extends Api
* @url POST /unassigned/:id
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -402,6 +421,7 @@ class Home extends Api
public function doGetCustomUnassignedCases(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -420,6 +440,7 @@ class Home extends Api
return $bmHome->getCustomUnassigned(
$id,
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -442,6 +463,7 @@ class Home extends Api
* @url POST /paused/:id
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -461,6 +483,7 @@ class Home extends Api
public function doGetCustomPausedCases(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -479,6 +502,7 @@ class Home extends Api
return $bmHome->getCustomPaused(
$id,
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -502,6 +526,7 @@ class Home extends Api
* @url GET /mycases
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -525,6 +550,7 @@ class Home extends Api
*/
public function doGetMyCases(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -544,6 +570,7 @@ class Home extends Api
$properties['caseNumber'] = $caseNumber;
$properties['caseTitle'] = $caseTitle;
$properties['filterCases'] = $filterCases;
$properties['category'] = $category;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API

View File

@@ -6,7 +6,7 @@ Ext.onReady(function () {
layout: 'border',
items: [
new Ext.grid.GridPanel({
region: 'center',
"region": 'center',
"width": "100%",
"height": 300,
"stateful": true,
@@ -56,13 +56,18 @@ Ext.onReady(function () {
header: _('ID_FIELD_NAME'),
width: 120,
sortable: false,
dataIndex: 'field'
dataIndex: 'field',
menuDisabled: true,
renderer: function (value, metaData, record, rowIndex, colIndex, store) {
return "<b>"+value+"</b>";
}
},
{
header: _('ID_PREV_VALUES'),
flex: 1,
sortable: false,
dataIndex: 'previousValue',
menuDisabled: true,
renderer: function (value, p, record) {
return value;
}
@@ -72,6 +77,7 @@ Ext.onReady(function () {
flex: 1,
sortable: false,
dataIndex: 'currentValue',
menuDisabled: true,
renderer: function (value, p, record) {
return value;
}