Changes the form field type to a suggest box so now the user needs to type the 4 first letters of the first name, last name or username field in order to retrieve the field
This commit is contained in:
@@ -42,14 +42,26 @@ G::LoadClass( 'case' );
|
|||||||
|
|
||||||
$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null;
|
$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null;
|
||||||
|
|
||||||
|
function filterUserListArray($users = array(), $filter = '')
|
||||||
|
{
|
||||||
|
$filteredUsers = array();
|
||||||
|
foreach ($users as $user) {
|
||||||
|
if(stripos($user['USR_FULLNAME'], $filter) || empty($filter)) {
|
||||||
|
$filteredUsers[] = $user;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $filteredUsers;
|
||||||
|
}
|
||||||
|
|
||||||
if ($actionAjax == "userValues") {
|
if ($actionAjax == "userValues") {
|
||||||
//global $oAppCache;
|
//global $oAppCache;
|
||||||
$oAppCache = new AppCacheView();
|
$oAppCache = new AppCacheView();
|
||||||
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : null;
|
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : null;
|
||||||
|
$query = isset( $_REQUEST['query'] ) ? $_REQUEST['query'] : null;
|
||||||
$users = array();
|
$users = array();
|
||||||
$users[] = array ("USR_UID" => "", "USR_FULLNAME" => G::LoadTranslation( "ID_ALL_USERS" ));
|
$users[] = array ("USR_UID" => "", "USR_FULLNAME" => G::LoadTranslation( "ID_ALL_USERS" ));
|
||||||
$users[] = array ("USR_UID" => "CURRENT_USER", "USR_FULLNAME" => G::LoadTranslation( "ID_CURRENT_USER" ));
|
$users[] = array ("USR_UID" => "CURRENT_USER", "USR_FULLNAME" => G::LoadTranslation( "ID_CURRENT_USER" ));
|
||||||
|
$users = filterUserListArray($users, $query);
|
||||||
//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':
|
||||||
@@ -67,6 +79,14 @@ if ($actionAjax == "userValues") {
|
|||||||
$cUsers->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
$cUsers->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||||
$cUsers->addSelectColumn(UsersPeer::USR_LASTNAME);
|
$cUsers->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||||
$cUsers->add( UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL );
|
$cUsers->add( UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL );
|
||||||
|
|
||||||
|
if (!is_null($query)) {
|
||||||
|
$filters = $cUsers->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%'.$query.'%', Criteria::LIKE )->addOr(
|
||||||
|
$cUsers->getNewCriterion( UsersPeer::USR_LASTNAME, '%'.$query.'%', Criteria::LIKE )->addOr(
|
||||||
|
$cUsers->getNewCriterion( UsersPeer::USR_USERNAME, '%'.$query.'%', Criteria::LIKE )));
|
||||||
|
$cUsers->addOr( $filters );
|
||||||
|
}
|
||||||
|
$cUsers->setLimit(20);
|
||||||
$cUsers->addAscendingOrderByColumn(UsersPeer::TABLE_NAME . "." . $conf->userNameFormatGetFirstFieldByUsersTable());
|
$cUsers->addAscendingOrderByColumn(UsersPeer::TABLE_NAME . "." . $conf->userNameFormatGetFirstFieldByUsersTable());
|
||||||
$oDataset = UsersPeer::doSelectRS( $cUsers );
|
$oDataset = UsersPeer::doSelectRS( $cUsers );
|
||||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
@@ -453,7 +473,7 @@ if ($actionAjax == 'showDynaformListHistory') {
|
|||||||
var showDynaformHistoryGlobal = {};
|
var showDynaformHistoryGlobal = {};
|
||||||
showDynaformHistoryGlobal.dynUID = '';
|
showDynaformHistoryGlobal.dynUID = '';
|
||||||
showDynaformHistoryGlobal.tablename = '';
|
showDynaformHistoryGlobal.tablename = '';
|
||||||
showDynaformHistoryGlobal.dynDate = '';casesList_Ajax.php
|
showDynaformHistoryGlobal.dynDate = '';
|
||||||
showDynaformHistoryGlobal.dynTitle = '';
|
showDynaformHistoryGlobal.dynTitle = '';
|
||||||
function showDynaformHistory(dynUID,tablename,dynDate,dynTitle){
|
function showDynaformHistory(dynUID,tablename,dynDate,dynTitle){
|
||||||
showDynaformHistoryGlobal.dynUID = dynUID;
|
showDynaformHistoryGlobal.dynUID = dynUID;
|
||||||
|
|||||||
@@ -25,33 +25,17 @@ var textJump;
|
|||||||
var ids = '';
|
var ids = '';
|
||||||
var winReassignInCasesList;
|
var winReassignInCasesList;
|
||||||
|
|
||||||
function formatAMPM(date, initVal, calendarDate) {
|
function formatAMPM(date, initVal) {
|
||||||
|
var hours = date.getHours();
|
||||||
var currentDate = new Date();
|
var minutes = (initVal === true)? ((date.getMinutes()<15)? 0: ((date.getMinutes()<30)? 15: ((date.getMinutes()<45)? 30: 45))): date.getMinutes();
|
||||||
var currentDay = currentDate.getDate();
|
var ampm = hours >= 12 ? 'PM' : 'AM';
|
||||||
var currentMonth = currentDate.getMonth()+1;
|
hours = hours % 12;
|
||||||
if (currentDay < 10) {
|
hours = hours ? hours : 12; // the hour '0' should be '12'
|
||||||
currentDay = '0' + currentDay;
|
minutes = minutes < 10 ? '0' + minutes : minutes;
|
||||||
}
|
var strTime = hours + ':' + minutes + ' ' + ampm;
|
||||||
if (currentMonth < 10) {
|
|
||||||
currentMonth = '0' + currentMonth;
|
|
||||||
}
|
|
||||||
currentDate = currentMonth + '-' + currentDay;
|
|
||||||
if (currentDate == calendarDate) {
|
|
||||||
var hours = date.getHours();
|
|
||||||
var minutes = (initVal === true)? ((date.getMinutes()<15)? 15: ((date.getMinutes()<30)? 30: ((date.getMinutes()<45)? 45: 45))): date.getMinutes();
|
|
||||||
var ampm = hours >= 12 ? 'PM' : 'AM';
|
|
||||||
hours = hours % 12;
|
|
||||||
hours = hours ? hours : 12; // the hour '0' should be '12'
|
|
||||||
minutes = minutes < 10 ? '0' + minutes : minutes;
|
|
||||||
var strTime = hours + ':' + minutes + ' ' + ampm;
|
|
||||||
} else {
|
|
||||||
var strTime = '12:00 AM';
|
|
||||||
}
|
|
||||||
return strTime;
|
return strTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ext.Ajax.timeout = 4 * 60 * 1000;
|
Ext.Ajax.timeout = 4 * 60 * 1000;
|
||||||
|
|
||||||
var caseSummary = function() {
|
var caseSummary = function() {
|
||||||
@@ -264,14 +248,13 @@ function pauseCase(date){
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
html: '<div align="center" style="font: 14px tahoma,arial,helvetica,sans-serif">' + _('ID_PAUSE_CASE_TO_DATE') +' '+date.format('M j, Y')+'? </div> <br/>'
|
html: '<div align="center" style="font: 14px tahoma,arial,helvetica,sans-serif">' + _('ID_PAUSE_CASE_TO_DATE') +' '+date.format('M j, Y')+'? </div> <br/>'
|
||||||
|
|
||||||
},
|
},
|
||||||
new Ext.form.TimeField({
|
new Ext.form.TimeField({
|
||||||
id: 'unpauseTime',
|
id: 'unpauseTime',
|
||||||
fieldLabel: _('ID_UNPAUSE_TIME'),
|
fieldLabel: _('ID_UNPAUSE_TIME'),
|
||||||
name: 'unpauseTime',
|
name: 'unpauseTime',
|
||||||
value: formatAMPM(new Date(), false, date.format('m-d')),
|
value: formatAMPM(new Date(), false),
|
||||||
minValue: formatAMPM(new Date(), true, date.format('m-d')),
|
minValue: formatAMPM(new Date(), true),
|
||||||
format: 'h:i A'
|
format: 'h:i A'
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
@@ -1147,44 +1130,59 @@ Ext.onReady ( function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ComboBox creation processValues
|
// ComboBox creation processValues
|
||||||
var comboUser = new Ext.form.ComboBox({
|
var userStore = new Ext.data.Store( {
|
||||||
store : new Ext.data.Store( {
|
proxy : new Ext.data.HttpProxy( {
|
||||||
proxy : new Ext.data.HttpProxy( {
|
url : 'casesList_Ajax?actionAjax=userValues&action='+action,
|
||||||
url : 'casesList_Ajax?actionAjax=userValues&action='+action,
|
method : 'POST'
|
||||||
method : 'POST'
|
}),
|
||||||
}),
|
reader : new Ext.data.JsonReader( {
|
||||||
reader : new Ext.data.JsonReader( {
|
fields : [ {
|
||||||
fields : [ {
|
name : 'USR_UID'
|
||||||
name : 'USR_UID'
|
}, {
|
||||||
}, {
|
name : 'USR_FULLNAME'
|
||||||
name : 'USR_FULLNAME'
|
} ]
|
||||||
} ]
|
})
|
||||||
})
|
});
|
||||||
}),
|
|
||||||
|
var userStore = new Ext.data.Store( {
|
||||||
|
proxy : new Ext.data.HttpProxy({
|
||||||
|
url : 'casesList_Ajax?actionAjax=userValues&action='+action,
|
||||||
|
method : 'POST'
|
||||||
|
}),
|
||||||
|
reader : new Ext.data.JsonReader({
|
||||||
|
fields : [{
|
||||||
|
name : 'USR_UID'
|
||||||
|
}, {
|
||||||
|
name : 'USR_FULLNAME'
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
var suggestUser = new Ext.form.ComboBox({
|
||||||
|
store: userStore,
|
||||||
valueField : 'USR_UID',
|
valueField : 'USR_UID',
|
||||||
displayField : 'USR_FULLNAME',
|
displayField:'USR_FULLNAME',
|
||||||
triggerAction : 'all',
|
typeAhead: true,
|
||||||
|
triggerAction: 'all',
|
||||||
emptyText : _('ID_ALL_USERS'),
|
emptyText : _('ID_ALL_USERS'),
|
||||||
selectOnFocus : true,
|
selectOnFocus : true,
|
||||||
editable : false,
|
editable : true,
|
||||||
width: 180,
|
width: 180,
|
||||||
allowBlank : true,
|
allowBlank : true,
|
||||||
autocomplete: true,
|
autocomplete: true,
|
||||||
typeAhead: true,
|
typeAhead: true,
|
||||||
//allowBlankText : _('ID_SHOULD_SELECT_LANGUAGE_FROM_LIST'),
|
hideTrigger:true,
|
||||||
listeners:{
|
listeners:{
|
||||||
scope: this,
|
scope: this,
|
||||||
'select': function() {
|
'select': function() {
|
||||||
storeCases.setBaseParam("user", comboUser.store.getAt(0).get(comboUser.valueField));
|
//storeCases.setBaseParam( 'user', comboUser.store.getAt(0).get(comboUser.valueField));
|
||||||
filterUser = comboUser.value;
|
filterUser = suggestUser.value;
|
||||||
storeCases.setBaseParam( 'user', filterUser);
|
storeCases.setBaseParam( 'user', filterUser);
|
||||||
storeCases.setBaseParam( 'start', 0);
|
storeCases.setBaseParam( 'start', 0);
|
||||||
storeCases.setBaseParam( 'limit', pageSize);
|
storeCases.setBaseParam( 'limit', pageSize);
|
||||||
//storeCases.load();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var textSearch = new Ext.form.TextField ({
|
var textSearch = new Ext.form.TextField ({
|
||||||
allowBlank: true,
|
allowBlank: true,
|
||||||
@@ -1858,7 +1856,8 @@ Ext.onReady ( function() {
|
|||||||
comboStatus,
|
comboStatus,
|
||||||
"-",
|
"-",
|
||||||
_("ID_USER"),
|
_("ID_USER"),
|
||||||
comboUser,
|
//comboUser,
|
||||||
|
suggestUser,
|
||||||
' '
|
' '
|
||||||
//'-',
|
//'-',
|
||||||
//textSearch,
|
//textSearch,
|
||||||
|
|||||||
Reference in New Issue
Block a user