Merged in bugfix/HOR-4075 (pull request #6192)
HOR-4075 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com> Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
24
workflow/engine/classes/ListAdditionalColumnsInterface.php
Normal file
24
workflow/engine/classes/ListAdditionalColumnsInterface.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* The list implement additional columns.
|
||||
*
|
||||
*/
|
||||
interface ListAdditionalColumnsInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the $additionalClassName value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAdditionalClassName();
|
||||
|
||||
/**
|
||||
* Set the value of $additionalClassName.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setAdditionalClassName($v);
|
||||
}
|
||||
27
workflow/engine/classes/ListCreateUpdateInterface.php
Normal file
27
workflow/engine/classes/ListCreateUpdateInterface.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* The list can create and update records.
|
||||
*
|
||||
*/
|
||||
interface ListCreateUpdateInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Create an application record into list.
|
||||
*
|
||||
* @param type $data
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($data);
|
||||
|
||||
/**
|
||||
* Update an application record from list.
|
||||
*
|
||||
* @param type $data
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($data);
|
||||
}
|
||||
42
workflow/engine/classes/ListInterface.php
Normal file
42
workflow/engine/classes/ListInterface.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Interface for list of cases
|
||||
*
|
||||
*/
|
||||
interface ListInterface extends ListCreateUpdateInterface, ListAdditionalColumnsInterface, ListUserDisplayFormatInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* This function add restriction in the query related to the filters.
|
||||
*
|
||||
* @param Criteria $criteria , must be contain only select of columns
|
||||
* @param array $filters
|
||||
* @param array $additionalColumns information about the new columns related to custom cases list
|
||||
*
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function loadFilters(&$criteria, $filters);
|
||||
|
||||
/**
|
||||
* This function get the information in the corresponding cases list.
|
||||
*
|
||||
* @param string $usr_uid , must be show cases related to this user
|
||||
* @param array $filters for apply in the result
|
||||
* @param callable $callbackRecord
|
||||
*
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function loadList($usr_uid, $filters = [], callable $callbackRecord = null);
|
||||
|
||||
/**
|
||||
* Returns the number of cases of a user.
|
||||
*
|
||||
* @param string $usrUid
|
||||
* @param array $filters
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCountList($usrUid, $filters = []);
|
||||
}
|
||||
24
workflow/engine/classes/ListUserDisplayFormatInterface.php
Normal file
24
workflow/engine/classes/ListUserDisplayFormatInterface.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* The list implements user name formated.
|
||||
*
|
||||
*/
|
||||
interface ListUserDisplayFormatInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the $userDisplayFormat value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserDisplayFormat();
|
||||
|
||||
/**
|
||||
* Set the value of $userDisplayFormat.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setUserDisplayFormat($v);
|
||||
}
|
||||
77
workflow/engine/classes/model/ListBaseTrait.php
Normal file
77
workflow/engine/classes/model/ListBaseTrait.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* List basic methods
|
||||
*
|
||||
*/
|
||||
trait ListBaseTrait
|
||||
{
|
||||
private $additionalClassName = '';
|
||||
private $userDisplayFormat = '';
|
||||
|
||||
/**
|
||||
* Get the $additionalClassName value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAdditionalClassName()
|
||||
{
|
||||
return $this->additionalClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of $additionalClassName.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setAdditionalClassName($v)
|
||||
{
|
||||
$this->additionalClassName = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the $userDisplayFormat value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserDisplayFormat()
|
||||
{
|
||||
return $this->userDisplayFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of $userDisplayFormat.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setUserDisplayFormat($v)
|
||||
{
|
||||
$this->userDisplayFormat = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of cases by class and user.
|
||||
*
|
||||
* @param type $peerClass
|
||||
* @param type $usrUid
|
||||
* @param type $filters
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
protected function getCountListFromPeer($peerClass, $usrUid, $filters = [])
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn('COUNT(*) AS TOTAL');
|
||||
$criteria->add($peerClass::USR_UID, $usrUid, Criteria::EQUAL);
|
||||
if (count($filters)) {
|
||||
self::loadFilters($criteria, $filters);
|
||||
}
|
||||
$dataset = $peerClass::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$row = $dataset->getRow();
|
||||
return (int) $row['TOTAL'];
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,10 @@ require_once 'classes/model/om/BaseListCanceled.php';
|
||||
* @package classes.model
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListCanceled extends BaseListCanceled
|
||||
class ListCanceled extends BaseListCanceled implements ListInterface
|
||||
{
|
||||
use ListBaseTrait;
|
||||
|
||||
// @codingStandardsIgnoreEnd
|
||||
/**
|
||||
* Create List Canceled Table
|
||||
@@ -283,7 +285,7 @@ class ListCanceled extends BaseListCanceled
|
||||
}
|
||||
}
|
||||
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
public function loadList($usr_uid, $filters = array(), callable $callbackRecord = null)
|
||||
{
|
||||
$resp = array();
|
||||
$criteria = new Criteria();
|
||||
@@ -346,16 +348,7 @@ class ListCanceled extends BaseListCanceled
|
||||
*/
|
||||
public function getCountList($usrUid, $filters = array())
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn('COUNT(*) AS TOTAL');
|
||||
$criteria->add(ListCanceledPeer::USR_UID, $usrUid, Criteria::EQUAL);
|
||||
if (count($filters)) {
|
||||
self::loadFilters($criteria, $filters);
|
||||
}
|
||||
$dataset = ListCanceledPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
return (int)$aRow['TOTAL'];
|
||||
return $this->getCountListFromPeer
|
||||
(ListCanceledPeer::class, $usrUid, $filters);
|
||||
}
|
||||
} // ListCanceled
|
||||
|
||||
@@ -15,8 +15,10 @@ require_once 'classes/model/om/BaseListCompleted.php';
|
||||
* @package classes.model
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListCompleted extends BaseListCompleted
|
||||
class ListCompleted extends BaseListCompleted implements ListInterface
|
||||
{
|
||||
use ListBaseTrait;
|
||||
|
||||
// @codingStandardsIgnoreEnd
|
||||
/**
|
||||
* Create List Completed Table
|
||||
@@ -271,7 +273,7 @@ class ListCompleted extends BaseListCompleted
|
||||
}
|
||||
}
|
||||
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
public function loadList($usr_uid, $filters = array(), callable $callbackRecord = null)
|
||||
{
|
||||
$resp = array();
|
||||
$criteria = new Criteria();
|
||||
@@ -324,23 +326,16 @@ class ListCompleted extends BaseListCompleted
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of cases of a user
|
||||
* Returns the number of cases of a user.
|
||||
*
|
||||
* @param $usrUid
|
||||
* @param array $filters
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCountList($usrUid, $filters = array())
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn('COUNT(*) AS TOTAL');
|
||||
$criteria->add(ListCompletedPeer::USR_UID, $usrUid, Criteria::EQUAL);
|
||||
if (count($filters)) {
|
||||
self::loadFilters($criteria, $filters);
|
||||
}
|
||||
$dataset = ListCompletedPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
return (int)$aRow['TOTAL'];
|
||||
return $this->getCountListFromPeer
|
||||
(ListCompletedPeer::class, $usrUid, $filters);
|
||||
}
|
||||
} // ListCompleted
|
||||
|
||||
@@ -15,52 +15,9 @@ use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
* @package classes.model
|
||||
*/
|
||||
|
||||
class ListInbox extends BaseListInbox
|
||||
class ListInbox extends BaseListInbox implements ListInterface
|
||||
{
|
||||
private $additionalClassName = '';
|
||||
private $userDisplayFormat = '';
|
||||
|
||||
/**
|
||||
* Get the $additionalClassName value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAdditionalClassName()
|
||||
{
|
||||
return $this->additionalClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of $additionalClassName.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setAdditionalClassName($v)
|
||||
{
|
||||
$this->additionalClassName = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the $userDisplayFormat value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserDisplayFormat()
|
||||
{
|
||||
return $this->userDisplayFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of $userDisplayFormat.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setUserDisplayFormat($v)
|
||||
{
|
||||
$this->userDisplayFormat = $v;
|
||||
}
|
||||
use ListBaseTrait;
|
||||
|
||||
/**
|
||||
* Create List Inbox Table
|
||||
@@ -569,7 +526,7 @@ class ListInbox extends BaseListInbox
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
public function loadList($usr_uid, $filters = array(), callable $callbackRecord = null)
|
||||
{
|
||||
$pmTable = new PmTable();
|
||||
$list = isset($filters['action']) ? $filters['action'] : "";
|
||||
@@ -713,7 +670,7 @@ class ListInbox extends BaseListInbox
|
||||
$dataset = ListInboxPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
return (int)$aRow['TOTAL'];
|
||||
$row = $dataset->getRow();
|
||||
return (int) $row['TOTAL'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,10 @@ require_once 'classes/model/om/BaseListMyInbox.php';
|
||||
* @package classes.model
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListMyInbox extends BaseListMyInbox
|
||||
class ListMyInbox extends BaseListMyInbox implements ListInterface
|
||||
{
|
||||
use ListBaseTrait;
|
||||
|
||||
// @codingStandardsIgnoreEnd
|
||||
/**
|
||||
* Create List My Inbox Table
|
||||
@@ -248,7 +250,7 @@ class ListMyInbox extends BaseListMyInbox
|
||||
}
|
||||
}
|
||||
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
public function loadList($usr_uid, $filters = array(), callable $callbackRecord = null)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
|
||||
|
||||
@@ -15,8 +15,10 @@ require_once 'classes/model/om/BaseListParticipatedHistory.php';
|
||||
* @package classes.model
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListParticipatedHistory extends BaseListParticipatedHistory
|
||||
class ListParticipatedHistory extends BaseListParticipatedHistory implements ListInterface
|
||||
{
|
||||
use ListBaseTrait;
|
||||
|
||||
// @codingStandardsIgnoreEnd
|
||||
/**
|
||||
* Create List Participated History Table
|
||||
@@ -203,7 +205,7 @@ class ListParticipatedHistory extends BaseListParticipatedHistory
|
||||
}
|
||||
}
|
||||
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
public function loadList($usr_uid, $filters = array(), callable $callbackRecord = null)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
|
||||
|
||||
@@ -12,52 +12,9 @@ use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*/
|
||||
class ListParticipatedLast extends BaseListParticipatedLast
|
||||
class ListParticipatedLast extends BaseListParticipatedLast implements ListInterface
|
||||
{
|
||||
private $additionalClassName = '';
|
||||
private $userDisplayFormat = '';
|
||||
|
||||
/**
|
||||
* Get the $additionalClassName value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAdditionalClassName()
|
||||
{
|
||||
return $this->additionalClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of $additionalClassName.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setAdditionalClassName($v)
|
||||
{
|
||||
$this->additionalClassName = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the $userDisplayFormat value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserDisplayFormat()
|
||||
{
|
||||
return $this->userDisplayFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of $userDisplayFormat.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setUserDisplayFormat($v)
|
||||
{
|
||||
$this->userDisplayFormat = $v;
|
||||
}
|
||||
use ListBaseTrait;
|
||||
|
||||
/**
|
||||
* Create List Participated History Table.
|
||||
@@ -410,7 +367,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null, $appUid = '')
|
||||
public function loadList($usr_uid, $filters = array(), callable $callbackRecord = null, $appUid = '')
|
||||
{
|
||||
$pmTable = new PmTable();
|
||||
$criteria = $pmTable->addPMFieldsToList('sent');
|
||||
@@ -554,18 +511,8 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
*/
|
||||
public function getCountList($usrUid, $filters = array())
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn('COUNT(*) AS TOTAL');
|
||||
$criteria->add(ListParticipatedLastPeer::USR_UID, $usrUid, Criteria::EQUAL);
|
||||
if (count($filters)) {
|
||||
self::loadFilters($criteria, $filters);
|
||||
}
|
||||
$dataset = ListParticipatedLastPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
|
||||
return (int) $aRow['TOTAL'];
|
||||
return $this->getCountListFromPeer
|
||||
(ListParticipatedLastPeer::class, $usrUid, $filters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,52 +15,9 @@ use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
* @package classes.model
|
||||
*/
|
||||
|
||||
class ListPaused extends BaseListPaused
|
||||
class ListPaused extends BaseListPaused implements ListInterface
|
||||
{
|
||||
private $additionalClassName = '';
|
||||
private $userDisplayFormat = '';
|
||||
|
||||
/**
|
||||
* Get the $additionalClassName value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAdditionalClassName()
|
||||
{
|
||||
return $this->additionalClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of $additionalClassName.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setAdditionalClassName($v)
|
||||
{
|
||||
$this->additionalClassName = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the $userDisplayFormat value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserDisplayFormat()
|
||||
{
|
||||
return $this->userDisplayFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of $userDisplayFormat.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setUserDisplayFormat($v)
|
||||
{
|
||||
$this->userDisplayFormat = $v;
|
||||
}
|
||||
use ListBaseTrait;
|
||||
|
||||
/**
|
||||
* Create List Paused Table
|
||||
@@ -326,7 +283,7 @@ class ListPaused extends BaseListPaused
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
public function loadList($usr_uid, $filters = array(), callable $callbackRecord = null)
|
||||
{
|
||||
$resp = array();
|
||||
$pmTable = new PmTable();
|
||||
@@ -417,16 +374,7 @@ class ListPaused extends BaseListPaused
|
||||
*/
|
||||
public function getCountList($usrUid, $filters = array())
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn('COUNT(*) AS TOTAL');
|
||||
$criteria->add(ListPausedPeer::USR_UID, $usrUid, Criteria::EQUAL);
|
||||
if (count($filters)) {
|
||||
self::loadFilters($criteria, $filters);
|
||||
}
|
||||
$dataset = ListPausedPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
return (int)$aRow['TOTAL'];
|
||||
return $this->getCountListFromPeer
|
||||
(ListPausedPeer::class, $usrUid, $filters);
|
||||
}
|
||||
} // ListPaused
|
||||
|
||||
@@ -15,9 +15,10 @@ require_once 'classes/model/om/BaseListUnassigned.php';
|
||||
* @package classes.model
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListUnassigned extends BaseListUnassigned
|
||||
class ListUnassigned extends BaseListUnassigned implements ListInterface
|
||||
{
|
||||
private $additionalClassName = '';
|
||||
use ListBaseTrait;
|
||||
|
||||
private $total = 0;
|
||||
|
||||
/**
|
||||
@@ -192,7 +193,7 @@ class ListUnassigned extends BaseListUnassigned
|
||||
} else {
|
||||
//If we have additional tables configured in the custom cases list, prepare the variables for search
|
||||
$casesList = new \ProcessMaker\BusinessModel\Cases();
|
||||
$casesList->getSearchCriteriaListCases($criteria, __CLASS__ . 'Peer', $search, $this->additionalClassName, $additionalColumns);
|
||||
$casesList->getSearchCriteriaListCases($criteria, __CLASS__ . 'Peer', $search, $this->getAdditionalClassName(), $additionalColumns);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +229,7 @@ class ListUnassigned extends BaseListUnassigned
|
||||
{
|
||||
$pmTable = new PmTable();
|
||||
$criteria = $pmTable->addPMFieldsToList('unassigned');
|
||||
$this->additionalClassName = $pmTable->tableClassName;
|
||||
$this->setAdditionalClassName($pmTable->tableClassName);
|
||||
$additionalColumns = $criteria->getSelectColumns();
|
||||
|
||||
$criteria->addSelectColumn(ListUnassignedPeer::APP_UID);
|
||||
@@ -260,8 +261,9 @@ class ListUnassigned extends BaseListUnassigned
|
||||
BasePeer::TYPE_FIELDNAME,
|
||||
empty($filters['sort']) ? "DEL_DELEGATE_DATE" : $filters['sort'],
|
||||
"DEL_DELEGATE_DATE",
|
||||
$this->additionalClassName,
|
||||
$additionalColumns
|
||||
$this->getAdditionalClassName(),
|
||||
$additionalColumns,
|
||||
$this->getUserDisplayFormat()
|
||||
);
|
||||
|
||||
$dir = isset($filters['dir']) ? $filters['dir'] : "ASC";
|
||||
@@ -269,10 +271,20 @@ class ListUnassigned extends BaseListUnassigned
|
||||
$limit = isset($filters['limit']) ? $filters['limit'] : "25";
|
||||
$paged = isset($filters['paged']) ? $filters['paged'] : 1;
|
||||
$count = isset($filters['count']) ? $filters['count'] : 1;
|
||||
if ($dir == "DESC") {
|
||||
$criteria->addDescendingOrderByColumn($sort);
|
||||
if (is_array($sort) && count($sort) > 0) {
|
||||
foreach ($sort as $key) {
|
||||
if ($dir == 'DESC') {
|
||||
$criteria->addDescendingOrderByColumn($key);
|
||||
} else {
|
||||
$criteria->addAscendingOrderByColumn($key);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$criteria->addAscendingOrderByColumn($sort);
|
||||
if ($dir == 'DESC') {
|
||||
$criteria->addDescendingOrderByColumn($sort);
|
||||
} else {
|
||||
$criteria->addAscendingOrderByColumn($sort);
|
||||
}
|
||||
}
|
||||
$this->total = ListUnassignedPeer::doCount($criteria);
|
||||
if ($paged == 1) {
|
||||
|
||||
@@ -3582,6 +3582,9 @@ class Cases
|
||||
break;
|
||||
case 'USR_UID':
|
||||
$columnSort = $this->buildOrderFieldFormatted($columnsList, $userDisplayFormat, 'DEL_CURRENT_');
|
||||
if (empty($columnSort)) {
|
||||
$columnSort = $this->buildOrderFieldFormatted($columnsList, $userDisplayFormat, '', false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$columnSort = $listPeer::TABLE_NAME . '.' . $sort;
|
||||
@@ -3612,13 +3615,13 @@ class Cases
|
||||
*
|
||||
* @return array $columnSort, columns by apply the sql command ORDER BY
|
||||
*/
|
||||
public function buildOrderFieldFormatted($columnsList, $format, $prefix = 'DEL_PREVIOUS_')
|
||||
public function buildOrderFieldFormatted($columnsList, $format, $prefix = 'DEL_PREVIOUS_', $validate = true)
|
||||
{
|
||||
$columnSort = [];
|
||||
|
||||
if (in_array($prefix . 'USR_FIRSTNAME', $columnsList) &&
|
||||
if (!$validate || (in_array($prefix . 'USR_FIRSTNAME', $columnsList) &&
|
||||
in_array($prefix . 'USR_LASTNAME', $columnsList) &&
|
||||
in_array($prefix . 'USR_USERNAME', $columnsList)
|
||||
in_array($prefix . 'USR_USERNAME', $columnsList))
|
||||
) {
|
||||
switch ($format) {
|
||||
case '@firstName @lastName':
|
||||
|
||||
Reference in New Issue
Block a user