BUG 9605 "Change default advanced search options" SOLVED

- Change default advanced search options, for get cases information
  of the current user
- Solved, added new option "Current user" in DropDown Users set to
  default in Advanced Search
This commit is contained in:
Victor Saisa Lopez
2012-08-17 18:23:58 -04:00
parent f75fefbcef
commit a68d49cc2c
3 changed files with 159 additions and 66 deletions

View File

@@ -214,7 +214,9 @@
function getUserArray ( $action, $userUid ) { function getUserArray ( $action, $userUid ) {
global $oAppCache; global $oAppCache;
$status = array(); $status = array();
$users[] = array( '', G::LoadTranslation('ID_ALL_USERS') ); $users[] = array("CURRENT_USER", G::LoadTranslation("ID_CURRENT_USER"));
$users[] = array("", G::LoadTranslation("ID_ALL_USERS"));
//now get users, just for the Search action //now get users, just for the Search action
switch ( $action ) { switch ( $action ) {
case 'search_simple': case 'search_simple':
@@ -242,7 +244,9 @@
function getAllUsersArray ( $action ) { function getAllUsersArray ( $action ) {
global $oAppCache; global $oAppCache;
$status = array(); $status = array();
$users[] = array( '', G::LoadTranslation('ID_ALL_USERS') ); $users[] = array("CURRENT_USER", G::LoadTranslation("ID_CURRENT_USER"));
$users[] = array("", G::LoadTranslation("ID_ALL_USERS"));
if ($action=='to_reassign') { if ($action=='to_reassign') {
//now get users, just for the Search action //now get users, just for the Search action
$cUsers = $oAppCache->getToReassignListCriteria(); $cUsers = $oAppCache->getToReassignListCriteria();

View File

@@ -1,46 +1,89 @@
<?php <?php
//Getting the extJs parameters
// getting the extJs parameters $callback = isset($_POST["callback"])? $_POST["callback"] : "stcCallback1001";
$callback = isset ( $_POST ['callback'] ) ? $_POST ['callback'] : 'stcCallback1001'; $dir = isset($_POST["dir"])? $_POST["dir"] : "DESC";
$dir = isset ( $_POST ['dir'] ) ? $_POST ['dir'] : 'DESC'; $sort = isset($_POST["sort"])? $_POST["sort"] : "";
$sort = isset ( $_POST ['sort'] ) ? $_POST ['sort'] : ''; $start = isset($_POST["start"])? $_POST["start"] : "0";
$start = isset ( $_POST ['start'] ) ? $_POST ['start'] : '0'; $limit = isset($_POST["limit"])? $_POST["limit"] : "25";
$limit = isset ( $_POST ['limit'] ) ? $_POST ['limit'] : '25'; $filter = isset($_POST ["filter"])? $_POST["filter"] : "";
$filter = isset ( $_POST ['filter'] ) ? $_POST ['filter'] : ''; $process = isset($_POST["process"])? $_POST["process"] : "";
$search = isset ( $_POST ['search'] ) ? $_POST ['search'] : ''; $status = isset($_POST["status"])? strtoupper($_POST["status"]) : "";
$process = isset ( $_POST ['process'] ) ? $_POST ['process'] : ''; $user = isset($_POST["user"])? $_POST["user"] : "";
$user = isset ( $_POST ['user'] ) ? $_POST ['user'] : ''; $search = isset($_POST["search"])? $_POST["search"] : "";
$status = isset ( $_POST ['status'] ) ? strtoupper ( $_POST ['status'] ) : ''; $action = isset($_GET["action"])? $_GET["action"] : (isset($_POST["action"])? $_POST["action"] : "todo");
$action = isset ( $_GET ['action'] ) ? $_GET ['action'] : (isset ( $_POST ['action'] ) ? $_POST ['action'] : 'todo'); $type = isset($_GET["type"])? $_GET["type"] : (isset($_POST["type"])? $_POST["type"] : "extjs");
$type = isset ( $_GET ['type'] ) ? $_GET ['type'] : (isset ( $_POST ['type'] ) ? $_POST ['type'] : 'extjs'); $dateFrom = isset($_POST["dateFrom"])? substr($_POST["dateFrom"], 0, 10) : "";
$user = isset ( $_POST ['user'] ) ? $_POST ['user'] : ''; $dateTo = isset($_POST["dateTo"])? substr($_POST["dateTo"], 0, 10) : "";
$dateFrom = isset ( $_POST ['dateFrom'] ) ? substr ( $_POST ['dateFrom'], 0, 10 ) : '';
$dateTo = isset ( $_POST ['dateTo'] ) ? substr ( $_POST ['dateTo'], 0, 10 ) : '';
try { try {
$result = ""; $result = "";
$userUid = (isset ( $_SESSION ['USER_LOGGED'] ) && $_SESSION ['USER_LOGGED'] != '') ? $_SESSION ['USER_LOGGED'] : null; $userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "")? $_SESSION["USER_LOGGED"] : null;
$user = ($user == "CURRENT_USER")? $userUid : $user;
if (($action == 'todo' || $action == 'draft' || $action == 'sent' || $action == 'selfservice' || $action == 'unassigned' || $action == 'search') && (($solrConf = System::solrEnv()) !== false)) { if ((
G::LoadClass ( 'AppSolr' ); $action == "todo" || $action == "draft" || $action == "sent" || $action == "selfservice" ||
$ApplicationSolrIndex = new AppSolr ($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']); $action == "unassigned" || $action == "search"
)
&&
(($solrConf = System::solrEnv()) !== false)
) {
G::LoadClass("AppSolr");
$data = $ApplicationSolrIndex->getAppGridData ( $userUid, $start, $limit, $action, $filter, $search, $process, $user, $status, $type, $dateFrom, $dateTo, $callback, $dir, $sort ); $ApplicationSolrIndex = new AppSolr(
$result = G::json_encode ( $data ); $solrConf["solr_enabled"],
} $solrConf["solr_host"],
else { $solrConf["solr_instance"]
G::LoadClass ( 'applications' );
$apps = new Applications ();
$data = $apps->getAll ( $userUid, $start, $limit, $action, $filter, $search, $process, $user, $status, $type, $dateFrom, $dateTo, $callback, $dir, $sort );
$result = G::json_encode ( $data );
}
echo $result;
}
catch ( Exception $e ) {
$msg = array (
'error' => $e->getMessage ()
); );
print G::json_encode ( $msg );
$data = $ApplicationSolrIndex->getAppGridData(
$userUid,
$start,
$limit,
$action,
$filter,
$search,
$process,
$user,
$status,
$type,
$dateFrom,
$dateTo,
$callback,
$dir,
$sort
);
$result = G::json_encode($data);
} else {
G::LoadClass("applications");
$apps = new Applications();
$data = $apps->getAll(
$userUid,
$start,
$limit,
$action,
$filter,
$search,
$process,
$user,
$status,
$type,
$dateFrom,
$dateTo,
$callback,
$dir,
$sort
);
$result = G::json_encode($data);
} }
echo $result;
} catch (Exception $e) {
$msg = array("error" => $e->getMessage());
echo G::json_encode($msg);
}

View File

@@ -1504,22 +1504,22 @@ Ext.onReady ( function() {
var toolbarToReassign = [ var toolbarToReassign = [
optionMenuOpen, optionMenuOpen,
'-', "-",
btnSelectAll, btnSelectAll,
btnUnSelectAll, btnUnSelectAll,
'-', "-",
btnReassign, btnReassign,
'->', "->",
'user', _("ID_USER"),
comboAllUsers, comboAllUsers,
'-', "-",
_('ID_PROCESS'), _("ID_PROCESS"),
comboProcess, comboProcess,
textSearch, textSearch,
resetSearchButton, resetSearchButton,
btnSearch, btnSearch,
' ', " ",
' ' " "
]; ];
var toolbarSent = [ var toolbarSent = [
@@ -1792,11 +1792,52 @@ var gridForm = new Ext.FormPanel({
//renderTo: bd //renderTo: bd
}); });
//Manually trigger the data store load
switch (action) {
case "draft":
storeCases.setBaseParam("process", comboProcess.store.getAt(0).get(comboProcess.valueField));
storeCases.setBaseParam("search", textSearch.getValue());
break;
case "sent":
storeCases.setBaseParam("process", comboProcess.store.getAt(0).get(comboProcess.valueField));
storeCases.setBaseParam("status", comboStatus.store.getAt(0).get(comboStatus.valueField));
storeCases.setBaseParam("search", textSearch.getValue());
break;
case "to_revise":
storeCases.setBaseParam("process", comboProcess.store.getAt(0).get(comboProcess.valueField));
storeCases.setBaseParam("search", textSearch.getValue());
break;
case "to_reassign":
storeCases.setBaseParam("user", comboAllUsers.store.getAt(0).get(comboAllUsers.valueField));
storeCases.setBaseParam("process", comboProcess.store.getAt(0).get(comboProcess.valueField));
storeCases.setBaseParam("search", textSearch.getValue());
break;
case "search":
storeCases.setBaseParam("process", comboProcess.store.getAt(0).get(comboProcess.valueField));
storeCases.setBaseParam("status", comboStatus.store.getAt(0).get(comboStatus.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", comboProcess.store.getAt(0).get(comboProcess.valueField));
storeCases.setBaseParam("search", textSearch.getValue());
break;
case "gral":
storeCases.setBaseParam("process", comboProcess.store.getAt(0).get(comboProcess.valueField));
storeCases.setBaseParam("search", textSearch.getValue());
break;
default:
//todo
storeCases.setBaseParam("process", comboProcess.store.getAt(0).get(comboProcess.valueField));
storeCases.setBaseParam("search", textSearch.getValue());
break;
}
// manually trigger the data store load storeCases.setBaseParam("action", action);
storeCases.setBaseParam( 'action', action ); storeCases.setBaseParam("start", 0);
storeCases.setBaseParam( 'start', 0 ); storeCases.setBaseParam("limit", pageSize);
storeCases.setBaseParam( 'limit', pageSize );
storeCases.load(); storeCases.load();
//newPopUp.add(reassignGrid); //newPopUp.add(reassignGrid);
newPopUp.add(gridForm); newPopUp.add(gridForm);
@@ -1902,8 +1943,12 @@ var gridForm = new Ext.FormPanel({
catch (e) { catch (e) {
// Nothing to do // Nothing to do
} }
comboStatus.setValue('');
comboProcess.setValue(''); comboProcess.setValue("");
comboStatus.setValue("");
comboUser.setValue("CURRENT_USER");
comboAllUsers.setValue("CURRENT_USER");
// hidding the buttons for the reassign // hidding the buttons for the reassign
// if (action=='to_reassign'){ // if (action=='to_reassign'){
// btnSelectAll.hide(); // btnSelectAll.hide();
@@ -2016,3 +2061,4 @@ function msgBox(title, msg, type){
buttons: Ext.MessageBox.OK buttons: Ext.MessageBox.OK
}); });
} }