HOR-3516
This commit is contained in:
@@ -3329,4 +3329,40 @@ class Cases
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function get the table.column by order by the result
|
||||
* We can include the additional table related to the custom cases list
|
||||
*
|
||||
* @param string $listPeer, name of the list class
|
||||
* @param string $field, name of the fieldName
|
||||
* @param string $sort, name of column by sort
|
||||
* @param string $additionalClassName, name of the className of pmTable
|
||||
* @param array $additionalColumns, columns related to the custom cases list
|
||||
* @return string $tableName
|
||||
*/
|
||||
public function getSortColumn($listPeer, $field, $sort, $additionalClassName = '', $additionalColumns = array())
|
||||
{
|
||||
$columnSort = $sort;
|
||||
|
||||
//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;
|
||||
} else {
|
||||
//We will sort by CUSTOM CASE LIST table
|
||||
if (count($additionalColumns) > 0) {
|
||||
require_once(PATH_DATA_SITE . 'classes' . PATH_SEP . $additionalClassName . '.php');
|
||||
$aTable = explode('.', current($additionalColumns));
|
||||
if (count($aTable) > 0) {
|
||||
$tableName = $aTable[0];
|
||||
}
|
||||
}
|
||||
if (!empty($tableName)) {
|
||||
$columnSort = $tableName . '.' . $sort;
|
||||
}
|
||||
}
|
||||
|
||||
return $columnSort;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user