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;
|
||||
|
||||
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") {
|
||||
//global $oAppCache;
|
||||
$oAppCache = new AppCacheView();
|
||||
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : null;
|
||||
$query = isset( $_REQUEST['query'] ) ? $_REQUEST['query'] : null;
|
||||
$users = array();
|
||||
$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 = filterUserListArray($users, $query);
|
||||
//now get users, just for the Search action
|
||||
switch ($action) {
|
||||
case 'search_simple':
|
||||
@@ -67,6 +79,14 @@ if ($actionAjax == "userValues") {
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||
$cUsers->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
$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());
|
||||
$oDataset = UsersPeer::doSelectRS( $cUsers );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
@@ -453,7 +473,7 @@ if ($actionAjax == 'showDynaformListHistory') {
|
||||
var showDynaformHistoryGlobal = {};
|
||||
showDynaformHistoryGlobal.dynUID = '';
|
||||
showDynaformHistoryGlobal.tablename = '';
|
||||
showDynaformHistoryGlobal.dynDate = '';casesList_Ajax.php
|
||||
showDynaformHistoryGlobal.dynDate = '';
|
||||
showDynaformHistoryGlobal.dynTitle = '';
|
||||
function showDynaformHistory(dynUID,tablename,dynDate,dynTitle){
|
||||
showDynaformHistoryGlobal.dynUID = dynUID;
|
||||
|
||||
@@ -25,33 +25,17 @@ var textJump;
|
||||
var ids = '';
|
||||
var winReassignInCasesList;
|
||||
|
||||
function formatAMPM(date, initVal, calendarDate) {
|
||||
|
||||
var currentDate = new Date();
|
||||
var currentDay = currentDate.getDate();
|
||||
var currentMonth = currentDate.getMonth()+1;
|
||||
if (currentDay < 10) {
|
||||
currentDay = '0' + currentDay;
|
||||
}
|
||||
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';
|
||||
}
|
||||
function formatAMPM(date, initVal) {
|
||||
var hours = date.getHours();
|
||||
var minutes = (initVal === true)? ((date.getMinutes()<15)? 0: ((date.getMinutes()<30)? 15: ((date.getMinutes()<45)? 30: 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;
|
||||
return strTime;
|
||||
}
|
||||
|
||||
|
||||
Ext.Ajax.timeout = 4 * 60 * 1000;
|
||||
|
||||
var caseSummary = function() {
|
||||
@@ -264,14 +248,13 @@ function pauseCase(date){
|
||||
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/>'
|
||||
|
||||
},
|
||||
new Ext.form.TimeField({
|
||||
id: 'unpauseTime',
|
||||
fieldLabel: _('ID_UNPAUSE_TIME'),
|
||||
name: 'unpauseTime',
|
||||
value: formatAMPM(new Date(), false, date.format('m-d')),
|
||||
minValue: formatAMPM(new Date(), true, date.format('m-d')),
|
||||
value: formatAMPM(new Date(), false),
|
||||
minValue: formatAMPM(new Date(), true),
|
||||
format: 'h:i A'
|
||||
}),
|
||||
{
|
||||
@@ -1147,44 +1130,59 @@ Ext.onReady ( function() {
|
||||
});
|
||||
|
||||
// ComboBox creation processValues
|
||||
var comboUser = new Ext.form.ComboBox({
|
||||
store : 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 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 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',
|
||||
displayField : 'USR_FULLNAME',
|
||||
triggerAction : 'all',
|
||||
displayField:'USR_FULLNAME',
|
||||
typeAhead: true,
|
||||
triggerAction: 'all',
|
||||
emptyText : _('ID_ALL_USERS'),
|
||||
selectOnFocus : true,
|
||||
editable : false,
|
||||
editable : true,
|
||||
width: 180,
|
||||
allowBlank : true,
|
||||
autocomplete: true,
|
||||
typeAhead: true,
|
||||
//allowBlankText : _('ID_SHOULD_SELECT_LANGUAGE_FROM_LIST'),
|
||||
hideTrigger:true,
|
||||
listeners:{
|
||||
scope: this,
|
||||
'select': function() {
|
||||
storeCases.setBaseParam("user", comboUser.store.getAt(0).get(comboUser.valueField));
|
||||
filterUser = comboUser.value;
|
||||
storeCases.setBaseParam( 'user', filterUser);
|
||||
storeCases.setBaseParam( 'start', 0);
|
||||
storeCases.setBaseParam( 'limit', pageSize);
|
||||
//storeCases.load();
|
||||
//storeCases.setBaseParam( 'user', comboUser.store.getAt(0).get(comboUser.valueField));
|
||||
filterUser = suggestUser.value;
|
||||
storeCases.setBaseParam( 'user', filterUser);
|
||||
storeCases.setBaseParam( 'start', 0);
|
||||
storeCases.setBaseParam( 'limit', pageSize);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
var textSearch = new Ext.form.TextField ({
|
||||
allowBlank: true,
|
||||
@@ -1858,7 +1856,8 @@ Ext.onReady ( function() {
|
||||
comboStatus,
|
||||
"-",
|
||||
_("ID_USER"),
|
||||
comboUser,
|
||||
//comboUser,
|
||||
suggestUser,
|
||||
' '
|
||||
//'-',
|
||||
//textSearch,
|
||||
|
||||
Reference in New Issue
Block a user