Merged in victorsl/processmaker/PERF_CASES_LIST (pull request #2089)
PM-00000 "Mejorar el performance en los Cases Lists nuevos" SOLVED
This commit is contained in:
@@ -261,7 +261,7 @@ class ListCanceled extends BaseListCanceled {
|
||||
return (int)$total;
|
||||
}
|
||||
|
||||
public function loadList ($usr_uid, $filters = array())
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$resp = array();
|
||||
$criteria = new Criteria();
|
||||
@@ -308,7 +308,8 @@ class ListCanceled extends BaseListCanceled {
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$data = array();
|
||||
while ($dataset->next()) {
|
||||
$aRow = $dataset->getRow();
|
||||
$aRow = (is_null($callbackRecord))? $dataset->getRow() : $callbackRecord($dataset->getRow());
|
||||
|
||||
$data[] = $aRow;
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ class ListCompleted extends BaseListCompleted
|
||||
return (int)$total;
|
||||
}
|
||||
|
||||
public function loadList ($usr_uid, $filters = array())
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$resp = array();
|
||||
$criteria = new Criteria();
|
||||
@@ -315,7 +315,8 @@ class ListCompleted extends BaseListCompleted
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$data = array();
|
||||
while ($dataset->next()) {
|
||||
$aRow = $dataset->getRow();
|
||||
$aRow = (is_null($callbackRecord))? $dataset->getRow() : $callbackRecord($dataset->getRow());
|
||||
|
||||
$data[] = $aRow;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ require_once 'classes/model/om/BaseListInbox.php';
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
|
||||
|
||||
class ListInbox extends BaseListInbox
|
||||
{
|
||||
/**
|
||||
@@ -131,7 +131,7 @@ class ListInbox extends BaseListInbox
|
||||
|
||||
// update participated history
|
||||
$listParticipatedHistory = new ListParticipatedHistory();
|
||||
$listParticipatedHistory->update($data);
|
||||
$listParticipatedHistory->update($data);
|
||||
return $result;
|
||||
} else {
|
||||
$con->rollback();
|
||||
@@ -395,7 +395,7 @@ class ListInbox extends BaseListInbox
|
||||
return (int)$total;
|
||||
}
|
||||
|
||||
public function loadList ($usr_uid, $filters = array())
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
|
||||
@@ -429,7 +429,7 @@ class ListInbox extends BaseListInbox
|
||||
|
||||
if ($filters['action'] == 'draft') {
|
||||
$criteria->add( ListInboxPeer::APP_STATUS, 'DRAFT', Criteria::EQUAL );
|
||||
} else {
|
||||
} else {
|
||||
$criteria->add( ListInboxPeer::APP_STATUS, 'TO_DO', Criteria::EQUAL );
|
||||
}
|
||||
|
||||
@@ -449,7 +449,8 @@ class ListInbox extends BaseListInbox
|
||||
$data = array();
|
||||
$aPriorities = array ('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH');
|
||||
while ($dataset->next()) {
|
||||
$aRow = $dataset->getRow();
|
||||
$aRow = (is_null($callbackRecord))? $dataset->getRow() : $callbackRecord($dataset->getRow());
|
||||
|
||||
$aRow['DEL_PRIORITY'] = G::LoadTranslation( "ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}" );
|
||||
$data[] = $aRow;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ class ListMyInbox extends BaseListMyInbox
|
||||
return (int)$total;
|
||||
}
|
||||
|
||||
public function loadList ($usr_uid, $filters = array())
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
|
||||
@@ -264,7 +264,8 @@ class ListMyInbox extends BaseListMyInbox
|
||||
$data = array();
|
||||
$aPriorities = array ('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH');
|
||||
while ($dataset->next()) {
|
||||
$aRow = $dataset->getRow();
|
||||
$aRow = (is_null($callbackRecord))? $dataset->getRow() : $callbackRecord($dataset->getRow());
|
||||
|
||||
$aRow['DEL_PRIORITY'] = G::LoadTranslation( "ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}" );
|
||||
$data[] = $aRow;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class ListParticipatedHistory extends BaseListParticipatedHistory
|
||||
return (int)$total;
|
||||
}
|
||||
|
||||
public function loadList ($usr_uid, $filters = array())
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
|
||||
@@ -219,7 +219,8 @@ class ListParticipatedHistory extends BaseListParticipatedHistory
|
||||
$data = array();
|
||||
$aPriorities = array ('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH');
|
||||
while ($dataset->next()) {
|
||||
$aRow = $dataset->getRow();
|
||||
$aRow = (is_null($callbackRecord))? $dataset->getRow() : $callbackRecord($dataset->getRow());
|
||||
|
||||
$aRow['DEL_PRIORITY'] = G::LoadTranslation( "ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}" );
|
||||
$data[] = $aRow;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
*
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_STATUS);
|
||||
$criteria->add( ApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
|
||||
@@ -108,7 +108,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
*
|
||||
*/
|
||||
public function refresh ($data, $isSelfService = false)
|
||||
{
|
||||
{
|
||||
$data['APP_STATUS'] = (empty($data['APP_STATUS'])) ? 'TO_DO' : $data['APP_STATUS'];
|
||||
if (!$isSelfService) {
|
||||
$criteria = new Criteria();
|
||||
@@ -133,7 +133,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
|
||||
}
|
||||
$this->update($data);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Remove List Participated History
|
||||
@@ -239,7 +239,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
return (int)$total;
|
||||
}
|
||||
|
||||
public function loadList ($usr_uid, $filters = array())
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
|
||||
@@ -252,7 +252,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::APP_TITLE);
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::APP_PRO_TITLE);
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::APP_TAS_TITLE);
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::APP_STATUS);
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::APP_STATUS);
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PREVIOUS_USR_UID);
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PREVIOUS_USR_USERNAME);
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PREVIOUS_USR_FIRSTNAME);
|
||||
@@ -290,7 +290,8 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
$data = array();
|
||||
$aPriorities = array ('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH');
|
||||
while ($dataset->next()) {
|
||||
$aRow = $dataset->getRow();
|
||||
$aRow = (is_null($callbackRecord))? $dataset->getRow() : $callbackRecord($dataset->getRow());
|
||||
|
||||
$aRow['DEL_PRIORITY'] = G::LoadTranslation( "ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}" );
|
||||
$data[] = $aRow;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ class ListPaused extends BaseListPaused {
|
||||
return (int)$total;
|
||||
}
|
||||
|
||||
public function loadList ($usr_uid, $filters = array())
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$resp = array();
|
||||
$criteria = new Criteria();
|
||||
@@ -332,7 +332,8 @@ class ListPaused extends BaseListPaused {
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$data = array();
|
||||
while ($dataset->next()) {
|
||||
$aRow = $dataset->getRow();
|
||||
$aRow = (is_null($callbackRecord))? $dataset->getRow() : $callbackRecord($dataset->getRow());
|
||||
|
||||
$data[] = $aRow;
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ class ListUnassigned extends BaseListUnassigned
|
||||
return (int)$total;
|
||||
}
|
||||
|
||||
public function loadList ($usr_uid, $filters = array())
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$resp = array();
|
||||
$criteria = new Criteria();
|
||||
@@ -298,7 +298,8 @@ class ListUnassigned extends BaseListUnassigned
|
||||
$data = array();
|
||||
$aPriorities = array ('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH');
|
||||
while ($dataset->next()) {
|
||||
$aRow = $dataset->getRow();
|
||||
$aRow = (is_null($callbackRecord))? $dataset->getRow() : $callbackRecord($dataset->getRow());
|
||||
|
||||
$aRow['DEL_PRIORITY'] = G::LoadTranslation( "ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}" );
|
||||
$data[] = $aRow;
|
||||
}
|
||||
@@ -313,7 +314,7 @@ class ListUnassigned extends BaseListUnassigned
|
||||
/**
|
||||
* Generate Data
|
||||
*
|
||||
* @return object criteria
|
||||
* @return object criteria
|
||||
*/
|
||||
public function generateData($appUid,$delPreviusUsrUid){
|
||||
try {
|
||||
@@ -348,7 +349,7 @@ class ListUnassigned extends BaseListUnassigned
|
||||
$taskGroupVariable = trim($row["TAS_GROUP_VARIABLE"], " @#");
|
||||
$delPreviusUsrUid = '';
|
||||
$unaUid = $this->newRow($row,$delPreviusUsrUid);
|
||||
//Selfservice by group
|
||||
//Selfservice by group
|
||||
if ($taskGroupVariable != "" && isset($applicationData[$taskGroupVariable]) && trim($applicationData[$taskGroupVariable]) != "") {
|
||||
$gprUid = trim($applicationData[$taskGroupVariable]);
|
||||
//Define Users by Group
|
||||
@@ -362,13 +363,13 @@ class ListUnassigned extends BaseListUnassigned
|
||||
} else {
|
||||
//Define all users assigned to Task
|
||||
$task = new TaskUser();
|
||||
$arrayUsers = $task->getAllUsersTask($row["TAS_UID"]);
|
||||
$arrayUsers = $task->getAllUsersTask($row["TAS_UID"]);
|
||||
foreach($arrayUsers as $urow){
|
||||
$newRow["USR_UID"] = $urow["USR_UID"];
|
||||
$listUnassignedGpr = new ListUnassignedGroup();
|
||||
$listUnassignedGpr->newRow($unaUid,$urow["USR_UID"],"USER","");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
|
||||
@@ -104,34 +104,45 @@ try {
|
||||
$filters['dir'] = 'DESC';
|
||||
}
|
||||
|
||||
$result = $list->loadList($userUid, $filters);
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$value) {
|
||||
if (isset($value['DEL_PREVIOUS_USR_UID'])) {
|
||||
$value['PREVIOUS_USR_UID'] = $value['DEL_PREVIOUS_USR_UID'];
|
||||
$value['PREVIOUS_USR_USERNAME'] = $value['DEL_PREVIOUS_USR_USERNAME'];
|
||||
$value['PREVIOUS_USR_FIRSTNAME'] = $value['DEL_PREVIOUS_USR_FIRSTNAME'];
|
||||
$value['PREVIOUS_USR_LASTNAME'] = $value['DEL_PREVIOUS_USR_LASTNAME'];
|
||||
}
|
||||
if (isset($value['DEL_DUE_DATE'])) {
|
||||
$value['DEL_TASK_DUE_DATE'] = $value['DEL_DUE_DATE'];
|
||||
}
|
||||
if (isset($value['APP_PAUSED_DATE'])) {
|
||||
$value['APP_UPDATE_DATE'] = $value['APP_PAUSED_DATE'];
|
||||
}
|
||||
if (isset($value['DEL_CURRENT_USR_USERNAME'])) {
|
||||
$value['USR_USERNAME'] = $value['DEL_CURRENT_USR_USERNAME'];
|
||||
$value['USR_FIRSTNAME'] = $value['DEL_CURRENT_USR_FIRSTNAME'];
|
||||
$value['USR_LASTNAME'] = $value['DEL_CURRENT_USR_LASTNAME'];
|
||||
$value['APP_UPDATE_DATE'] = $value['DEL_DELEGATE_DATE'];
|
||||
}
|
||||
if (isset($value['APP_STATUS'])) {
|
||||
$value['APP_STATUS_LABEL'] = G::LoadTranslation( "ID_{$value['APP_STATUS']}" );
|
||||
}
|
||||
$result = $list->loadList(
|
||||
$userUid,
|
||||
$filters,
|
||||
function (array $record)
|
||||
{
|
||||
try {
|
||||
if (isset($record["DEL_PREVIOUS_USR_UID"])) {
|
||||
$record["PREVIOUS_USR_UID"] = $record["DEL_PREVIOUS_USR_UID"];
|
||||
$record["PREVIOUS_USR_USERNAME"] = $record["DEL_PREVIOUS_USR_USERNAME"];
|
||||
$record["PREVIOUS_USR_FIRSTNAME"] = $record["DEL_PREVIOUS_USR_FIRSTNAME"];
|
||||
$record["PREVIOUS_USR_LASTNAME"] = $record["DEL_PREVIOUS_USR_LASTNAME"];
|
||||
}
|
||||
|
||||
//$value = array_change_key_case($value, CASE_LOWER);
|
||||
if (isset($record["DEL_DUE_DATE"])) {
|
||||
$record["DEL_TASK_DUE_DATE"] = $record["DEL_DUE_DATE"];
|
||||
}
|
||||
|
||||
if (isset($record["APP_PAUSED_DATE"])) {
|
||||
$record["APP_UPDATE_DATE"] = $record["APP_PAUSED_DATE"];
|
||||
}
|
||||
|
||||
if (isset($record["DEL_CURRENT_USR_USERNAME"])) {
|
||||
$record["USR_USERNAME"] = $record["DEL_CURRENT_USR_USERNAME"];
|
||||
$record["USR_FIRSTNAME"] = $record["DEL_CURRENT_USR_FIRSTNAME"];
|
||||
$record["USR_LASTNAME"] = $record["DEL_CURRENT_USR_LASTNAME"];
|
||||
$record["APP_UPDATE_DATE"] = $record["DEL_DELEGATE_DATE"];
|
||||
}
|
||||
|
||||
if (isset($record["APP_STATUS"])) {
|
||||
$record["APP_STATUS_LABEL"] = G::LoadTranslation("ID_" . $record["APP_STATUS"]);
|
||||
}
|
||||
|
||||
//Return
|
||||
return $record;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$filtersData = array();
|
||||
$filtersData['start'] = $filters['start'];
|
||||
@@ -143,12 +154,16 @@ try {
|
||||
$filtersData['search'] = $filters['search'];
|
||||
$filtersData['date_from'] = $filters['dateFrom'];
|
||||
$filtersData['date_to'] = $filters['dateTo'];
|
||||
$filtersData["action"] = $filters["action"];
|
||||
|
||||
$response = array();
|
||||
$response['filters'] = $filtersData;
|
||||
$response['data'] = $result;
|
||||
$filtersData['action'] = $filters['action'];
|
||||
$response['totalCount'] = $list->countTotal($userUid, $filtersData);
|
||||
|
||||
|
||||
$response = $filter->xssFilterHard($response);
|
||||
|
||||
$response["data"] = $result;
|
||||
|
||||
echo G::json_encode($response);
|
||||
} catch (Exception $e) {
|
||||
$msg = array("error" => $e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user