Merged in feature/HOR-3778 (pull request #6008)

HOR-3778

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
Approved-by: Paula Quispe <paula.quispe@processmaker.com>
Approved-by: David Callizaya <david.callizaya@processmaker.com>
This commit is contained in:
Paula Quispe
2017-08-25 14:30:09 +00:00
committed by Julio Cesar Laura Avendaño
5 changed files with 594 additions and 382 deletions

View File

@@ -406,6 +406,7 @@ class ListInbox extends BaseListInbox
$filterStatus = isset($filters['filterStatus']) ? $filters['filterStatus'] : '';
$newestthan = isset($filters['newestthan']) ? $filters['newestthan'] : '';
$oldestthan = isset($filters['oldestthan']) ? $filters['oldestthan'] : '';
$appUidCheck = isset($filters['appUidCheck']) ? $filters['appUidCheck'] : array();
//Check the inbox to call
switch ($action) {
@@ -503,6 +504,11 @@ class ListInbox extends BaseListInbox
if ($oldestthan != '') {
$criteria->add( $criteria->getNewCriterion( ListInboxPeer::DEL_DELEGATE_DATE, $oldestthan, Criteria::LESS_THAN ));
}
//Review in the specific lot of cases
if (!empty($appUidCheck)) {
$criteria->add(ListInboxPeer::APP_UID, $appUidCheck, Criteria::IN);
}
}
/**

View File

@@ -182,6 +182,7 @@ class ListUnassigned extends BaseListUnassigned
$category = isset($filters['category']) ? $filters['category'] : '';
$dateFrom = isset($filters['dateFrom']) ? $filters['dateFrom'] : '';
$dateTo = isset($filters['dateTo']) ? $filters['dateTo'] : '';
$appUidCheck = isset($filters['appUidCheck']) ? $filters['appUidCheck'] : array();
//Filter Search
if ($search != '') {
@@ -208,6 +209,11 @@ class ListUnassigned extends BaseListUnassigned
$aConditions[] = array(ProcessPeer::PRO_CATEGORY, "'" . $category . "'");
$criteria->addJoinMC($aConditions, Criteria::INNER_JOIN);
}
//Review in the specific lot of cases
if (!empty($appUidCheck)) {
$criteria->add(ListUnassignedPeer::APP_UID, $appUidCheck, Criteria::IN);
}
}
/**

View File

@@ -2,6 +2,8 @@
namespace ProcessMaker\BusinessModel;
use ProcessMaker\BusinessModel\Lists;
use ProcessMaker\BusinessModel\Cases;
use G;
use Criteria;
use UsersPeer;
@@ -1348,4 +1350,59 @@ class Light
return $children;
}
/**
* This function check if the $data are in the corresponding cases list
* @param string $userUid
* @param array $data
* @param string $listName
* @param string $action
* @return array $response
*/
public function getListCheck($userUid, $data, $listName = 'inbox', $action = 'todo')
{
$casesToCheck = [];
foreach ($data as $key => $val) {
array_push($casesToCheck, $val['caseId']);
}
$dataList = [];
$dataList['appUidCheck'] = $casesToCheck;
$dataList['userId'] = $userUid;
$dataList['action'] = $action;
/*----------------------------------********---------------------------------*/
if (true) {
//In enterprise version this block of code should always be executed
//In community version this block of code is deleted and is executed the other
$list = new Lists();
$response = $list->getList($listName, $dataList);
} else {
/*----------------------------------********---------------------------------*/
$case = new Cases();
$response = $case->getList($dataList);
/*----------------------------------********---------------------------------*/
}
/*----------------------------------********---------------------------------*/
$result = [];
foreach ($data as $key => $val) {
$flagRemoved = true;
foreach ($response['data'] as $row) {
$row = array_change_key_case($row,CASE_UPPER);
if (isset($row['APP_UID']) && isset($row['DEL_INDEX'])) {
if ($val['caseId'] === $row['APP_UID'] && $val['delIndex'] === $row['DEL_INDEX'] ) {
$flagRemoved = false;
continue;
}
}
}
if ($flagRemoved) {
$result[] = [
'caseId' => $val['caseId'],
'delIndex' => $val['delIndex']
];
}
}
return $result;
}
}

View File

@@ -98,25 +98,22 @@ class Lists {
}
$userUid = $dataList["userId"];
$filters["paged"] = isset( $dataList["paged"] ) ? $dataList["paged"] : true;
$filters['count'] = isset( $dataList['count'] ) ? $dataList['count'] : true;
$filters["category"] = isset( $dataList["category"] ) ? $dataList["category"] : "";
$filters["process"] = isset( $dataList["process"] ) ? $dataList["process"] : "";
$filters["search"] = isset( $dataList["search"] ) ? $dataList["search"] : "";
$filters["filter"] = isset( $dataList["filter"] ) ? $dataList["filter"] : "";
$filters["dateFrom"] = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : "";
$filters["dateTo"] = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : "";
$filters["start"] = isset( $dataList["start"] ) ? $dataList["start"] : "0";
$filters["limit"] = isset( $dataList["limit"] ) ? $dataList["limit"] : "25";
$filters["sort"] = isset( $dataList["sort"] ) ? $dataList["sort"] : "";
$filters["dir"] = isset( $dataList["dir"] ) ? $dataList["dir"] : "ASC";
$filters["action"] = isset( $dataList["action"] ) ? $dataList["action"] : "";
$filters['newestthan'] = isset( $dataList['newerThan'] ) ? $dataList['newerThan'] : '';
$filters['oldestthan'] = isset( $dataList['oldestthan'] ) ? $dataList['oldestthan'] : '';
$filters["paged"] = isset($dataList["paged"]) ? $dataList["paged"] : true;
$filters['count'] = isset($dataList['count']) ? $dataList['count'] : true;
$filters["category"] = isset($dataList["category"]) ? $dataList["category"] : "";
$filters["process"] = isset($dataList["process"]) ? $dataList["process"] : "";
$filters["search"] = isset($dataList["search"]) ? $dataList["search"] : "";
$filters["filter"] = isset($dataList["filter"]) ? $dataList["filter"] : "";
$filters["dateFrom"] = (!empty($dataList["dateFrom"])) ? substr($dataList["dateFrom"], 0, 10) : "";
$filters["dateTo"] = (!empty($dataList["dateTo"])) ? substr($dataList["dateTo"], 0, 10) : "";
$filters["start"] = isset($dataList["start"]) ? $dataList["start"] : "0";
$filters["limit"] = isset($dataList["limit"]) ? $dataList["limit"] : "25";
$filters["sort"] = isset($dataList["sort"]) ? $dataList["sort"] : "";
$filters["dir"] = isset($dataList["dir"]) ? $dataList["dir"] : "ASC";
$filters["action"] = isset($dataList["action"]) ? $dataList["action"] : "";
$filters['newestthan'] = isset($dataList['newerThan']) ? $dataList['newerThan'] : '';
$filters['oldestthan'] = isset($dataList['oldestthan']) ? $dataList['oldestthan'] : '';
$filters['appUidCheck'] = isset($dataList['appUidCheck']) ? $dataList['appUidCheck'] : array();
// Select list
switch ($listName) {

File diff suppressed because it is too large Load Diff