HOR-3521
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?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.
|
||||
@@ -13,17 +14,60 @@ require_once 'classes/model/om/BaseListInbox.php';
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
|
||||
class ListInbox extends BaseListInbox
|
||||
{
|
||||
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
|
||||
*
|
||||
* @param type $data
|
||||
* @return type
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($data, $isSelfService = false)
|
||||
{
|
||||
@@ -115,7 +159,7 @@ class ListInbox extends BaseListInbox
|
||||
*
|
||||
* @param type $data
|
||||
* @return type
|
||||
* @throws type
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($data, $isSelfService = false)
|
||||
{
|
||||
@@ -209,7 +253,7 @@ class ListInbox extends BaseListInbox
|
||||
*
|
||||
* @param type $seqName
|
||||
* @return type
|
||||
* @throws type
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
public function remove($app_uid, $del_index)
|
||||
@@ -233,7 +277,7 @@ class ListInbox extends BaseListInbox
|
||||
*
|
||||
* @param type $seqName
|
||||
* @return type
|
||||
* @throws type
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
public function removeAll($app_uid)
|
||||
@@ -478,8 +522,14 @@ class ListInbox extends BaseListInbox
|
||||
$criteria->add(ListInboxPeer::APP_UID, $search, Criteria::EQUAL);
|
||||
} 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 = new BmCases();
|
||||
$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
|
||||
* @param string $usr_uid, must be show cases related to this user
|
||||
* @param array $filters for apply in the result
|
||||
* @param null $callbackRecord
|
||||
* @param callable $callbackRecord
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
*/
|
||||
@@ -524,7 +574,7 @@ class ListInbox extends BaseListInbox
|
||||
$pmTable = new PmTable();
|
||||
$list = isset($filters['action']) ? $filters['action'] : "";
|
||||
$criteria = $pmTable->addPMFieldsToList($list);
|
||||
$this->additionalClassName = $pmTable->tableClassName;
|
||||
$this->setAdditionalClassName($pmTable->tableClassName);
|
||||
$additionalColumns = $criteria->getSelectColumns();
|
||||
$filters['usr_uid'] = $usr_uid;
|
||||
|
||||
@@ -556,14 +606,16 @@ class ListInbox extends BaseListInbox
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
|
||||
//We will be defined the sort
|
||||
$casesList = new \ProcessMaker\BusinessModel\Cases();
|
||||
$casesList = new BmCases();
|
||||
|
||||
$sort = $casesList->getSortColumn(
|
||||
__CLASS__ . 'Peer',
|
||||
BasePeer::TYPE_FIELDNAME,
|
||||
empty($filters['sort']) ? "APP_UPDATE_DATE" : $filters['sort'],
|
||||
"APP_UPDATE_DATE",
|
||||
$this->additionalClassName,
|
||||
$additionalColumns
|
||||
$this->getAdditionalClassName(),
|
||||
$additionalColumns,
|
||||
$this->getUserDisplayFormat()
|
||||
);
|
||||
|
||||
$dir = isset($filters['dir']) ? $filters['dir'] : "ASC";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
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.
|
||||
@@ -15,6 +15,49 @@ require_once 'classes/model/om/BaseListParticipatedLast.php';
|
||||
class ListParticipatedLast extends BaseListParticipatedLast
|
||||
{
|
||||
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.
|
||||
@@ -22,6 +65,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
* @param type $data
|
||||
*
|
||||
* @return type
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
@@ -142,7 +186,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
*
|
||||
* @return type
|
||||
*
|
||||
* @throws type
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($data)
|
||||
{
|
||||
@@ -180,11 +224,12 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
/**
|
||||
* Refresh List Participated Last.
|
||||
*
|
||||
* @param type $seqName
|
||||
* @param array $data
|
||||
* @param boolean $isSelfService
|
||||
*
|
||||
* @return type
|
||||
*
|
||||
* @throws type
|
||||
* @throws Exception
|
||||
*/
|
||||
public function refresh($data, $isSelfService = false)
|
||||
{
|
||||
@@ -235,11 +280,13 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
/**
|
||||
* Remove List Participated History.
|
||||
*
|
||||
* @param type $seqName
|
||||
* @param string $app_uid
|
||||
* @param string $usr_uid
|
||||
* @param integer $del_index
|
||||
*
|
||||
* @return type
|
||||
*
|
||||
* @throws type
|
||||
* @throws Exception
|
||||
*/
|
||||
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);
|
||||
} 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 = new BmCases();
|
||||
$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
|
||||
* @param string $usr_uid, must be show cases related to this user
|
||||
* @param array $filters for apply in the result
|
||||
* @param null $callbackRecord
|
||||
* @param callable $callbackRecord
|
||||
* @param string $appUid related to the specific case
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
@@ -361,7 +414,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
{
|
||||
$pmTable = new PmTable();
|
||||
$criteria = $pmTable->addPMFieldsToList('sent');
|
||||
$this->additionalClassName = $pmTable->tableClassName;
|
||||
$this->setAdditionalClassName($pmTable->tableClassName);
|
||||
$additionalColumns = $criteria->getSelectColumns();
|
||||
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::APP_UID);
|
||||
@@ -397,14 +450,15 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
|
||||
//We will be defined the sort
|
||||
$casesList = new \ProcessMaker\BusinessModel\Cases();
|
||||
$casesList = new BmCases();
|
||||
$sort = $casesList->getSortColumn(
|
||||
__CLASS__ . 'Peer',
|
||||
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';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.
|
||||
@@ -14,17 +14,60 @@ require_once 'classes/model/om/BaseListPaused.php';
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
|
||||
class ListPaused extends BaseListPaused
|
||||
{
|
||||
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
|
||||
*
|
||||
* @param type $data
|
||||
* @return type
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
@@ -153,7 +196,7 @@ class ListPaused extends BaseListPaused
|
||||
*
|
||||
* @param type $data
|
||||
* @return type
|
||||
* @throws type
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($data)
|
||||
{
|
||||
@@ -187,9 +230,12 @@ class ListPaused extends BaseListPaused
|
||||
/**
|
||||
* Remove List Paused
|
||||
*
|
||||
* @param type $seqName
|
||||
* @param string $app_uid
|
||||
* @param integer $del_index
|
||||
* @param array $data_inbox
|
||||
*
|
||||
* @return type
|
||||
* @throws type
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
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);
|
||||
} 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 = new BmCases();
|
||||
$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
|
||||
* @param string $usr_uid, must be show cases related to this user
|
||||
* @param array $filters for apply in the result
|
||||
* @param null $callbackRecord
|
||||
* @param callable $callbackRecord
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
*/
|
||||
@@ -279,7 +331,7 @@ class ListPaused extends BaseListPaused
|
||||
$resp = array();
|
||||
$pmTable = new PmTable();
|
||||
$criteria = $pmTable->addPMFieldsToList('paused');
|
||||
$this->additionalClassName = $pmTable->tableClassName;
|
||||
$this->setAdditionalClassName($pmTable->tableClassName);
|
||||
$additionalColumns = $criteria->getSelectColumns();
|
||||
|
||||
$criteria->addSelectColumn(ListPausedPeer::APP_UID);
|
||||
@@ -308,14 +360,15 @@ class ListPaused extends BaseListPaused
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
|
||||
//We will be defined the sort
|
||||
$casesList = new \ProcessMaker\BusinessModel\Cases();
|
||||
$casesList = new BmCases();
|
||||
$sort = $casesList->getSortColumn(
|
||||
__CLASS__ . 'Peer',
|
||||
BasePeer::TYPE_FIELDNAME,
|
||||
empty($filters['sort']) ? "APP_PAUSED_DATE" : $filters['sort'],
|
||||
"APP_PAUSED_DATE",
|
||||
$this->additionalClassName,
|
||||
$additionalColumns
|
||||
$this->getAdditionalClassName(),
|
||||
$additionalColumns,
|
||||
$this->getUserDisplayFormat()
|
||||
);
|
||||
|
||||
$dir = isset($filters['dir']) ? $filters['dir'] : "ASC";
|
||||
|
||||
@@ -90,8 +90,11 @@ try {
|
||||
|
||||
$filters['limit'] = (int)$filters['limit'];
|
||||
$filters['limit'] = abs($filters['limit']);
|
||||
$conf = new Configurations();
|
||||
$formats = $conf->getFormats();
|
||||
$list->setUserDisplayFormat($formats['format']);
|
||||
|
||||
if ($filters['limit'] == 0) {
|
||||
$conf = new Configurations();
|
||||
$generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||
if (isset($generalConfCasesList['casesListRowNumber'])) {
|
||||
$filters['limit'] = (int)$generalConfCasesList['casesListRowNumber'];
|
||||
@@ -101,10 +104,11 @@ try {
|
||||
} else {
|
||||
$filters['limit'] = (int)$filters['limit'];
|
||||
}
|
||||
|
||||
|
||||
switch ($filters['sort']) {
|
||||
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;
|
||||
case 'DEL_TASK_DUE_DATE':
|
||||
$filters['sort'] = 'DEL_DUE_DATE';
|
||||
@@ -113,7 +117,8 @@ try {
|
||||
$filters['sort'] = 'DEL_DELEGATE_DATE';
|
||||
break;
|
||||
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;
|
||||
case 'DEL_CURRENT_TAS_TITLE':
|
||||
$filters['sort'] = 'APP_TAS_TITLE';
|
||||
|
||||
@@ -3408,9 +3408,11 @@ class Cases
|
||||
* @param string $defaultSort, name of column by sort default
|
||||
* @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 string $userDisplayFormat, user information display format
|
||||
*
|
||||
* @return string $tableName
|
||||
*/
|
||||
public function getSortColumn($listPeer, $field, $sort, $defaultSort, $additionalClassName = '', $additionalColumns = array())
|
||||
public function getSortColumn($listPeer, $field, $sort, $defaultSort, $additionalClassName = '', $additionalColumns = array(), $userDisplayFormat = '')
|
||||
{
|
||||
$columnSort = $defaultSort;
|
||||
$tableName = '';
|
||||
@@ -3418,7 +3420,17 @@ class Cases
|
||||
//We will check if the column by sort is a LIST table
|
||||
$columnsList = $listPeer::getFieldNames($field);
|
||||
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 {
|
||||
//We will sort by CUSTOM CASE LIST table
|
||||
if (count($additionalColumns) > 0) {
|
||||
@@ -3435,4 +3447,47 @@ class Cases
|
||||
|
||||
return $columnSort;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 string $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':
|
||||
$columnSort = $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_LASTNAME';
|
||||
break;
|
||||
case '@firstName @lastName (@userName)':
|
||||
$columnSort = $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_LASTNAME' . ',' . $prefix . 'USR_USERNAME';
|
||||
break;
|
||||
case '@userName':
|
||||
$columnSort = $prefix . 'USR_USERNAME';
|
||||
break;
|
||||
case '@userName (@firstName @lastName)':
|
||||
$columnSort = $prefix . 'USR_USERNAME' . ',' . $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_LASTNAME';
|
||||
break;
|
||||
case '@lastName, @firstName':
|
||||
$columnSort = $prefix . 'USR_LASTNAME' . ',' . $prefix . 'USR_FIRSTNAME';
|
||||
break;
|
||||
case '@lastName, @firstName (@userName)':
|
||||
$columnSort = $prefix . 'USR_LASTNAME' . ',' . $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_USERNAME';
|
||||
break;
|
||||
default:
|
||||
$columnSort = $prefix . 'USR_USERNAME';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $columnSort;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user