BUG 9298 No se puede cambiar los roles de los usuarios en PM SOLVED
- The wrong was due a validate of User ID - was taken to validate of User ID for accept their own User ID.
This commit is contained in:
@@ -23,6 +23,7 @@ switch($_POST['action'])
|
||||
$c->add(IsoSubdivisionPeer::IC_UID, $country, Criteria::EQUAL);
|
||||
$locations = IsoSubdivisionPeer::doSelect($c);
|
||||
|
||||
$oData = Array();
|
||||
foreach( $locations as $rowid => $row ) {
|
||||
if (($row->getISUid() != '') && ($row->getISName() != ''))
|
||||
$oData[] = Array('IS_UID' => $row->getISUid(), 'IS_NAME' => $row->getISName());
|
||||
@@ -39,6 +40,7 @@ switch($_POST['action'])
|
||||
$c->add(IsoLocationPeer::IS_UID, $state, Criteria::EQUAL);
|
||||
$locations = IsoLocationPeer::doSelect($c);
|
||||
|
||||
$oData = Array();
|
||||
foreach ( $locations as $rowid => $row ) {
|
||||
if (($row->getILUid() != '') && ($row->getILName() != ''))
|
||||
$oData[] = Array('IL_UID' => $row->getILUid(), 'IL_NAME' => $row->getILName());
|
||||
@@ -567,12 +569,17 @@ switch($_POST['action'])
|
||||
case 'testUsername';
|
||||
require_once 'classes/model/Users.php';
|
||||
$_POST['NEW_USERNAME'] = trim($_POST['NEW_USERNAME']);
|
||||
$USR_UID = isset($_POST['USR_UID'])? $_POST['USR_UID'] : '';
|
||||
|
||||
$response = array( "success" => true );
|
||||
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
|
||||
|
||||
$oCriteria->add(UsersPeer::USR_USERNAME, $_POST['NEW_USERNAME']);
|
||||
if ($USR_UID != '') {
|
||||
$oCriteria->add(UsersPeer::USR_UID, array($_POST['USR_UID']), Criteria::NOT_IN);
|
||||
}
|
||||
$oDataset = UsersPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
@@ -584,12 +591,12 @@ switch($_POST['action'])
|
||||
$dataVar['USER_ID'] = $_POST['NEW_USERNAME'];
|
||||
$text = G::LoadTranslation('ID_USERNAME_ALREADY_EXISTS', $dataVar);
|
||||
$text = ($_POST['NEW_USERNAME'] == '') ? G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME') : $text;
|
||||
$response['exists'] = true;
|
||||
$response['exists'] = true;
|
||||
} else {
|
||||
$color = 'green';
|
||||
$img = '/images/dialog-ok-apply.png';
|
||||
$text = G::LoadTranslation('ID_USERNAME_CORRECT');
|
||||
$response['exists'] = false;
|
||||
$response['exists'] = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ var box;
|
||||
var infoMode;
|
||||
var global = {};
|
||||
var readMode;
|
||||
var usernameText;
|
||||
var canEdit = true;
|
||||
var flagPoliciesPassword = false;
|
||||
var flagValidateUsername = false;
|
||||
@@ -416,40 +417,9 @@ Ext.onReady(function() {
|
||||
Ext.getCmp('usernameReview').setText(spanAjax + imageAjax + labelAjax + '</span>', false);
|
||||
Ext.getCmp('usernameReview').setVisible(true);
|
||||
|
||||
var usernameText = this.getValue();
|
||||
usernameText = this.getValue();
|
||||
|
||||
Ext.Ajax.request({
|
||||
url : 'usersAjax',
|
||||
method : 'POST',
|
||||
params : {
|
||||
'action' : 'testUsername',
|
||||
'NEW_USERNAME' : usernameText
|
||||
},
|
||||
success: function(r,o){
|
||||
var resp = Ext.util.JSON.decode(r.responseText);
|
||||
|
||||
if (resp.exists) {
|
||||
flagValidateUsername = false;
|
||||
} else {
|
||||
flagValidateUsername = true;
|
||||
}
|
||||
|
||||
Ext.getCmp('usernameReview').setText(resp.descriptionText, false);
|
||||
Ext.getCmp('saveB').enable();
|
||||
Ext.getCmp('cancelB').enable();
|
||||
},
|
||||
failure: function () {
|
||||
Ext.MessageBox.show({
|
||||
title: 'Error',
|
||||
msg: 'Failed to store data',
|
||||
buttons: Ext.MessageBox.OK,
|
||||
animEl: 'mb9',
|
||||
icon: Ext.MessageBox.ERROR
|
||||
});
|
||||
Ext.getCmp('saveB').enable();
|
||||
Ext.getCmp('cancelB').enable();
|
||||
}
|
||||
});
|
||||
validateUserName();
|
||||
|
||||
Ext.getCmp('usernameReview').setVisible(true);
|
||||
}
|
||||
@@ -982,9 +952,49 @@ function editUser()
|
||||
frmSumary.hide();
|
||||
frmDetails.show();
|
||||
}
|
||||
|
||||
function validateUserName() {
|
||||
Ext.Ajax.request({
|
||||
url : 'usersAjax',
|
||||
method : 'POST',
|
||||
params : {
|
||||
'action' : 'testUsername',
|
||||
'USR_UID' : USR_UID,
|
||||
'NEW_USERNAME' : usernameText
|
||||
},
|
||||
success: function(r,o){
|
||||
var resp = Ext.util.JSON.decode(r.responseText);
|
||||
|
||||
if (resp.exists) {
|
||||
flagValidateUsername = false;
|
||||
Ext.getCmp('saveB').disable();
|
||||
usernameText = '';
|
||||
} else {
|
||||
flagValidateUsername = true;
|
||||
}
|
||||
|
||||
Ext.getCmp('usernameReview').setText(resp.descriptionText, false);
|
||||
Ext.getCmp('saveB').enable();
|
||||
Ext.getCmp('cancelB').enable();
|
||||
},
|
||||
failure: function () {
|
||||
Ext.MessageBox.show({
|
||||
title: 'Error',
|
||||
msg: 'Failed to store data',
|
||||
buttons: Ext.MessageBox.OK,
|
||||
animEl: 'mb9',
|
||||
icon: Ext.MessageBox.ERROR
|
||||
});
|
||||
Ext.getCmp('saveB').enable();
|
||||
Ext.getCmp('cancelB').enable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveUser()
|
||||
{
|
||||
if (flagValidateUsername != true) {
|
||||
validateUserName();
|
||||
if ( Ext.getCmp('USR_USERNAME').getValue() == '') {
|
||||
Ext.Msg.alert( _('ID_ERROR'), _('ID_MSG_ERROR_USR_USERNAME'));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user