Merged in bugfix/HOR-2814-A (pull request #5629)
HOR-2814 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -54,6 +54,7 @@ class PmTable
|
||||
private $db;
|
||||
private $alterTable = true;
|
||||
private $keepData = false;
|
||||
public $tableClassName = '';
|
||||
|
||||
public function __construct ($tableName = null)
|
||||
{
|
||||
@@ -955,6 +956,7 @@ class PmTable
|
||||
|
||||
$additionalTable = AdditionalTablesPeer::retrieveByPK($additionalTableUid);
|
||||
$tableName = $additionalTable->getAddTabName();
|
||||
$this->tableClassName = $additionalTable->getAddTabClassName();
|
||||
|
||||
$additionalTable = new AdditionalTables();
|
||||
$tableData = $additionalTable->load($additionalTableUid, true);
|
||||
@@ -990,9 +992,13 @@ class PmTable
|
||||
$listTablePeer = 'ListInboxPeer';
|
||||
break;
|
||||
}
|
||||
|
||||
//Some PM tables don’t have the APP NUMBER column; but if exists, we must use it
|
||||
if (in_array($tableName.'.APP_NUMBER', $oCriteria->getSelectColumns())) {
|
||||
$oCriteria->addJoin($listTablePeer::APP_NUMBER, $tableName.'.APP_NUMBER', Criteria::LEFT_JOIN);
|
||||
} else {
|
||||
$oCriteria->addJoin($listTablePeer::APP_UID, $tableName.'.APP_UID', Criteria::LEFT_JOIN);
|
||||
}
|
||||
}
|
||||
return $oCriteria;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ require_once 'classes/model/om/BaseListInbox.php';
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListInbox extends BaseListInbox
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
private $additionalClassName = '';
|
||||
|
||||
/**
|
||||
* Create List Inbox Table
|
||||
*
|
||||
@@ -384,17 +385,25 @@ class ListInbox extends BaseListInbox
|
||||
self::create($data, $isSelfService);
|
||||
}
|
||||
|
||||
public function loadFilters(&$criteria, $filters)
|
||||
/**
|
||||
* 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, $additionalColumns = array())
|
||||
{
|
||||
$action = isset($filters['action']) ? $filters['action'] : "";
|
||||
$usrUid = isset($filters['usr_uid']) ? $filters['usr_uid'] : "";
|
||||
$filter = isset($filters['filter']) ? $filters['filter'] : "";
|
||||
$search = isset($filters['search']) ? $filters['search'] : "";
|
||||
$process = isset($filters['process']) ? $filters['process'] : "";
|
||||
$category = isset($filters['category']) ? $filters['category'] : "";
|
||||
$dateFrom = isset($filters['dateFrom']) ? $filters['dateFrom'] : "";
|
||||
$dateTo = isset($filters['dateTo']) ? $filters['dateTo'] : "";
|
||||
$filterStatus = isset($filters['filterStatus']) ? $filters['filterStatus'] : "";
|
||||
$action = isset($filters['action']) ? $filters['action'] : '';
|
||||
$usrUid = isset($filters['usr_uid']) ? $filters['usr_uid'] : '';
|
||||
$filter = isset($filters['filter']) ? $filters['filter'] : '';
|
||||
$search = isset($filters['search']) ? $filters['search'] : '';
|
||||
$caseLink = isset($filters['caseLink']) ? $filters['caseLink'] : '';
|
||||
$process = isset($filters['process']) ? $filters['process'] : '';
|
||||
$category = isset($filters['category']) ? $filters['category'] : '';
|
||||
$dateFrom = isset($filters['dateFrom']) ? $filters['dateFrom'] : '';
|
||||
$dateTo = isset($filters['dateTo']) ? $filters['dateTo'] : '';
|
||||
$filterStatus = isset($filters['filterStatus']) ? $filters['filterStatus'] : '';
|
||||
$newestthan = isset($filters['newestthan']) ? $filters['newestthan'] : '';
|
||||
$oldestthan = isset($filters['oldestthan']) ? $filters['oldestthan'] : '';
|
||||
|
||||
@@ -463,21 +472,14 @@ class ListInbox extends BaseListInbox
|
||||
|
||||
//Filter Search
|
||||
if ($search != '') {
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion(ListInboxPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListInboxPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListInboxPeer::APP_PRO_TITLE, '%' . $search . '%', Criteria::LIKE)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListInboxPeer::APP_UID, $search, Criteria::EQUAL)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListInboxPeer::APP_NUMBER, $search, Criteria::EQUAL)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
//Check if we need to search to the APP_UID
|
||||
if (!empty($caseLink)) {
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
//Filter Process Id
|
||||
@@ -504,17 +506,20 @@ class ListInbox extends BaseListInbox
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $usr_uid
|
||||
* @param array $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 null $callbackRecord
|
||||
* @return array
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$pmTable = new PmTable();
|
||||
$criteria = $pmTable->addPMFieldsToList('todo');
|
||||
|
||||
$list = isset($filters['action']) ? $filters['action'] : "";
|
||||
$criteria = $pmTable->addPMFieldsToList($list);
|
||||
$this->additionalClassName = $pmTable->tableClassName;
|
||||
$additionalColumns = $criteria->getSelectColumns();
|
||||
$filters['usr_uid'] = $usr_uid;
|
||||
|
||||
$criteria->addSelectColumn(ListInboxPeer::APP_UID);
|
||||
@@ -542,7 +547,7 @@ class ListInbox extends BaseListInbox
|
||||
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
|
||||
$criteria->addJoin(ListInboxPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
|
||||
self::loadFilters($criteria, $filters);
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
|
||||
$sort = (!empty($filters['sort'])) ?
|
||||
ListInboxPeer::TABLE_NAME.'.'.$filters['sort'] :
|
||||
|
||||
@@ -14,7 +14,8 @@ require_once 'classes/model/om/BaseListParticipatedLast.php';
|
||||
*/
|
||||
class ListParticipatedLast extends BaseListParticipatedLast
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
private $additionalClassName = '';
|
||||
|
||||
/**
|
||||
* Create List Participated History Table.
|
||||
*
|
||||
@@ -234,10 +235,18 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
}
|
||||
}
|
||||
|
||||
public function loadFilters(&$criteria, $filters)
|
||||
/**
|
||||
* 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, $additionalColumns = array())
|
||||
{
|
||||
$filter = isset($filters['filter']) ? $filters['filter'] : '';
|
||||
$search = isset($filters['search']) ? $filters['search'] : '';
|
||||
$caseLink = isset($filters['caseLink']) ? $filters['caseLink'] : '';
|
||||
$process = isset($filters['process']) ? $filters['process'] : '';
|
||||
$category = isset($filters['category']) ? $filters['category'] : '';
|
||||
$dateFrom = isset($filters['dateFrom']) ? $filters['dateFrom'] : '';
|
||||
@@ -271,25 +280,24 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
break;
|
||||
}
|
||||
|
||||
//Filter Search
|
||||
if ($search != '') {
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion(ListParticipatedLastPeer::APP_TITLE, '%'.$search.'%', Criteria::LIKE)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListParticipatedLastPeer::APP_TAS_TITLE, '%'.$search.'%', Criteria::LIKE)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListParticipatedLastPeer::APP_UID, $search, Criteria::EQUAL)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListParticipatedLastPeer::APP_NUMBER, $search, Criteria::EQUAL)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
//Check if we need to search to the APP_UID
|
||||
if (!empty($caseLink)) {
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
//Filter Process Id
|
||||
if ($process != '') {
|
||||
$criteria->add(ListParticipatedLastPeer::PRO_UID, $process, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
//Filter Category
|
||||
if ($category != '') {
|
||||
$criteria->addSelectColumn(ProcessPeer::PRO_CATEGORY);
|
||||
$aConditions = array();
|
||||
@@ -308,10 +316,21 @@ 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 string $appUid related to the specific case
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null, $appUid = '')
|
||||
{
|
||||
$pmTable = new PmTable();
|
||||
$criteria = $pmTable->addPMFieldsToList('sent');
|
||||
$this->additionalClassName = $pmTable->tableClassName;
|
||||
$additionalColumns = $criteria->getSelectColumns();
|
||||
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::APP_UID);
|
||||
$criteria->addSelectColumn(ListParticipatedLastPeer::DEL_INDEX);
|
||||
@@ -343,7 +362,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
|
||||
$criteria->add(ListParticipatedLastPeer::APP_UID, $appUid, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
self::loadFilters($criteria, $filters);
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
|
||||
$sort = (!empty($filters['sort'])) ?
|
||||
ListParticipatedLastPeer::TABLE_NAME.'.'.$filters['sort'] :
|
||||
|
||||
@@ -17,7 +17,8 @@ require_once 'classes/model/om/BaseListPaused.php';
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListPaused extends BaseListPaused
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
private $additionalClassName = '';
|
||||
|
||||
/**
|
||||
* Create List Paused Table
|
||||
*
|
||||
@@ -212,13 +213,21 @@ class ListPaused extends BaseListPaused
|
||||
}
|
||||
}
|
||||
|
||||
public function loadFilters(&$criteria, $filters)
|
||||
/**
|
||||
* 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, $additionalColumns = array())
|
||||
{
|
||||
$filter = isset($filters['filter']) ? $filters['filter'] : "";
|
||||
$search = isset($filters['search']) ? $filters['search'] : "";
|
||||
$process = isset($filters['process']) ? $filters['process'] : "";
|
||||
$category = isset($filters['category']) ? $filters['category'] : "";
|
||||
$filterStatus = isset($filters['filterStatus']) ? $filters['filterStatus'] : "";
|
||||
$filter = isset($filters['filter']) ? $filters['filter'] : '';
|
||||
$search = isset($filters['search']) ? $filters['search'] : '';
|
||||
$caseLink = isset($filters['caseLink']) ? $filters['caseLink'] : '';
|
||||
$process = isset($filters['process']) ? $filters['process'] : '';
|
||||
$category = isset($filters['category']) ? $filters['category'] : '';
|
||||
$filterStatus = isset($filters['filterStatus']) ? $filters['filterStatus'] : '';
|
||||
|
||||
//Filter Read Unread All
|
||||
switch ($filter) {
|
||||
@@ -230,25 +239,24 @@ class ListPaused extends BaseListPaused
|
||||
break;
|
||||
}
|
||||
|
||||
//Filter Search
|
||||
if ($search != '') {
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion(ListPausedPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListPausedPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListPausedPeer::APP_UID, $search, Criteria::EQUAL)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListPausedPeer::APP_NUMBER, $search, Criteria::EQUAL)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
//Check if we need to search to the APP_UID
|
||||
if (!empty($caseLink)) {
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
//Filter Process Id
|
||||
if ($process != '') {
|
||||
$criteria->add(ListPausedPeer::PRO_UID, $process, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
//Filter Category
|
||||
if ($category != '') {
|
||||
$criteria->addSelectColumn(ProcessPeer::PRO_CATEGORY);
|
||||
$aConditions = array();
|
||||
@@ -258,11 +266,21 @@ 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
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$resp = array();
|
||||
$pmTable = new PmTable();
|
||||
$criteria = $pmTable->addPMFieldsToList('paused');
|
||||
$this->additionalClassName = $pmTable->tableClassName;
|
||||
$additionalColumns = $criteria->getSelectColumns();
|
||||
|
||||
$criteria->addSelectColumn(ListPausedPeer::APP_UID);
|
||||
$criteria->addSelectColumn(ListPausedPeer::USR_UID);
|
||||
@@ -287,7 +305,7 @@ class ListPaused extends BaseListPaused
|
||||
$criteria->addSelectColumn(ListPausedPeer::DEL_DUE_DATE);
|
||||
$criteria->addSelectColumn(ListPausedPeer::DEL_PRIORITY);
|
||||
$criteria->add(ListPausedPeer::USR_UID, $usr_uid, Criteria::EQUAL);
|
||||
self::loadFilters($criteria, $filters);
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
|
||||
$sort = (!empty($filters['sort'])) ? ListPausedPeer::TABLE_NAME.'.'.$filters['sort'] : "APP_PAUSED_DATE";
|
||||
$dir = isset($filters['dir']) ? $filters['dir'] : "ASC";
|
||||
|
||||
@@ -17,8 +17,9 @@ require_once 'classes/model/om/BaseListUnassigned.php';
|
||||
// @codingStandardsIgnoreStart
|
||||
class ListUnassigned extends BaseListUnassigned
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
private $additionalClassName = '';
|
||||
private $total = 0;
|
||||
|
||||
/**
|
||||
* Create List Unassigned Table
|
||||
*
|
||||
@@ -165,34 +166,41 @@ class ListUnassigned extends BaseListUnassigned
|
||||
return true;
|
||||
}
|
||||
|
||||
public function loadFilters(&$criteria, $filters)
|
||||
/**
|
||||
* 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, $additionalColumns = array())
|
||||
{
|
||||
$filter = isset($filters['filter']) ? $filters['filter'] : "";
|
||||
$search = isset($filters['search']) ? $filters['search'] : "";
|
||||
$process = isset($filters['process']) ? $filters['process'] : "";
|
||||
$category = isset($filters['category']) ? $filters['category'] : "";
|
||||
$dateFrom = isset($filters['dateFrom']) ? $filters['dateFrom'] : "";
|
||||
$dateTo = isset($filters['dateTo']) ? $filters['dateTo'] : "";
|
||||
$filter = isset($filters['filter']) ? $filters['filter'] : '';
|
||||
$search = isset($filters['search']) ? $filters['search'] : '';
|
||||
$caseLink = isset($filters['caseLink']) ? $filters['caseLink'] : '';
|
||||
$process = isset($filters['process']) ? $filters['process'] : '';
|
||||
$category = isset($filters['category']) ? $filters['category'] : '';
|
||||
$dateFrom = isset($filters['dateFrom']) ? $filters['dateFrom'] : '';
|
||||
$dateTo = isset($filters['dateTo']) ? $filters['dateTo'] : '';
|
||||
|
||||
//Filter Search
|
||||
if ($search != '') {
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion(ListUnassignedPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListUnassignedPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListUnassignedPeer::APP_UID, $search, Criteria::EQUAL)
|
||||
->addOr(
|
||||
$criteria->getNewCriterion(ListUnassignedPeer::APP_NUMBER, $search, Criteria::EQUAL)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
//Check if we need to search to the APP_UID
|
||||
if (!empty($caseLink)) {
|
||||
$criteria->add(ListUnassignedPeer::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);
|
||||
}
|
||||
}
|
||||
|
||||
//Filter Process Id
|
||||
if ($process != '') {
|
||||
$criteria->add(ListUnassignedPeer::PRO_UID, $process, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
//Filter Category
|
||||
if ($category != '') {
|
||||
$criteria->addSelectColumn(ProcessPeer::PRO_CATEGORY);
|
||||
$aConditions = array();
|
||||
@@ -202,12 +210,22 @@ class ListUnassigned extends BaseListUnassigned
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return array $data
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
|
||||
{
|
||||
$resp = array();
|
||||
$pmTable = new PmTable();
|
||||
$tasks = $this->getSelfServiceTasks($usr_uid);
|
||||
$criteria = $pmTable->addPMFieldsToList('unassigned');
|
||||
$this->additionalClassName = $pmTable->tableClassName;
|
||||
$additionalColumns = $criteria->getSelectColumns();
|
||||
|
||||
$criteria->addSelectColumn(ListUnassignedPeer::APP_UID);
|
||||
$criteria->addSelectColumn(ListUnassignedPeer::DEL_INDEX);
|
||||
@@ -282,7 +300,7 @@ class ListUnassigned extends BaseListUnassigned
|
||||
}
|
||||
|
||||
//Apply some filters
|
||||
self::loadFilters($criteria, $filters);
|
||||
self::loadFilters($criteria, $filters, $additionalColumns);
|
||||
$sort = (!empty($filters['sort'])) ?
|
||||
ListUnassignedPeer::TABLE_NAME.'.'.$filters['sort'] :
|
||||
"LIST_UNASSIGNED.DEL_DELEGATE_DATE";
|
||||
|
||||
@@ -3283,4 +3283,50 @@ class Cases
|
||||
}
|
||||
return $delIndex;
|
||||
}
|
||||
/**
|
||||
* This function will be return the criteria for the search filter
|
||||
*
|
||||
* We considered in the search criteria the custom cases list,
|
||||
* the titles related to: caseTitle taskTitle processTitle and
|
||||
* the case number
|
||||
* @param Criteria $criteria, must be contain the initial criteria for search
|
||||
* @param string $listPeer, name of the list class
|
||||
* @param string $search, the parameter for search in the table
|
||||
* @param string $additionalClassName, name of the className of pmtable
|
||||
* @param array $additionalColumns, columns related to the custom cases list
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getSearchCriteriaListCases(&$criteria, $listPeer ,$search, $additionalClassName = '', $additionalColumns = array() )
|
||||
{
|
||||
$oTmpCriteria = '';
|
||||
//If we have additional tables configured in the custom cases list, prepare the variables for search
|
||||
if (count($additionalColumns) > 0) {
|
||||
require_once(PATH_DATA_SITE . 'classes' . PATH_SEP . $additionalClassName . '.php');
|
||||
$oNewCriteria = new \Criteria("workflow");
|
||||
$oTmpCriteria = $oNewCriteria->getNewCriterion(current($additionalColumns), "%" . $search . "%", \Criteria::LIKE);
|
||||
|
||||
//We prepare the query related to the custom cases list
|
||||
foreach (array_slice($additionalColumns, 1) as $value) {
|
||||
$oTmpCriteria = $oNewCriteria->getNewCriterion($value, "%" . $search . "%", \Criteria::LIKE)->addOr($oTmpCriteria);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($oTmpCriteria)) {
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion($listPeer::APP_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_TAS_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_PRO_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_NUMBER, $search, \Criteria::EQUAL)->addOr(
|
||||
$oTmpCriteria
|
||||
))))
|
||||
);
|
||||
} else {
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion($listPeer::APP_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_TAS_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_PRO_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion($listPeer::APP_NUMBER, $search, \Criteria::EQUAL))))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user