BUG 9830 "En Advanced Search no funciona la busqueda por..." SOLVED

- In AdvancedSearch no performs searches for user and category
- Problem solved, have been added to SOLR missing criteria for the search
- Note. - To register/upgrade the new criteria in the SOLR server, run the
  following script:
      $ php reindex_solr.php workspace_name reindexall
* Available from version 2.0.45
This commit is contained in:
Victor Saisa Lopez
2012-11-05 15:14:51 -04:00
parent 7f5911f85f
commit 977969985e
5 changed files with 760 additions and 263 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -170,18 +170,23 @@ class Applications
}
*/
// add the process filter
if ($process != '') {
$Criteria->add( AppCacheViewPeer::PRO_UID, $process, Criteria::EQUAL );
$CriteriaCount->add( AppCacheViewPeer::PRO_UID, $process, Criteria::EQUAL );
//Add the process filter
if (!empty($process)) {
$Criteria->add(AppCacheViewPeer::PRO_UID, $process, Criteria::EQUAL);
$CriteriaCount->add(AppCacheViewPeer::PRO_UID, $process, Criteria::EQUAL);
}
// add the category filter
if ($category != '') {
$Criteria->addAlias( 'CP', 'PROCESS' );
$Criteria->add( 'CP.PRO_CATEGORY', $category, Criteria::EQUAL );
$Criteria->addJoin( AppCacheViewPeer::PRO_UID, 'CP.PRO_UID', Criteria::LEFT_JOIN );
$Criteria->addAsColumn( 'CATEGORY_UID', 'CP.PRO_CATEGORY' );
//Add the category filter
if (!empty($category)) {
$Criteria->addAlias("CP", "PROCESS");
$Criteria->add("CP.PRO_CATEGORY", $category, Criteria::EQUAL);
$Criteria->addJoin(AppCacheViewPeer::PRO_UID, "CP.PRO_UID", Criteria::LEFT_JOIN);
$Criteria->addAsColumn("CATEGORY_UID", "CP.PRO_CATEGORY");
$CriteriaCount->addAlias("CP", "PROCESS");
$CriteriaCount->add("CP.PRO_CATEGORY", $category, Criteria::EQUAL);
$CriteriaCount->addJoin(AppCacheViewPeer::PRO_UID, "CP.PRO_UID", Criteria::LEFT_JOIN);
$CriteriaCount->addAsColumn("CATEGORY_UID", "CP.PRO_CATEGORY");
}
// add the user filter
@@ -314,11 +319,13 @@ class Applications
if ($doCountAlreadyExecuted == false) {
// in the case of reassign the distinct attribute shows a diferent count result comparing to the
// original list
if (($action == "to_reassign" || $action == "todo") || ($status == "TO_DO")) {
//Check also $distinct in the method getListCounters(), this in AppCacheView.php
$distinct = true;
if (($action == "todo" || $action == "to_reassign") || ($status == "TO_DO")) {
$distinct = false;
} else {
$distinct = true;
}
// 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'] )) {

View File

@@ -47,16 +47,18 @@ class AppCacheView extends BaseAppCacheView
public function getListCounters($type, $userUid, $processSummary)
{
$distinct = true;
switch ($type) {
case 'to_do':
$criteria = $this->getToDoCountCriteria($userUid);
$distinct = false;
break;
case 'draft':
$criteria = $this->getDraftCountCriteria($userUid);
break;
case 'sent':
$criteria = $this->getSentCountCriteria($userUid);
//return AppCacheViewPeer::doCount($criteria, true);
break;
case 'selfservice':
$criteria = $this->getUnassignedCountCriteria($userUid);
@@ -77,7 +79,7 @@ class AppCacheView extends BaseAppCacheView
return $type;
}
return AppCacheViewPeer::doCount($criteria);
return AppCacheViewPeer::doCount($criteria, $distinct);
}
/**
@@ -1004,35 +1006,35 @@ class AppCacheView extends BaseAppCacheView
$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
}
//paused
//Paused
$sqlAppDelay = $this->getAppDelaySql(AppCacheViewPeer::APP_UID, AppCacheViewPeer::DEL_INDEX);
$criteria->add(
//todo - getToDo()
//ToDo - getToDo()
$criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "TO_DO", CRITERIA::EQUAL)->addAnd(
$criteria->getNewCriterion(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL))->addAnd(
$criteria->getNewCriterion(AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
$criteria->getNewCriterion(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
)->addOr(
//draft - getDraft()
//Draft - getDraft()
$criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "DRAFT", CRITERIA::EQUAL)->addAnd(
$criteria->getNewCriterion(AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
$criteria->getNewCriterion(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
)->addOr(
//paused
//Paused
$criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "PAUSED")->addAnd(
$criteria->getNewCriterion(AppCacheViewPeer::APP_UID, AppCacheViewPeer::APP_UID . " IN ($sqlAppDelay)", Criteria::CUSTOM))
)->addOr(
//cancelled - getCancelled()
//Cancelled - getCancelled()
$criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "CANCELLED", CRITERIA::EQUAL)->addAnd(
$criteria->getNewCriterion(AppCacheViewPeer::DEL_THREAD_STATUS, "CLOSED"))
)->addOr(
//completed - getCompleted()
//Completed - getCompleted()
$criteria->getNewCriterion(AppCacheViewPeer::APP_STATUS, "COMPLETED", CRITERIA::EQUAL)
);
if (!$doCount) {
//completed - getCompleted()
//Completed - getCompleted()
$criteria->addGroupByColumn(AppCacheViewPeer::APP_UID);
//$criteria->addGroupByColumn(AppCacheViewPeer::USR_UID);

View File

@@ -20,16 +20,24 @@ try {
$userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "")? $_SESSION["USER_LOGGED"] : null;
$result = "";
switch ($action) {
case "search":
case "to_reassign":
$user = ($user == "CURRENT_USER")? $userUid : $user;
$userUid = $user;
break;
default:
break;
}
if ((
$action == "todo" || $action == "draft" || $action == "sent" || $action == "selfservice" ||
$action == "unassigned" || $action == "search"
$action == "todo" || $action == "draft" || $action == "paused" || $action == "sent" ||
$action == "selfservice" || $action == "unassigned" || $action == "search"
) &&
(($solrConf = System::solrEnv()) !== false)
) {
G::LoadClass("AppSolr");
$user = ($user == "CURRENT_USER")? $userUid : $user;
$ApplicationSolrIndex = new AppSolr(
$solrConf["solr_enabled"],
$solrConf["solr_host"],
@@ -44,30 +52,20 @@ try {
$filter,
$search,
$process,
$user, //delete
$status,
$type,
$dateFrom,
$dateTo,
$callback,
$dir,
$sort
$sort,
$category
);
$result = G::json_encode($data);
} else {
G::LoadClass("applications");
switch ($action) {
case "search":
case "to_reassign":
$user = ($user == "CURRENT_USER")? $userUid : $user;
$userUid = $user;
break;
default:
break;
}
$apps = new Applications();
$data = $apps->getAll(
$userUid,

View File

@@ -514,7 +514,7 @@ Ext.onReady ( function() {
if( c.id == 'unpauseLink') c.renderer = unpauseLink;
if( c.dataIndex == 'CASE_SUMMARY') c.renderer = renderSummary;
if( c.dataIndex == 'CASE_NOTES_COUNT') c.renderer = renderNote;
if (solrEnabled != 1) {
if (solrEnabled == 0) {
if( c.dataIndex == 'APP_DEL_PREVIOUS_USER') c.renderer = previous_full_name;
if( c.dataIndex == 'APP_CURRENT_USER') c.renderer = full_name;
}
@@ -1459,8 +1459,6 @@ Ext.onReady ( function() {
value: ''
});
var optionCategory = (solrEnabled == 1)? [""] : [_("ID_CATEGORY"), comboCategory, "-"];
var toolbarTodo = [
optionMenuOpen,
{
@@ -1476,7 +1474,9 @@ Ext.onReady ( function() {
'-',
btnAll,
'->', // begin using the right-justified button container
optionCategory,
_("ID_CATEGORY"),
comboCategory,
"-",
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1498,7 +1498,9 @@ Ext.onReady ( function() {
'-',
btnAll,
'->', // begin using the right-justified button container
optionCategory,
_("ID_CATEGORY"),
comboCategory,
"-",
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1520,7 +1522,9 @@ Ext.onReady ( function() {
'-',
btnAll,
'->', // begin using the right-justified button container
optionCategory,
_("ID_CATEGORY"),
comboCategory,
"-",
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1544,7 +1548,9 @@ Ext.onReady ( function() {
menu: menuItems
},
'->',
optionCategory,
_("ID_CATEGORY"),
comboCategory,
"-",
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1561,7 +1567,9 @@ Ext.onReady ( function() {
var toolbarToRevise = [
optionMenuOpen,
'->', // begin using the right-justified button container
optionCategory,
_("ID_CATEGORY"),
comboCategory,
"-",
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1586,7 +1594,9 @@ Ext.onReady ( function() {
_("ID_USER"),
comboAllUsers,
"-",
optionCategory,
_("ID_CATEGORY"),
comboCategory,
"-",
_("ID_PROCESS"),
comboProcess,
textSearch,
@@ -1604,7 +1614,9 @@ Ext.onReady ( function() {
'-',
btnAll,
'->', // begin using the right-justified button container
optionCategory,
_("ID_CATEGORY"),
comboCategory,
"-",
_('ID_PROCESS'),
comboProcess,
'-',
@@ -1640,8 +1652,6 @@ Ext.onReady ( function() {
})
];
var arrayAux = (solrEnabled == 1)? [""] : ["-", _("ID_USER"), comboUser];
var firstToolbarSearch = new Ext.Toolbar({
region: 'north',
width: '100%',
@@ -1649,13 +1659,17 @@ Ext.onReady ( function() {
items: [
optionMenuOpen,
'->',
optionCategory,
_("ID_CATEGORY"),
comboCategory,
"-",
_('ID_PROCESS'),
comboProcess,
'-',
_('ID_STATUS'),
comboStatus,
arrayAux,
"-",
_("ID_USER"),
comboUser,
'-',
textSearch,
resetSearchButton,
@@ -1878,46 +1892,50 @@ var gridForm = new Ext.FormPanel({
//Manually trigger the data store load
switch (action) {
case "draft":
storeCases.setBaseParam("process", '');
storeCases.setBaseParam("category", "");
storeCases.setBaseParam("process", "");
storeCases.setBaseParam("search", textSearch.getValue());
break;
case "sent":
storeCases.setBaseParam("process", '');
storeCases.setBaseParam("category", "");
storeCases.setBaseParam("process", "");
storeCases.setBaseParam("status", comboStatus.store.getAt(0).get(comboStatus.valueField));
storeCases.setBaseParam("search", textSearch.getValue());
break;
case "to_revise":
storeCases.setBaseParam("process", '');
storeCases.setBaseParam("category", "");
storeCases.setBaseParam("process", "");
storeCases.setBaseParam("search", textSearch.getValue());
break;
case "to_reassign":
storeCases.setBaseParam("user", comboAllUsers.store.getAt(0).get(comboAllUsers.valueField));
storeCases.setBaseParam("process", '');
storeCases.setBaseParam("category", "");
storeCases.setBaseParam("process", "");
storeCases.setBaseParam("search", textSearch.getValue());
break;
case "search":
storeCases.setBaseParam("process", '');
storeCases.setBaseParam("category", "");
storeCases.setBaseParam("process", "");
storeCases.setBaseParam("status", comboStatus.store.getAt(0).get(comboStatus.valueField));
if (!(solrEnabled == 1)) {
storeCases.setBaseParam("user", comboUser.store.getAt(0).get(comboUser.valueField));
}
storeCases.setBaseParam("user", comboUser.store.getAt(0).get(comboUser.valueField));
storeCases.setBaseParam("search", textSearch.getValue());
storeCases.setBaseParam("dateFrom", dateFrom.getValue());
storeCases.setBaseParam("dateTo", dateTo.getValue());
break;
case "unassigned":
storeCases.setBaseParam("process", '');
storeCases.setBaseParam("category", "");
storeCases.setBaseParam("process", "");
storeCases.setBaseParam("search", textSearch.getValue());
break;
case "gral":
storeCases.setBaseParam("process", '');
storeCases.setBaseParam("process", "");
storeCases.setBaseParam("search", textSearch.getValue());
break;
default:
//todo
storeCases.setBaseParam("process", '');
//paused
storeCases.setBaseParam("category", "");
storeCases.setBaseParam("process", "");
storeCases.setBaseParam("search", textSearch.getValue());
break;
}
@@ -2031,6 +2049,7 @@ var gridForm = new Ext.FormPanel({
// Nothing to do
}
comboCategory.setValue("");
comboProcess.setValue("");
comboStatus.setValue("");
comboUser.setValue("CURRENT_USER");