Merged in bugfix/HOR-3521-A (pull request #6117)

HOR-3521

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2017-10-25 19:00:09 +00:00
committed by Julio Cesar Laura Avendaño
5 changed files with 323 additions and 61 deletions

View File

@@ -1,6 +1,7 @@
<?php <?php
require_once 'classes/model/om/BaseListInbox.php'; require_once 'classes/model/om/BaseListInbox.php';
use ProcessMaker\BusinessModel\Cases as BmCases;
/** /**
* Skeleton subclass for representing a row from the 'LIST_INBOX' table. * Skeleton subclass for representing a row from the 'LIST_INBOX' table.
@@ -13,17 +14,60 @@ require_once 'classes/model/om/BaseListInbox.php';
* *
* @package classes.model * @package classes.model
*/ */
// @codingStandardsIgnoreStart
class ListInbox extends BaseListInbox class ListInbox extends BaseListInbox
{ {
private $additionalClassName = ''; 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;
}
/** /**
* Create List Inbox Table * Create List Inbox Table
* *
* @param type $data * @param type $data
* @return type * @return type
* * @throws Exception
*/ */
public function create($data, $isSelfService = false) public function create($data, $isSelfService = false)
{ {
@@ -115,7 +159,7 @@ class ListInbox extends BaseListInbox
* *
* @param type $data * @param type $data
* @return type * @return type
* @throws type * @throws Exception
*/ */
public function update($data, $isSelfService = false) public function update($data, $isSelfService = false)
{ {
@@ -209,7 +253,7 @@ class ListInbox extends BaseListInbox
* *
* @param type $seqName * @param type $seqName
* @return type * @return type
* @throws type * @throws Exception
* *
*/ */
public function remove($app_uid, $del_index) public function remove($app_uid, $del_index)
@@ -233,7 +277,7 @@ class ListInbox extends BaseListInbox
* *
* @param type $seqName * @param type $seqName
* @return type * @return type
* @throws type * @throws Exception
* *
*/ */
public function removeAll($app_uid) public function removeAll($app_uid)
@@ -478,8 +522,14 @@ class ListInbox extends BaseListInbox
$criteria->add(ListInboxPeer::APP_UID, $search, Criteria::EQUAL); $criteria->add(ListInboxPeer::APP_UID, $search, Criteria::EQUAL);
} else { } else {
//If we have additional tables configured in the custom cases list, prepare the variables for search //If we have additional tables configured in the custom cases list, prepare the variables for search
$casesList = new \ProcessMaker\BusinessModel\Cases(); $casesList = new BmCases();
$casesList->getSearchCriteriaListCases($criteria, __CLASS__ . 'Peer', $search, $this->additionalClassName, $additionalColumns); $casesList->getSearchCriteriaListCases(
$criteria,
__CLASS__ . 'Peer',
$search,
$this->getAdditionalClassName(),
$additionalColumns
);
} }
} }
@@ -515,7 +565,7 @@ class ListInbox extends BaseListInbox
* This function get the information in the corresponding cases list * This function get the information in the corresponding cases list
* @param string $usr_uid, must be show cases related to this user * @param string $usr_uid, must be show cases related to this user
* @param array $filters for apply in the result * @param array $filters for apply in the result
* @param null $callbackRecord * @param callable $callbackRecord
* @return array $data * @return array $data
* @throws PropelException * @throws PropelException
*/ */
@@ -524,7 +574,7 @@ class ListInbox extends BaseListInbox
$pmTable = new PmTable(); $pmTable = new PmTable();
$list = isset($filters['action']) ? $filters['action'] : ""; $list = isset($filters['action']) ? $filters['action'] : "";
$criteria = $pmTable->addPMFieldsToList($list); $criteria = $pmTable->addPMFieldsToList($list);
$this->additionalClassName = $pmTable->tableClassName; $this->setAdditionalClassName($pmTable->tableClassName);
$additionalColumns = $criteria->getSelectColumns(); $additionalColumns = $criteria->getSelectColumns();
$filters['usr_uid'] = $usr_uid; $filters['usr_uid'] = $usr_uid;
@@ -556,14 +606,16 @@ class ListInbox extends BaseListInbox
self::loadFilters($criteria, $filters, $additionalColumns); self::loadFilters($criteria, $filters, $additionalColumns);
//We will be defined the sort //We will be defined the sort
$casesList = new \ProcessMaker\BusinessModel\Cases(); $casesList = new BmCases();
$sort = $casesList->getSortColumn( $sort = $casesList->getSortColumn(
__CLASS__ . 'Peer', __CLASS__ . 'Peer',
BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_FIELDNAME,
empty($filters['sort']) ? "APP_UPDATE_DATE" : $filters['sort'], empty($filters['sort']) ? "APP_UPDATE_DATE" : $filters['sort'],
"APP_UPDATE_DATE", "APP_UPDATE_DATE",
$this->additionalClassName, $this->getAdditionalClassName(),
$additionalColumns $additionalColumns,
$this->getUserDisplayFormat()
); );
$dir = isset($filters['dir']) ? $filters['dir'] : "ASC"; $dir = isset($filters['dir']) ? $filters['dir'] : "ASC";
@@ -571,10 +623,20 @@ class ListInbox extends BaseListInbox
$limit = isset($filters['limit']) ? $filters['limit'] : "25"; $limit = isset($filters['limit']) ? $filters['limit'] : "25";
$paged = isset($filters['paged']) ? $filters['paged'] : 1; $paged = isset($filters['paged']) ? $filters['paged'] : 1;
if ($dir == "DESC") { if (is_array($sort) && count($sort) > 0) {
$criteria->addDescendingOrderByColumn($sort); foreach ($sort as $key) {
if ($dir == 'DESC') {
$criteria->addDescendingOrderByColumn($key);
} else {
$criteria->addAscendingOrderByColumn($key);
}
}
} else { } else {
$criteria->addAscendingOrderByColumn($sort); if ($dir == 'DESC') {
$criteria->addDescendingOrderByColumn($sort);
} else {
$criteria->addAscendingOrderByColumn($sort);
}
} }
if ($paged == 1) { if ($paged == 1) {

View File

@@ -1,7 +1,7 @@
<?php <?php
// @codingStandardsIgnoreStart
require_once 'classes/model/om/BaseListParticipatedLast.php'; require_once 'classes/model/om/BaseListParticipatedLast.php';
use ProcessMaker\BusinessModel\Cases as BmCases;
/** /**
* Skeleton subclass for representing a row from the 'LIST_PARTICIPATED_LAST' table. * Skeleton subclass for representing a row from the 'LIST_PARTICIPATED_LAST' table.
@@ -15,6 +15,49 @@ require_once 'classes/model/om/BaseListParticipatedLast.php';
class ListParticipatedLast extends BaseListParticipatedLast class ListParticipatedLast extends BaseListParticipatedLast
{ {
private $additionalClassName = ''; 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;
}
/** /**
* Create List Participated History Table. * Create List Participated History Table.
@@ -22,6 +65,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
* @param type $data * @param type $data
* *
* @return type * @return type
* @throws Exception
*/ */
public function create($data) public function create($data)
{ {
@@ -142,7 +186,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
* *
* @return type * @return type
* *
* @throws type * @throws Exception
*/ */
public function update($data) public function update($data)
{ {
@@ -180,11 +224,12 @@ class ListParticipatedLast extends BaseListParticipatedLast
/** /**
* Refresh List Participated Last. * Refresh List Participated Last.
* *
* @param type $seqName * @param array $data
* @param boolean $isSelfService
* *
* @return type * @return type
* *
* @throws type * @throws Exception
*/ */
public function refresh($data, $isSelfService = false) public function refresh($data, $isSelfService = false)
{ {
@@ -235,11 +280,13 @@ class ListParticipatedLast extends BaseListParticipatedLast
/** /**
* Remove List Participated History. * Remove List Participated History.
* *
* @param type $seqName * @param string $app_uid
* @param string $usr_uid
* @param integer $del_index
* *
* @return type * @return type
* *
* @throws type * @throws Exception
*/ */
public function remove($app_uid, $usr_uid, $del_index) public function remove($app_uid, $usr_uid, $del_index)
{ {
@@ -319,8 +366,14 @@ class ListParticipatedLast extends BaseListParticipatedLast
$criteria->add(ListParticipatedLastPeer::APP_UID, $search, Criteria::EQUAL); $criteria->add(ListParticipatedLastPeer::APP_UID, $search, Criteria::EQUAL);
} else { } else {
//If we have additional tables configured in the custom cases list, prepare the variables for search //If we have additional tables configured in the custom cases list, prepare the variables for search
$casesList = new \ProcessMaker\BusinessModel\Cases(); $casesList = new BmCases();
$casesList->getSearchCriteriaListCases($criteria, __CLASS__ . 'Peer', $search, $this->additionalClassName, $additionalColumns); $casesList->getSearchCriteriaListCases(
$criteria,
__CLASS__ . 'Peer',
$search,
$this->getAdditionalClassName(),
$additionalColumns
);
} }
} }
@@ -352,7 +405,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
* This function get the information in the corresponding cases list * This function get the information in the corresponding cases list
* @param string $usr_uid, must be show cases related to this user * @param string $usr_uid, must be show cases related to this user
* @param array $filters for apply in the result * @param array $filters for apply in the result
* @param null $callbackRecord * @param callable $callbackRecord
* @param string $appUid related to the specific case * @param string $appUid related to the specific case
* @return array $data * @return array $data
* @throws PropelException * @throws PropelException
@@ -361,7 +414,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
{ {
$pmTable = new PmTable(); $pmTable = new PmTable();
$criteria = $pmTable->addPMFieldsToList('sent'); $criteria = $pmTable->addPMFieldsToList('sent');
$this->additionalClassName = $pmTable->tableClassName; $this->setAdditionalClassName($pmTable->tableClassName);
$additionalColumns = $criteria->getSelectColumns(); $additionalColumns = $criteria->getSelectColumns();
$criteria->addSelectColumn(ListParticipatedLastPeer::APP_UID); $criteria->addSelectColumn(ListParticipatedLastPeer::APP_UID);
@@ -397,14 +450,15 @@ class ListParticipatedLast extends BaseListParticipatedLast
self::loadFilters($criteria, $filters, $additionalColumns); self::loadFilters($criteria, $filters, $additionalColumns);
//We will be defined the sort //We will be defined the sort
$casesList = new \ProcessMaker\BusinessModel\Cases(); $casesList = new BmCases();
$sort = $casesList->getSortColumn( $sort = $casesList->getSortColumn(
__CLASS__ . 'Peer', __CLASS__ . 'Peer',
BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_FIELDNAME,
empty($filters['sort']) ? "DEL_DELEGATE_DATE" : $filters['sort'], empty($filters['sort']) ? "DEL_DELEGATE_DATE" : $filters['sort'],
"DEL_DELEGATE_DATE", "DEL_DELEGATE_DATE",
$this->additionalClassName, $this->getAdditionalClassName(),
$additionalColumns $additionalColumns,
$this->getUserDisplayFormat()
); );
$dir = isset($filters['dir']) ? $filters['dir'] : 'ASC'; $dir = isset($filters['dir']) ? $filters['dir'] : 'ASC';
@@ -412,10 +466,20 @@ class ListParticipatedLast extends BaseListParticipatedLast
$limit = isset($filters['limit']) ? $filters['limit'] : '25'; $limit = isset($filters['limit']) ? $filters['limit'] : '25';
$paged = isset($filters['paged']) ? $filters['paged'] : 1; $paged = isset($filters['paged']) ? $filters['paged'] : 1;
if ($dir == 'DESC') { if (is_array($sort) && count($sort) > 0) {
$criteria->addDescendingOrderByColumn($sort); foreach ($sort as $key) {
if ($dir == 'DESC') {
$criteria->addDescendingOrderByColumn($key);
} else {
$criteria->addAscendingOrderByColumn($key);
}
}
} else { } else {
$criteria->addAscendingOrderByColumn($sort); if ($dir == 'DESC') {
$criteria->addDescendingOrderByColumn($sort);
} else {
$criteria->addAscendingOrderByColumn($sort);
}
} }
if ($paged == 1) { if ($paged == 1) {

View File

@@ -1,7 +1,7 @@
<?php <?php
require_once 'classes/model/om/BaseListPaused.php'; require_once 'classes/model/om/BaseListPaused.php';
use ProcessMaker\BusinessModel\Cases as BmCases;
/** /**
* Skeleton subclass for representing a row from the 'LIST_PAUSED' table. * Skeleton subclass for representing a row from the 'LIST_PAUSED' table.
@@ -14,17 +14,60 @@ require_once 'classes/model/om/BaseListPaused.php';
* *
* @package classes.model * @package classes.model
*/ */
// @codingStandardsIgnoreStart
class ListPaused extends BaseListPaused class ListPaused extends BaseListPaused
{ {
private $additionalClassName = ''; 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;
}
/** /**
* Create List Paused Table * Create List Paused Table
* *
* @param type $data * @param type $data
* @return type * @return type
* * @throws Exception
*/ */
public function create($data) public function create($data)
{ {
@@ -153,7 +196,7 @@ class ListPaused extends BaseListPaused
* *
* @param type $data * @param type $data
* @return type * @return type
* @throws type * @throws Exception
*/ */
public function update($data) public function update($data)
{ {
@@ -187,9 +230,12 @@ class ListPaused extends BaseListPaused
/** /**
* Remove List Paused * Remove List Paused
* *
* @param type $seqName * @param string $app_uid
* @param integer $del_index
* @param array $data_inbox
*
* @return type * @return type
* @throws type * @throws Exception
* *
*/ */
public function remove($app_uid, $del_index, $data_inbox) public function remove($app_uid, $del_index, $data_inbox)
@@ -246,8 +292,14 @@ class ListPaused extends BaseListPaused
$criteria->add(ListPausedPeer::APP_UID, $search, Criteria::EQUAL); $criteria->add(ListPausedPeer::APP_UID, $search, Criteria::EQUAL);
} else { } else {
//If we have additional tables configured in the custom cases list, prepare the variables for search //If we have additional tables configured in the custom cases list, prepare the variables for search
$casesList = new \ProcessMaker\BusinessModel\Cases(); $casesList = new BmCases();
$casesList->getSearchCriteriaListCases($criteria, __CLASS__ . 'Peer', $search, $this->additionalClassName, $additionalColumns); $casesList->getSearchCriteriaListCases(
$criteria,
__CLASS__ . 'Peer',
$search,
$this->getAdditionalClassName(),
$additionalColumns
);
} }
} }
@@ -270,7 +322,7 @@ class ListPaused extends BaseListPaused
* This function get the information in the corresponding cases list * This function get the information in the corresponding cases list
* @param string $usr_uid, must be show cases related to this user * @param string $usr_uid, must be show cases related to this user
* @param array $filters for apply in the result * @param array $filters for apply in the result
* @param null $callbackRecord * @param callable $callbackRecord
* @return array $data * @return array $data
* @throws PropelException * @throws PropelException
*/ */
@@ -279,7 +331,7 @@ class ListPaused extends BaseListPaused
$resp = array(); $resp = array();
$pmTable = new PmTable(); $pmTable = new PmTable();
$criteria = $pmTable->addPMFieldsToList('paused'); $criteria = $pmTable->addPMFieldsToList('paused');
$this->additionalClassName = $pmTable->tableClassName; $this->setAdditionalClassName($pmTable->tableClassName);
$additionalColumns = $criteria->getSelectColumns(); $additionalColumns = $criteria->getSelectColumns();
$criteria->addSelectColumn(ListPausedPeer::APP_UID); $criteria->addSelectColumn(ListPausedPeer::APP_UID);
@@ -308,14 +360,15 @@ class ListPaused extends BaseListPaused
self::loadFilters($criteria, $filters, $additionalColumns); self::loadFilters($criteria, $filters, $additionalColumns);
//We will be defined the sort //We will be defined the sort
$casesList = new \ProcessMaker\BusinessModel\Cases(); $casesList = new BmCases();
$sort = $casesList->getSortColumn( $sort = $casesList->getSortColumn(
__CLASS__ . 'Peer', __CLASS__ . 'Peer',
BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_FIELDNAME,
empty($filters['sort']) ? "APP_PAUSED_DATE" : $filters['sort'], empty($filters['sort']) ? "APP_PAUSED_DATE" : $filters['sort'],
"APP_PAUSED_DATE", "APP_PAUSED_DATE",
$this->additionalClassName, $this->getAdditionalClassName(),
$additionalColumns $additionalColumns,
$this->getUserDisplayFormat()
); );
$dir = isset($filters['dir']) ? $filters['dir'] : "ASC"; $dir = isset($filters['dir']) ? $filters['dir'] : "ASC";
@@ -323,10 +376,20 @@ class ListPaused extends BaseListPaused
$limit = isset($filters['limit']) ? $filters['limit'] : "25"; $limit = isset($filters['limit']) ? $filters['limit'] : "25";
$paged = isset($filters['paged']) ? $filters['paged'] : 1; $paged = isset($filters['paged']) ? $filters['paged'] : 1;
if ($dir == "DESC") { if (is_array($sort) && count($sort) > 0) {
$criteria->addDescendingOrderByColumn($sort); foreach ($sort as $key) {
if ($dir == 'DESC') {
$criteria->addDescendingOrderByColumn($key);
} else {
$criteria->addAscendingOrderByColumn($key);
}
}
} else { } else {
$criteria->addAscendingOrderByColumn($sort); if ($dir == 'DESC') {
$criteria->addDescendingOrderByColumn($sort);
} else {
$criteria->addAscendingOrderByColumn($sort);
}
} }
if ($paged == 1) { if ($paged == 1) {

View File

@@ -90,8 +90,11 @@ try {
$filters['limit'] = (int)$filters['limit']; $filters['limit'] = (int)$filters['limit'];
$filters['limit'] = abs($filters['limit']); $filters['limit'] = abs($filters['limit']);
$conf = new Configurations();
$formats = $conf->getFormats();
$list->setUserDisplayFormat($formats['format']);
if ($filters['limit'] == 0) { if ($filters['limit'] == 0) {
$conf = new Configurations();
$generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', ''); $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
if (isset($generalConfCasesList['casesListRowNumber'])) { if (isset($generalConfCasesList['casesListRowNumber'])) {
$filters['limit'] = (int)$generalConfCasesList['casesListRowNumber']; $filters['limit'] = (int)$generalConfCasesList['casesListRowNumber'];
@@ -101,10 +104,11 @@ try {
} else { } else {
$filters['limit'] = (int)$filters['limit']; $filters['limit'] = (int)$filters['limit'];
} }
switch ($filters['sort']) { switch ($filters['sort']) {
case 'APP_CURRENT_USER': case 'APP_CURRENT_USER':
$filters['sort'] = 'DEL_CURRENT_USR_LASTNAME'; //This value is format according to the userDisplayFormat, for this reason we will sent the UID
$filters['sort'] = 'USR_UID';
break; break;
case 'DEL_TASK_DUE_DATE': case 'DEL_TASK_DUE_DATE':
$filters['sort'] = 'DEL_DUE_DATE'; $filters['sort'] = 'DEL_DUE_DATE';
@@ -113,7 +117,8 @@ try {
$filters['sort'] = 'DEL_DELEGATE_DATE'; $filters['sort'] = 'DEL_DELEGATE_DATE';
break; break;
case 'APP_DEL_PREVIOUS_USER': case 'APP_DEL_PREVIOUS_USER':
$filters['sort'] = 'DEL_DUE_DATE'; //This value is format according to the userDisplayFormat, for this reason we will sent the UID
$filters['sort'] = 'DEL_PREVIOUS_USR_UID';
break; break;
case 'DEL_CURRENT_TAS_TITLE': case 'DEL_CURRENT_TAS_TITLE':
$filters['sort'] = 'APP_TAS_TITLE'; $filters['sort'] = 'APP_TAS_TITLE';

View File

@@ -3539,13 +3539,15 @@ class Cases
* This function get the table.column by order by the result * This function get the table.column by order by the result
* We can include the additional table related to the custom cases list * We can include the additional table related to the custom cases list
* *
* @param string $listPeer , name of the list class * @param string $listPeer, name of the list class
* @param string $field , name of the fieldName * @param string $field, name of the fieldName
* @param string $sort , name of column by sort * @param string $sort, name of column by sort
* @param string $defaultSort , name of column by sort default * @param string $defaultSort, name of column by sort default
* @param string $additionalClassName , name of the className of pmTable * @param string $additionalClassName, name of the className of pmTable
* @param array $additionalColumns , columns related to the custom cases list with the format TABLE_NAME.COLUMN_NAME * @param array $additionalColumns, columns related to the custom cases list with the format TABLE_NAME.COLUMN_NAME
* @return string $tableName * @param string $userDisplayFormat, user information display format
*
* @return string|array could be an string $tableName, could be an array $columnSort
*/ */
public function getSortColumn( public function getSortColumn(
$listPeer, $listPeer,
@@ -3553,7 +3555,8 @@ class Cases
$sort, $sort,
$defaultSort, $defaultSort,
$additionalClassName = '', $additionalClassName = '',
$additionalColumns = array() $additionalColumns = array(),
$userDisplayFormat = ''
) { ) {
$columnSort = $defaultSort; $columnSort = $defaultSort;
$tableName = ''; $tableName = '';
@@ -3561,7 +3564,16 @@ class Cases
//We will check if the column by sort is a LIST table //We will check if the column by sort is a LIST table
$columnsList = $listPeer::getFieldNames($field); $columnsList = $listPeer::getFieldNames($field);
if (in_array($sort, $columnsList)) { if (in_array($sort, $columnsList)) {
$columnSort = $listPeer::TABLE_NAME . '.' . $sort; switch ($sort) {
case 'DEL_PREVIOUS_USR_UID':
$columnSort = $this->buildOrderFieldFormatted($columnsList, $userDisplayFormat, 'DEL_PREVIOUS_');
break;
case 'USR_UID':
$columnSort = $this->buildOrderFieldFormatted($columnsList, $userDisplayFormat, 'DEL_CURRENT_');
break;
default:
$columnSort = $listPeer::TABLE_NAME . '.' . $sort;
}
} else { } else {
//We will sort by CUSTOM CASE LIST table //We will sort by CUSTOM CASE LIST table
if (count($additionalColumns) > 0) { if (count($additionalColumns) > 0) {
@@ -3580,7 +3592,63 @@ class Cases
} }
/** /**
* This function verify if the user is a supervisor * When we order columns related to the user information we need to use the userDisplayFormat
*
* @param array $columnsList, the list of columns in the table
* @param string $format, the user display format
* @param string $prefix, the initial name of the columns related to the USR_FIRSTNAME USR_LASTNAME USR_USERNAME
*
* @return array $columnSort, columns by apply the sql command ORDER BY
*/
public function buildOrderFieldFormatted($columnsList, $format, $prefix = 'DEL_PREVIOUS_')
{
$columnSort = [];
if (in_array($prefix . 'USR_FIRSTNAME', $columnsList) &&
in_array($prefix . 'USR_LASTNAME', $columnsList) &&
in_array($prefix . 'USR_USERNAME', $columnsList)
) {
switch ($format) {
case '@firstName @lastName':
array_push($columnSort, $prefix . 'USR_FIRSTNAME');
array_push($columnSort, $prefix . 'USR_LASTNAME');
break;
case '@firstName @lastName (@userName)':
array_push($columnSort, $prefix . 'USR_FIRSTNAME');
array_push($columnSort, $prefix . 'USR_LASTNAME');
array_push($columnSort, $prefix . 'USR_USERNAME');
break;
case '@userName':
array_push($columnSort, $prefix . 'USR_USERNAME');
break;
case '@userName (@firstName @lastName)':
array_push($columnSort, $prefix . 'USR_USERNAME');
array_push($columnSort, $prefix . 'USR_FIRSTNAME');
array_push($columnSort, $prefix . 'USR_LASTNAME');
break;
case '@lastName, @firstName':
array_push($columnSort, $prefix . 'USR_LASTNAME');
array_push($columnSort, $prefix . 'USR_FIRSTNAME');
break;
case '@lastName @firstName':
array_push($columnSort, $prefix . 'USR_LASTNAME');
array_push($columnSort, $prefix . 'USR_FIRSTNAME');
break;
case '@lastName, @firstName (@userName)':
array_push($columnSort, $prefix . 'USR_LASTNAME');
array_push($columnSort, $prefix . 'USR_FIRSTNAME');
array_push($columnSort, $prefix . 'USR_USERNAME');
break;
default:
array_push($columnSort, $prefix . 'USR_USERNAME');
break;
}
}
return $columnSort;
}
/** This function verify if the user is a supervisor
* If we send the formUid we will to review if has the object form assigned * If we send the formUid we will to review if has the object form assigned
* *
* @param string $usrUid, Uid related to the user * @param string $usrUid, Uid related to the user