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 () { function getSearchListCriteria () {
$Criteria = $this->addPMFieldsToCriteria('sent'); $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); //$Criteria->add (AppCacheViewPeer::USR_UID, $userUid);

View File

@@ -254,28 +254,23 @@
} else{ } else{
$distinct = true; $distinct = true;
} }
// needs a litle bit of analysis to understant whats going on // first check if there is a PMTable defined within the list,
// first check if there is a PMTable defined within the list maybe this code will be deprecated
// the issue that brokes the normal criteria query seems to be fixed // the issue that brokes the normal criteria query seems to be fixed
// if (isset($oAppCache->confCasesList['PMTable']) && !empty($oAppCache->confCasesList['PMTable'])){ if (isset($oAppCache->confCasesList['PMTable']) && !empty($oAppCache->confCasesList['PMTable'])) {
// // then // then
// $oAdditionalTables = AdditionalTablesPeer::retrieveByPK($oAppCache->confCasesList['PMTable']); $oAdditionalTables = AdditionalTablesPeer::retrieveByPK($oAppCache->confCasesList['PMTable']);
// $tableName = $oAdditionalTables->getAddTabName(); $tableName = $oAdditionalTables->getAddTabName();
// $tableName = strtolower($tableName); $tableName = strtolower($tableName);
// $tableNameArray = explode('_',$tableName); $tableNameArray = explode('_',$tableName);
// foreach ($tableNameArray as $item){ foreach ($tableNameArray as $item){
// $newTableName[] = ucfirst($item); $newTableName[] = ucfirst($item);
// } }
// $tableName = implode('',$newTableName); $tableName = implode('',$newTableName);
//// // so the pm table class can be invoqued from the pm table model clases
// if (!class_exists($tableName)){ if (!class_exists($tableName)){
// require_once(PATH_DB.SYS_SYS.PATH_SEP."classes".PATH_SEP.$tableName.".php"); 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 );
// }
$totalCount = AppCacheViewPeer::doCount( $CriteriaCount, $distinct ); $totalCount = AppCacheViewPeer::doCount( $CriteriaCount, $distinct );
} }
@@ -286,15 +281,31 @@
$Criteria->addDescendingOrderByColumn( $sort ); $Criteria->addDescendingOrderByColumn( $sort );
else else
$Criteria->addAscendingOrderByColumn( $sort ); $Criteria->addAscendingOrderByColumn( $sort );
} }
//limit the results according the interface //limit the results according the interface
$Criteria->setLimit( $limit ); $Criteria->setLimit( $limit );
$Criteria->setOffset( $start ); $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 //execute the query
$oDataset = AppCacheViewPeer::doSelectRS($Criteria); $oDataset = AppCacheViewPeer::doSelectRS($Criteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);