Merge pull request #165 from julceslauhub/master

BUG 9401 Cuando se cambia el rol de un usuario este genera un error ... SOLVED
This commit is contained in:
julceslauhub
2012-07-02 22:49:54 -07:00

View File

@@ -10,6 +10,7 @@ var infoMode;
var global = {}; var global = {};
var readMode; var readMode;
var usernameText; var usernameText;
var previousUsername = '';
var canEdit = true; var canEdit = true;
var flagPoliciesPassword = false; var flagPoliciesPassword = false;
var flagValidateUsername = false; var flagValidateUsername = false;
@@ -21,23 +22,23 @@ global.aux = '';
Ext.onReady(function() { Ext.onReady(function() {
Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.QuickTips.init(); Ext.QuickTips.init();
box = new Ext.BoxComponent({ box = new Ext.BoxComponent({
width : 100, width : 100,
height : 80, height : 80,
fieldLabel : '&nbsp', fieldLabel : '&nbsp',
labelSeparator : '&nbsp', labelSeparator : '&nbsp',
autoEl : { autoEl : {
tag : 'img', tag : 'img',
src : 'users_ViewPhotoGrid?h=' + Math.random() +'&pUID=' + USR_UID + '', src : 'users_ViewPhotoGrid?h=' + Math.random() +'&pUID=' + USR_UID + '',
align : 'left' align : 'left'
} }
}); });
if (MODE == 'edit') if (MODE == 'edit' || MODE == '')
flagPoliciesPassword = true; flagPoliciesPassword = true;
//EDIT MODE //EDIT MODE
if (USR_UID != '') { if (USR_UID != '') {
allowBlackStatus = true; allowBlackStatus = true;
@@ -52,16 +53,16 @@ Ext.onReady(function() {
readMode = true; readMode = true;
box.setVisible(false); box.setVisible(false);
box.disable(); box.disable();
} }
else else
{ {
displayPreferences = 'display:none;'; displayPreferences = 'display:none;';
loadUserData(); loadUserData();
readMode = false; readMode = false;
canEdit = false; canEdit = false;
} }
} }
else { else {
allowBlackStatus=false; allowBlackStatus=false;
@@ -74,7 +75,7 @@ Ext.onReady(function() {
profileFields = new Ext.form.FieldSet({ profileFields = new Ext.form.FieldSet({
title : _('ID_PROFILE'), title : _('ID_PROFILE'),
items : [ items : [
box, box,
{ {
@@ -90,12 +91,12 @@ Ext.onReady(function() {
} }
},{ },{
xtype : 'label', xtype : 'label',
id : 'lblMaxFileSize', id : 'lblMaxFileSize',
fieldLabel : _('ID_MAX_FILE_SIZE'), fieldLabel : _('ID_MAX_FILE_SIZE'),
text : MAX_FILES_SIZE, text : MAX_FILES_SIZE,
width : 400 width : 400
} }
/* /*
,{ ,{
@@ -112,7 +113,7 @@ Ext.onReady(function() {
} }
*/ */
] ]
}); });
storeCountry = new Ext.data.Store( { storeCountry = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( { proxy : new Ext.data.HttpProxy( {
@@ -143,11 +144,11 @@ Ext.onReady(function() {
mode : 'local', mode : 'local',
listeners : { listeners : {
select : function(combo,record,index){ select : function(combo,record,index){
global.IC_UID = this.getValue(); global.IC_UID = this.getValue();
comboRegion.store.removeAll(); comboRegion.store.removeAll();
comboLocation.store.removeAll(); comboLocation.store.removeAll();
comboRegion.clearValue(); comboRegion.clearValue();
storeRegion.load({ storeRegion.load({
params : { params : {
action : 'stateList', action : 'stateList',
IC_UID : global.IC_UID IC_UID : global.IC_UID
@@ -163,7 +164,7 @@ Ext.onReady(function() {
storeCountry.load({ storeCountry.load({
params : {"action" : "countryList"} params : {"action" : "countryList"}
}); });
storeRegion = new Ext.data.Store( { storeRegion = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( { proxy : new Ext.data.HttpProxy( {
url : 'usersAjax', url : 'usersAjax',
@@ -173,7 +174,7 @@ Ext.onReady(function() {
fields : [ { fields : [ {
name : 'IS_UID' name : 'IS_UID'
}, { }, {
name : 'IS_NAME' name : 'IS_NAME'
} ] } ]
}) })
}); });
@@ -194,18 +195,18 @@ Ext.onReady(function() {
listeners : { listeners : {
select : function(combo, record, index) { select : function(combo, record, index) {
global.IS_UID = this.getValue(); global.IS_UID = this.getValue();
comboLocation.enable(); comboLocation.enable();
comboLocation.clearValue(); comboLocation.clearValue();
storelocation.load({ storelocation.load({
params : { params : {
action : 'locationList', action : 'locationList',
IC_UID : global.IC_UID, IC_UID : global.IC_UID,
IS_UID : global.IS_UID IS_UID : global.IS_UID
} }
}); });
comboLocation.store.on('load', function(store) { comboLocation.store.on('load', function(store) {
comboLocation.setValue(''); comboLocation.setValue('');
}); });
} }
} }
}); });
@@ -236,13 +237,13 @@ Ext.onReady(function() {
autocomplete : true, autocomplete : true,
typeAhead : true, typeAhead : true,
mode : 'local' mode : 'local'
}); });
comboReplacedBy = new Ext.form.ComboBox({ comboReplacedBy = new Ext.form.ComboBox({
fieldLabel : _('ID_REPLACED_BY'), fieldLabel : _('ID_REPLACED_BY'),
hiddenName : 'USR_REPLACED_BY', hiddenName : 'USR_REPLACED_BY',
id : 'USR_REPLACED_BY', id : 'USR_REPLACED_BY',
store : new Ext.data.Store( { store : new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( { proxy : new Ext.data.HttpProxy( {
url : 'usersAjax', url : 'usersAjax',
@@ -257,11 +258,11 @@ Ext.onReady(function() {
} ] } ]
}), }),
autoLoad:true autoLoad:true
}), }),
valueField : 'USR_UID', valueField : 'USR_UID',
displayField : 'USER_FULLNAME', displayField : 'USER_FULLNAME',
emptyText : TRANSLATIONS.ID_SELECT, emptyText : TRANSLATIONS.ID_SELECT,
width : 180, width : 180,
selectOnFocus : true, selectOnFocus : true,
editable : false, editable : false,
triggerAction: 'all', triggerAction: 'all',
@@ -301,7 +302,7 @@ Ext.onReady(function() {
}), }),
autoLoad : true autoLoad : true
}), }),
valueField : 'CALENDAR_UID', valueField : 'CALENDAR_UID',
displayField : 'CALENDAR_NAME', displayField : 'CALENDAR_NAME',
emptyText : TRANSLATIONS.ID_SELECT, emptyText : TRANSLATIONS.ID_SELECT,
@@ -311,7 +312,7 @@ Ext.onReady(function() {
allowBlank : false, allowBlank : false,
triggerAction : 'all', triggerAction : 'all',
mode : 'local' mode : 'local'
}); });
comboCalendar.store.on('load', function(store) { comboCalendar.store.on('load', function(store) {
comboCalendar.setValue(store.getAt(0).get('CALENDAR_UID')); comboCalendar.setValue(store.getAt(0).get('CALENDAR_UID'));
@@ -320,7 +321,7 @@ Ext.onReady(function() {
var status = new Ext.data.SimpleStore({ var status = new Ext.data.SimpleStore({
fields : ['USR_STATUS', 'status'], fields : ['USR_STATUS', 'status'],
data : [['ACTIVE', 'ACTIVE'], ['INACTIVE', 'INACTIVE'], ['VACATION', 'ON VACATION']] data : [['ACTIVE', 'ACTIVE'], ['INACTIVE', 'INACTIVE'], ['VACATION', 'ON VACATION']]
}); });
comboStatus = new Ext.form.ComboBox({ comboStatus = new Ext.form.ComboBox({
xtype : 'combo', xtype : 'combo',
name : 'status', name : 'status',
@@ -339,7 +340,7 @@ Ext.onReady(function() {
readOnly : readMode readOnly : readMode
}); });
comboRole = new Ext.form.ComboBox({ comboRole = new Ext.form.ComboBox({
fieldLabel : _('ID_ROLE'), fieldLabel : _('ID_ROLE'),
hiddenName : 'USR_ROLE', hiddenName : 'USR_ROLE',
@@ -360,7 +361,7 @@ Ext.onReady(function() {
}), }),
autoLoad : true autoLoad : true
}), }),
valueField : 'ROL_UID', valueField : 'ROL_UID',
displayField : 'ROL_CODE', displayField : 'ROL_CODE',
emptyText : TRANSLATIONS.ID_SELECT, emptyText : TRANSLATIONS.ID_SELECT,
@@ -370,30 +371,30 @@ Ext.onReady(function() {
allowBlank : false, allowBlank : false,
triggerAction : 'all', triggerAction : 'all',
mode : 'local' mode : 'local'
}); });
comboRole.store.on('load',function(store) { comboRole.store.on('load',function(store) {
comboRole.setValue(store.getAt(0).get('ROL_UID')); comboRole.setValue(store.getAt(0).get('ROL_UID'));
}) })
informationFields = new Ext.form.FieldSet({ informationFields = new Ext.form.FieldSet({
title : _('ID_PERSONAL_INFORMATION'), title : _('ID_PERSONAL_INFORMATION'),
items : [ items : [
{ {
id : 'USR_FIRSTNAME', id : 'USR_FIRSTNAME',
fieldLabel : _('ID_FIRSTNAME'), fieldLabel : _('ID_FIRSTNAME'),
xtype : 'textfield', xtype : 'textfield',
width : 260, width : 260,
allowBlank : false allowBlank : false
}, },
{ {
id : 'USR_LASTNAME', id : 'USR_LASTNAME',
fieldLabel : _('ID_LASTNAME'), fieldLabel : _('ID_LASTNAME'),
xtype : 'textfield', xtype : 'textfield',
width : 260, width : 260,
allowBlank : false allowBlank : false
}, },
{ {
id : 'USR_USERNAME', id : 'USR_USERNAME',
fieldLabel : _('ID_USER_ID'), fieldLabel : _('ID_USER_ID'),
@@ -406,7 +407,7 @@ Ext.onReady(function() {
// trim // trim
this.value = this.getValue().replace(/^\s+|\s+$/g,""); this.value = this.getValue().replace(/^\s+|\s+$/g,"");
document.getElementById('USR_USERNAME').value = this.getValue().replace(/^\s+|\s+$/g,""); document.getElementById('USR_USERNAME').value = this.getValue().replace(/^\s+|\s+$/g,"");
Ext.getCmp('saveB').disable(); Ext.getCmp('saveB').disable();
Ext.getCmp('cancelB').disable(); Ext.getCmp('cancelB').disable();
@@ -426,10 +427,10 @@ Ext.onReady(function() {
} }
}, },
{ {
xtype: 'label', xtype: 'label',
fieldLabel: ' ', fieldLabel: ' ',
id:'usernameReview', id:'usernameReview',
width: 300, width: 300,
labelSeparator: '' labelSeparator: ''
}, },
{ {
@@ -453,7 +454,7 @@ Ext.onReady(function() {
fieldLabel : _('ID_ZIP_CODE'), fieldLabel : _('ID_ZIP_CODE'),
xtype : 'textfield', xtype : 'textfield',
width : 260 width : 260
}, },
comboCountry, comboCountry,
comboRegion, comboRegion,
comboLocation, comboLocation,
@@ -508,15 +509,15 @@ Ext.onReady(function() {
'action' : 'testPassword', 'action' : 'testPassword',
'PASSWORD_TEXT' : passwordText 'PASSWORD_TEXT' : passwordText
}, },
success: function(r,o){ success: function(r,o){
var resp = Ext.util.JSON.decode(r.responseText); var resp = Ext.util.JSON.decode(r.responseText);
if (resp.STATUS) { if (resp.STATUS) {
flagPoliciesPassword = true; flagPoliciesPassword = true;
} else { } else {
flagPoliciesPassword = false; flagPoliciesPassword = false;
} }
Ext.getCmp('passwordReview').setText(resp.DESCRIPTION, false); Ext.getCmp('passwordReview').setText(resp.DESCRIPTION, false);
Ext.getCmp('saveB').enable(); Ext.getCmp('saveB').enable();
Ext.getCmp('cancelB').enable(); Ext.getCmp('cancelB').enable();
@@ -544,10 +545,10 @@ Ext.onReady(function() {
} }
}, },
{ {
xtype: 'label', xtype: 'label',
fieldLabel: ' ', fieldLabel: ' ',
id:'passwordReview', id:'passwordReview',
width: 300, width: 300,
labelSeparator: '' labelSeparator: ''
}, },
{ {
@@ -577,13 +578,13 @@ Ext.onReady(function() {
} }
}, },
{ {
xtype: 'label', xtype: 'label',
fieldLabel: ' ', fieldLabel: ' ',
id:'passwordConfirm', id:'passwordConfirm',
width: 300, width: 300,
labelSeparator: '' labelSeparator: ''
} }
] ]
}); });
@@ -605,7 +606,7 @@ Ext.onReady(function() {
} ] } ]
}), }),
autoLoad : true autoLoad : true
}), }),
valueField : 'id', valueField : 'id',
displayField : 'name', displayField : 'name',
emptyText : TRANSLATIONS.ID_SELECT, emptyText : TRANSLATIONS.ID_SELECT,
@@ -636,7 +637,7 @@ Ext.onReady(function() {
} ] } ]
}), }),
autoLoad : true autoLoad : true
}), }),
valueField : 'id', valueField : 'id',
displayField : 'name', displayField : 'name',
emptyText : TRANSLATIONS.ID_SELECT, emptyText : TRANSLATIONS.ID_SELECT,
@@ -658,7 +659,7 @@ Ext.onReady(function() {
xtype : 'hidden', xtype : 'hidden',
name : 'PREF_DEFAULT_LANG', name : 'PREF_DEFAULT_LANG',
value : '' value : ''
}, },
comboDefaultMainMenuOption, comboDefaultMainMenuOption,
comboDefaultCasesMenuOption comboDefaultCasesMenuOption
] ]
@@ -693,28 +694,28 @@ Ext.onReady(function() {
id : 'saveB', id : 'saveB',
handler: saveUser handler: saveUser
}, },
{ {
text : _('ID_CANCEL'), text : _('ID_CANCEL'),
id : 'cancelB', id : 'cancelB',
handler : function(){ handler : function(){
if (!infoMode) { if (!infoMode) {
location.href = 'users_List'; location.href = 'users_List';
} }
else{ else{
frmDetails.hide(); frmDetails.hide();
frmSumary.show(); frmSumary.show();
} }
//location.href = 'users_List'; //location.href = 'users_List';
} }
//hidden:readMode //hidden:readMode
} }
] ]
}); });
//USERS SUMMARY //USERS SUMMARY
box2 = new Ext.BoxComponent({ box2 = new Ext.BoxComponent({
width: 100, width: 100,
@@ -722,12 +723,12 @@ Ext.onReady(function() {
fieldLabel : '&nbsp', fieldLabel : '&nbsp',
labelSeparator : '&nbsp', labelSeparator : '&nbsp',
autoEl : { autoEl : {
tag : 'img', tag : 'img',
src : 'users_ViewPhotoGrid?h=' + Math.random() +'&pUID=' + USR_UID + '', src : 'users_ViewPhotoGrid?h=' + Math.random() +'&pUID=' + USR_UID + '',
align : 'left'} align : 'left'}
}); });
profileFields2 = new Ext.form.FieldSet({ profileFields2 = new Ext.form.FieldSet({
title : _('ID_PROFILE'), title : _('ID_PROFILE'),
items : [ items : [
box2 box2
] ]
@@ -737,15 +738,15 @@ Ext.onReady(function() {
items : [ items : [
{ {
id : 'USR_FIRSTNAME2', id : 'USR_FIRSTNAME2',
fieldLabel : _('ID_FIRSTNAME'), fieldLabel : _('ID_FIRSTNAME'),
xtype : 'label', xtype : 'label',
width : 260 width : 260
}, },
{ {
id : 'USR_LASTNAME2', id : 'USR_LASTNAME2',
fieldLabel : _('ID_LASTNAME'), fieldLabel : _('ID_LASTNAME'),
xtype : 'label', xtype : 'label',
width : 260 width : 260
}, },
{ {
id : 'USR_USERNAME2', id : 'USR_USERNAME2',
@@ -757,7 +758,7 @@ Ext.onReady(function() {
id : 'USR_EMAIL2', id : 'USR_EMAIL2',
fieldLabel : _('ID_EMAIL'), fieldLabel : _('ID_EMAIL'),
xtype : 'label', xtype : 'label',
width : 260 width : 260
}, },
{ {
xtype : 'label', xtype : 'label',
@@ -865,10 +866,10 @@ Ext.onReady(function() {
} }
] ]
}); });
frmSumary = new Ext.FormPanel({ frmSumary = new Ext.FormPanel({
id : 'frmSumary', id : 'frmSumary',
labelWidth : 320, labelWidth : 320,
labelAlign : 'right', labelAlign : 'right',
autoScroll : true, autoScroll : true,
fileUpload : true, fileUpload : true,
@@ -890,7 +891,7 @@ Ext.onReady(function() {
handler : editUser, handler : editUser,
hidden : canEdit hidden : canEdit
} }
] ]
}); });
@@ -920,7 +921,7 @@ Ext.onReady(function() {
function defineUserPanel() function defineUserPanel()
{ {
var isIE = ( navigator.userAgent.indexOf('MSIE')>0 ) ? true : false; var isIE = ( navigator.userAgent.indexOf('MSIE')>0 ) ? true : false;
var eDivPanel = document.createElement("div"); var eDivPanel = document.createElement("div");
var eDivUsersPanel = document.createElement("div"); var eDivUsersPanel = document.createElement("div");
@@ -962,7 +963,7 @@ function validateUserName() {
'USR_UID' : USR_UID, 'USR_UID' : USR_UID,
'NEW_USERNAME' : usernameText 'NEW_USERNAME' : usernameText
}, },
success: function(r,o){ success: function(r,o){
var resp = Ext.util.JSON.decode(r.responseText); var resp = Ext.util.JSON.decode(r.responseText);
if (resp.exists) { if (resp.exists) {
@@ -972,7 +973,7 @@ function validateUserName() {
} else { } else {
flagValidateUsername = true; flagValidateUsername = true;
} }
Ext.getCmp('usernameReview').setText(resp.descriptionText, false); Ext.getCmp('usernameReview').setText(resp.descriptionText, false);
Ext.getCmp('saveB').enable(); Ext.getCmp('saveB').enable();
Ext.getCmp('cancelB').enable(); Ext.getCmp('cancelB').enable();
@@ -993,18 +994,27 @@ function validateUserName() {
function saveUser() function saveUser()
{ {
if (flagValidateUsername != true) { if (Ext.getCmp('USR_USERNAME').getValue() != '') {
validateUserName(); if (previousUsername != '') {
if ( Ext.getCmp('USR_USERNAME').getValue() == '') { if (Ext.getCmp('USR_USERNAME').getValue() != previousUsername) {
Ext.Msg.alert( _('ID_ERROR'), _('ID_MSG_ERROR_USR_USERNAME')); if (!flagValidateUsername) {
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('usernameReview').html);
return false;
}
}
} else { } else {
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('usernameReview').html); if (!flagValidateUsername) {
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('usernameReview').html);
return false;
}
} }
} else {
Ext.Msg.alert( _('ID_ERROR'), _('ID_MSG_ERROR_USR_USERNAME'));
return false; return false;
} }
if (flagPoliciesPassword != true) { if (!flagPoliciesPassword) {
if ( Ext.getCmp('USR_NEW_PASS').getValue() == '') { if (Ext.getCmp('USR_NEW_PASS').getValue() == '') {
Ext.Msg.alert( _('ID_ERROR'), _('ID_PASSWD_REQUIRED')); Ext.Msg.alert( _('ID_ERROR'), _('ID_PASSWD_REQUIRED'));
} else { } else {
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('passwordReview').html); Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('passwordReview').html);
@@ -1013,7 +1023,7 @@ function saveUser()
} }
var newPass = frmDetails.getForm().findField('USR_NEW_PASS').getValue(); var newPass = frmDetails.getForm().findField('USR_NEW_PASS').getValue();
var confPass = frmDetails.getForm().findField('USR_CNF_PASS').getValue(); var confPass = frmDetails.getForm().findField('USR_CNF_PASS').getValue();
if (confPass === newPass) { if (confPass === newPass) {
Ext.getCmp('frmDetails').getForm().submit( { Ext.getCmp('frmDetails').getForm().submit( {
@@ -1026,7 +1036,7 @@ function saveUser()
waitMsg : _('ID_SAVING_PROCESS'), waitMsg : _('ID_SAVING_PROCESS'),
timeout : 36000, timeout : 36000,
success : function(obj, resp) { success : function(obj, resp) {
if (!infoMode) { if (!infoMode) {
location.href = 'users_List'; location.href = 'users_List';
} }
else { else {
@@ -1058,8 +1068,8 @@ function saveUser()
else else
Ext.Msg.alert( _('ID_ERROR'), _('ID_PASSWORDS_DONT_MATCH')); Ext.Msg.alert( _('ID_ERROR'), _('ID_PASSWORDS_DONT_MATCH'));
} }
// Load data for Edit mode // Load data for Edit mode
function loadUserData() function loadUserData()
{ {
@@ -1069,12 +1079,12 @@ function loadUserData()
'action' : 'userData', 'action' : 'userData',
USR_UID : USR_UID USR_UID : USR_UID
}, },
waitMsg : _('ID_UPLOADING_PROCESS_FILE'), waitMsg : _('ID_UPLOADING_PROCESS_FILE'),
success : function(r,o){ success : function(r,o){
var data = Ext.util.JSON.decode(r.responseText); var data = Ext.util.JSON.decode(r.responseText);
Ext.getCmp('frmDetails').getForm().setValues({ Ext.getCmp('frmDetails').getForm().setValues({
USR_FIRSTNAME : data.user.USR_FIRSTNAME, USR_FIRSTNAME : data.user.USR_FIRSTNAME,
USR_LASTNAME : data.user.USR_LASTNAME, USR_LASTNAME : data.user.USR_LASTNAME,
USR_USERNAME : data.user.USR_USERNAME, USR_USERNAME : data.user.USR_USERNAME,
USR_EMAIL : data.user.USR_EMAIL, USR_EMAIL : data.user.USR_EMAIL,
@@ -1085,8 +1095,8 @@ function loadUserData()
USR_DUE_DATE : data.user.USR_DUE_DATE, USR_DUE_DATE : data.user.USR_DUE_DATE,
USR_STATUS : data.user.USR_STATUS USR_STATUS : data.user.USR_STATUS
}) })
storeCountry.load({ storeCountry.load({
params : { params : {
action : 'countryList' action : 'countryList'
@@ -1104,23 +1114,23 @@ function loadUserData()
params : { params : {
action : 'locationList', action : 'locationList',
IC_UID : data.user.USR_COUNTRY, IC_UID : data.user.USR_COUNTRY,
IS_UID : data.user.USR_CITY IS_UID : data.user.USR_CITY
} }
}); });
comboCountry.store.on('load',function(store) { comboCountry.store.on('load',function(store) {
comboCountry.setValue(data.user.USR_COUNTRY); comboCountry.setValue(data.user.USR_COUNTRY);
}); });
global.IC_UID = data.user.USR_COUNTRY; global.IC_UID = data.user.USR_COUNTRY;
comboRegion.store.on('load',function(store) { comboRegion.store.on('load',function(store) {
comboRegion.setValue(data.user.USR_CITY); comboRegion.setValue(data.user.USR_CITY);
}); });
global.IS_UID = data.user.USR_CITY; global.IS_UID = data.user.USR_CITY;
comboLocation.store.on('load',function(store) { comboLocation.store.on('load',function(store) {
comboLocation.setValue(data.user.USR_LOCATION); comboLocation.setValue(data.user.USR_LOCATION);
}); });
comboReplacedBy.store.on('load',function(store) { comboReplacedBy.store.on('load',function(store) {
comboReplacedBy.setValue(data.user.USR_REPLACED_BY); comboReplacedBy.setValue(data.user.USR_REPLACED_BY);
}); });
@@ -1130,7 +1140,9 @@ function loadUserData()
comboCalendar.store.on('load',function(store) { comboCalendar.store.on('load',function(store) {
comboCalendar.setValue(data.user.USR_CALENDAR); comboCalendar.setValue(data.user.USR_CALENDAR);
}); });
previousUsername = Ext.getCmp('USR_USERNAME').getValue();
}, },
failure : function(r, o) { failure : function(r, o) {
@@ -1147,12 +1159,12 @@ function loadUserView()
'action' : 'userData', 'action' : 'userData',
USR_UID : USR_UID USR_UID : USR_UID
}, },
waitMsg : _('ID_UPLOADING_PROCESS_FILE'), waitMsg : _('ID_UPLOADING_PROCESS_FILE'),
success : function(r,o){ success : function(r,o){
var data = Ext.util.JSON.decode(r.responseText); var data = Ext.util.JSON.decode(r.responseText);
Ext.getCmp('frmDetails').getForm().setValues({ Ext.getCmp('frmDetails').getForm().setValues({
USR_FIRSTNAME : data.user.USR_FIRSTNAME, USR_FIRSTNAME : data.user.USR_FIRSTNAME,
USR_LASTNAME : data.user.USR_LASTNAME, USR_LASTNAME : data.user.USR_LASTNAME,
USR_USERNAME : data.user.USR_USERNAME, USR_USERNAME : data.user.USR_USERNAME,
USR_EMAIL : data.user.USR_EMAIL, USR_EMAIL : data.user.USR_EMAIL,
@@ -1169,19 +1181,19 @@ function loadUserView()
Ext.getCmp('USR_EMAIL2').setText(data.user.USR_EMAIL); Ext.getCmp('USR_EMAIL2').setText(data.user.USR_EMAIL);
Ext.getCmp('USR_ADDRESS2').setText(data.user.USR_ADDRESS); Ext.getCmp('USR_ADDRESS2').setText(data.user.USR_ADDRESS);
Ext.getCmp('USR_ZIP_CODE2').setText(data.user.USR_ZIP_CODE); Ext.getCmp('USR_ZIP_CODE2').setText(data.user.USR_ZIP_CODE);
Ext.getCmp('USR_COUNTRY2').setText(data.user.USR_COUNTRY_NAME); Ext.getCmp('USR_COUNTRY2').setText(data.user.USR_COUNTRY_NAME);
Ext.getCmp('USR_CITY2').setText(data.user.USR_CITY_NAME); Ext.getCmp('USR_CITY2').setText(data.user.USR_CITY_NAME);
Ext.getCmp('USR_LOCATION2').setText(data.user.USR_LOCATION_NAME); Ext.getCmp('USR_LOCATION2').setText(data.user.USR_LOCATION_NAME);
Ext.getCmp('USR_PHONE2').setText(data.user.USR_PHONE); Ext.getCmp('USR_PHONE2').setText(data.user.USR_PHONE);
Ext.getCmp('USR_POSITION2').setText(data.user.USR_POSITION); Ext.getCmp('USR_POSITION2').setText(data.user.USR_POSITION);
Ext.getCmp('USR_REPLACED_BY2').setText(data.user.REPLACED_NAME); Ext.getCmp('USR_REPLACED_BY2').setText(data.user.REPLACED_NAME);
Ext.getCmp('USR_DUE_DATE2').setText(data.user.USR_DUE_DATE); Ext.getCmp('USR_DUE_DATE2').setText(data.user.USR_DUE_DATE);
Ext.getCmp('USR_STATUS2').setText(data.user.USR_STATUS); Ext.getCmp('USR_STATUS2').setText(data.user.USR_STATUS);
Ext.getCmp('USR_ROLE2').setText(data.user.USR_ROLE); Ext.getCmp('USR_ROLE2').setText(data.user.USR_ROLE);
Ext.getCmp('PREF_DEFAULT_MAIN_MENU_OPTION2').setText(data.user.MENUSELECTED_NAME); Ext.getCmp('PREF_DEFAULT_MAIN_MENU_OPTION2').setText(data.user.MENUSELECTED_NAME);
Ext.getCmp('PREF_DEFAULT_CASES_MENUSELECTED2').setText(data.user.CASES_MENUSELECTED_NAME); Ext.getCmp('PREF_DEFAULT_CASES_MENUSELECTED2').setText(data.user.CASES_MENUSELECTED_NAME);
@@ -1202,23 +1214,23 @@ function loadUserView()
params : { params : {
action : 'locationList', action : 'locationList',
IC_UID : data.user.USR_COUNTRY, IC_UID : data.user.USR_COUNTRY,
IS_UID : data.user.USR_CITY IS_UID : data.user.USR_CITY
} }
}); });
comboCountry.store.on('load',function(store) { comboCountry.store.on('load',function(store) {
comboCountry.setValue(data.user.USR_COUNTRY); comboCountry.setValue(data.user.USR_COUNTRY);
}); });
global.IC_UID = data.user.USR_COUNTRY; global.IC_UID = data.user.USR_COUNTRY;
comboRegion.store.on('load',function(store) { comboRegion.store.on('load',function(store) {
comboRegion.setValue(data.user.USR_CITY); comboRegion.setValue(data.user.USR_CITY);
}); });
global.IS_UID = data.user.USR_CITY; global.IS_UID = data.user.USR_CITY;
comboLocation.store.on('load',function(store) { comboLocation.store.on('load',function(store) {
comboLocation.setValue(data.user.USR_LOCATION); comboLocation.setValue(data.user.USR_LOCATION);
}); });
comboReplacedBy.store.on('load',function(store) { comboReplacedBy.store.on('load',function(store) {
comboReplacedBy.setValue(data.user.USR_REPLACED_BY); comboReplacedBy.setValue(data.user.USR_REPLACED_BY);
}); });
@@ -1228,7 +1240,7 @@ function loadUserView()
comboCalendar.store.on('load',function(store) { comboCalendar.store.on('load',function(store) {
comboCalendar.setValue(data.user.USR_CALENDAR); comboCalendar.setValue(data.user.USR_CALENDAR);
}); });
//for preferences on the configurations table //for preferences on the configurations table
comboDefaultMainMenuOption.store.on('load',function(store) { comboDefaultMainMenuOption.store.on('load',function(store) {
comboDefaultMainMenuOption.setValue(data.user.PREF_DEFAULT_MENUSELECTED); comboDefaultMainMenuOption.setValue(data.user.PREF_DEFAULT_MENUSELECTED);
@@ -1237,6 +1249,8 @@ function loadUserView()
//comboDefaultCasesMenuOption.setValue(''); //comboDefaultCasesMenuOption.setValue('');
comboDefaultCasesMenuOption.setValue(data.user.PREF_DEFAULT_CASES_MENUSELECTED); comboDefaultCasesMenuOption.setValue(data.user.PREF_DEFAULT_CASES_MENUSELECTED);
}); });
previousUsername = Ext.getCmp('USR_USERNAME').getValue();
}, },
failure:function(r,o) { failure:function(r,o) {
//viewport.getEl().unmask(); //viewport.getEl().unmask();