Bug 5855 fixed, changes has been made to the search Criteria object in order to adjust the row info in the search cases list

This commit is contained in:
Gustavo Adolfo Cruz Laura
2011-02-11 19:28:01 +00:00
parent 989ccf4bc6
commit 178ed9f352
2 changed files with 40 additions and 29 deletions

View File

@@ -548,7 +548,7 @@ class AppCacheView extends BaseAppCacheView {
*/
function getSearchListCriteria () {
$Criteria = $this->addPMFieldsToCriteria('sent');
$Criteria->addAsColumn( 'DEL_INDEX', 'MAX(' . AppCacheViewPeer::DEL_INDEX . ')' );
$Criteria->addAsColumn( 'MAX_DEL_INDEX', 'MAX(' . AppCacheViewPeer::DEL_INDEX . ')' );
//$Criteria->add (AppCacheViewPeer::USR_UID, $userUid);

View File

@@ -254,28 +254,23 @@
} else{
$distinct = true;
}
// needs a litle bit of analysis to understant whats going on
// first check if there is a PMTable defined within the list maybe this code will be deprecated
// first check if there is a PMTable defined within the list,
// the issue that brokes the normal criteria query seems to be fixed
// if (isset($oAppCache->confCasesList['PMTable']) && !empty($oAppCache->confCasesList['PMTable'])){
// // then
// $oAdditionalTables = AdditionalTablesPeer::retrieveByPK($oAppCache->confCasesList['PMTable']);
// $tableName = $oAdditionalTables->getAddTabName();
// $tableName = strtolower($tableName);
// $tableNameArray = explode('_',$tableName);
// foreach ($tableNameArray as $item){
// $newTableName[] = ucfirst($item);
// }
// $tableName = implode('',$newTableName);
////
// if (!class_exists($tableName)){
// require_once(PATH_DB.SYS_SYS.PATH_SEP."classes".PATH_SEP.$tableName.".php");
// }
// eval ("\$totalCount=".$tableName."Peer::doCount( \$CriteriaCount, \$distinct );");
//
// } else {
// $totalCount = AppCacheViewPeer::doCount( $CriteriaCount, $distinct );
// }
if (isset($oAppCache->confCasesList['PMTable']) && !empty($oAppCache->confCasesList['PMTable'])) {
// then
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($oAppCache->confCasesList['PMTable']);
$tableName = $oAdditionalTables->getAddTabName();
$tableName = strtolower($tableName);
$tableNameArray = explode('_',$tableName);
foreach ($tableNameArray as $item){
$newTableName[] = ucfirst($item);
}
$tableName = implode('',$newTableName);
// so the pm table class can be invoqued from the pm table model clases
if (!class_exists($tableName)){
require_once(PATH_DB.SYS_SYS.PATH_SEP."classes".PATH_SEP.$tableName.".php");
}
}
$totalCount = AppCacheViewPeer::doCount( $CriteriaCount, $distinct );
}
@@ -291,9 +286,25 @@
//limit the results according the interface
$Criteria->setLimit( $limit );
$Criteria->setOffset( $start );
$params = array();
$sSql = BasePeer::createSelectSql($Criteria, $params);
// var_dump($sSql);
// this is the optimal way or query to render the cases search list
// fixing the bug related to the wrong data displayed in the list
if ( $action == 'search' ) {
$oDatasetIndex = AppCacheViewPeer::doSelectRS( $Criteria );
$oDatasetIndex->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDatasetIndex->next();
// a list of MAX_DEL_INDEXES is required in order to validate the right row
while($aRow = $oDatasetIndex->getRow()){
$maxDelIndexList[] = $aRow['MAX_DEL_INDEX'];
$oDatasetIndex->next();
}
// adding the validation condition in order to get the right row using the group by sentence
$Criteria->add(AppCacheViewPeer::DEL_INDEX, $maxDelIndexList, Criteria::IN );
//
$params = array ( $maxDelIndexList );
}
//execute the query
$oDataset = AppCacheViewPeer::doSelectRS($Criteria);