insert duplicity validation for departments, roles, groups and process categories

This commit is contained in:
Enrique Ponce de Leon
2011-02-24 16:44:18 +00:00
parent b6d32c9498
commit 3f0c7dfb1a
7 changed files with 1174 additions and 1095 deletions

View File

@@ -168,7 +168,7 @@ switch ($_POST['action'])
G::LoadClass('groups');
$newGroup['GRP_UID'] = '';
$newGroup['GRP_STATUS'] = G::toUpper($_POST['status']);
$newGroup['GRP_TITLE'] = $_POST['name'];
$newGroup['GRP_TITLE'] = trim($_POST['name']);
unset($newGroup['GRP_UID']);
$group = new Groupwf();
$group->create($newGroup);
@@ -178,7 +178,7 @@ switch ($_POST['action'])
G::LoadClass('groups');
$editGroup['GRP_UID'] = $_POST['grp_uid'];
$editGroup['GRP_STATUS'] = G::toUpper($_POST['status']);
$editGroup['GRP_TITLE'] = $_POST['name'];
$editGroup['GRP_TITLE'] = trim($_POST['name']);
$group = new Groupwf();
$group->update($editGroup);
echo '{success: true}';

View File

@@ -99,7 +99,7 @@ if(isset($_REQUEST['action'])) {
case 'saveNewCategory':
try{
require_once 'classes/model/ProcessCategory.php';
$catName = $_REQUEST['category'];
$catName = trim($_REQUEST['category']);
$pcat = new ProcessCategory();
$pcat->setNew(true);
$pcat->setCategoryUid(G::GenerateUniqueID());
@@ -129,7 +129,7 @@ if(isset($_REQUEST['action'])) {
try{
require_once 'classes/model/ProcessCategory.php';
$catUID = $_REQUEST['cat_uid'];
$catName = $_REQUEST['category'];
$catName = trim($_REQUEST['category']);
$pcat = new ProcessCategory();
$pcat->setNew(false);
$pcat->setCategoryUid($catUID);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -59,6 +59,7 @@ var searchButton;
var searchText;
var contextMenu;
var pageSize;
var w;
Ext.onReady(function(){
Ext.QuickTips.init();
@@ -200,7 +201,7 @@ Ext.onReady(function(){
{text: _('ID_CANCEL'), handler: CloseWindow}
]
});
store = new Ext.data.GroupingStore( {
proxy : new Ext.data.HttpProxy({
url: 'groups_Ajax?action=groupsList'
@@ -337,6 +338,7 @@ NewGroupWindow = function(){
title: _('ID_CREATE_GROUP_TITLE'),
closable: false,
modal: true,
id: 'w',
items: [newForm]
});
w.show();
@@ -355,7 +357,7 @@ DoSearch = function(){
//Close Popup Window
CloseWindow = function(){
w.hide();
Ext.getCmp('w').hide();
};
//Check Group Name Availability
@@ -379,6 +381,7 @@ CheckGroupName = function(grp_name, function_success, function_failure){
//Save Group Button
SaveNewGroupAction = function(){
var group = newForm.getForm().findField('name').getValue();
group = group.trim();
if (group != '') CheckGroupName(group, SaveNewGroup, DuplicateGroupName);
};
@@ -391,7 +394,7 @@ DuplicateGroupName = function(){
SaveNewGroup = function(){
newForm.getForm().submit({
success: function(f,a){
w.hide(); //Hide popup widow
CloseWindow(); //Hide popup widow
newForm.getForm().reset(); //Set empty form to next use
searchText.reset();
infoGrid.store.load(); //Reload store grid
@@ -421,6 +424,7 @@ EditGroupWindow = function(){
title: _('ID_EDIT_GROUP_TITLE'),
closable: false,
modal: true,
id: 'w',
items: [editForm]
});
w.show();
@@ -429,6 +433,7 @@ EditGroupWindow = function(){
//Save Edit Group Button
SaveEditGroupAction = function(){
var group = editForm.getForm().findField('name').getValue();
group = group.trim();
rowSelected = infoGrid.getSelectionModel().getSelected();
if (group != ''){
if (rowSelected.data.CON_VALUE.toUpperCase() == group.toUpperCase()){
@@ -443,7 +448,7 @@ SaveEditGroupAction = function(){
SaveEditGroup = function(){
editForm.getForm().submit({
success: function(f,a){
w.hide(); //Hide popup widow
CloseWindow(); //Hide popup widow
DoSearch(); //Reload store grid
editButton.disable(); //Disable Edit Button
deleteButton.disable(); //Disable Delete Button

View File

@@ -356,6 +356,8 @@ NewRoleWindow = function(){
w = new Ext.Window({
title: _('ID_CREATE_ROLE_TITLE'),
autoHeight: true,
id: 'w',
modal: true,
width: 420,
items: [newForm]
});
@@ -364,48 +366,93 @@ NewRoleWindow = function(){
//Close Popup Window
CloseWindow = function(){
w.hide();
Ext.getCmp('w').hide();
};
//Save New Role
SaveNewRole = function(){
newForm.getForm().submit({
success: function(f,a){
w.hide(); //Hide popup widow
newForm.getForm().reset(); //Set empty form to next use
searchText.reset();
infoGrid.store.load(); //Reload store grid
PMExt.notify(_('ID_ROLES'),_('ID_ROLES_SUCCESS_NEW'));
},
failure: function(f,a){
switch(a.failureType){
case Ext.form.Action.CLIENT_INVALID:
//Ext.Msg.alert('New Role Form','Invalid Data');
break;
}
}
});
rol_code = newForm.getForm().findField('code').getValue();
rol_code.trim();
if (rol_code == '') return;
viewport.getEl().mask(_('ID_PROCESSING'));
Ext.Ajax.request({
url: 'roles_Ajax',
params: {request: 'checkRoleCode', ROL_CODE: rol_code},
success: function(r,o){
viewport.getEl().unmask();
resp = Ext.util.JSON.decode(r.responseText);
if (resp.success){
viewport.getEl().mask(_('ID_PROCESSING'));
newForm.getForm().submit({
success: function(f,a){
viewport.getEl().unmask();
CloseWindow(); //Hide popup widow
newForm.getForm().reset(); //Set empty form to next use
searchText.reset();
infoGrid.store.load(); //Reload store grid
PMExt.notify(_('ID_ROLES'),_('ID_ROLES_SUCCESS_NEW'));
},
failure: function(f,a){
viewport.getEl().unmask();
switch(a.failureType){
case Ext.form.Action.CLIENT_INVALID:
//Ext.Msg.alert('New Role Form','Invalid Data');
break;
}
}
});
}else{
PMExt.error(_('ID_ROLES'),_('ID_ROLE_EXISTS'));
}
},
failure: function(r,o){
viewport.getEl().unmask();
}
});
};
//Update Selected Role
UpdateRole = function(){
editForm.getForm().submit({
success: function(f,a){
w.hide(); //Hide popup widow
DoSearch(); //Reload store grid
editButton.disable(); //Disable Edit Button
deleteButton.disable(); //Disable Delete Button
PMExt.notify(_('ID_ROLES'),_('ID_ROLES_SUCCESS_UPDATE'));
},
failure: function(f,a){
switch(a.failureType){
case Ext.form.Action.CLIENT_INVALID:
//Ext.Msg.alert('New Role Form','Invalid Data');
break;
}
}
});
rol_code = editForm.getForm().findField('code').getValue();
rol_code.trim();
if (rol_code == '') return;
viewport.getEl().mask(_('ID_PROCESSING'));
Ext.Ajax.request({
url: 'roles_Ajax',
params: {request: 'checkRoleCode', ROL_CODE: rol_code},
success: function(r,o){
viewport.getEl().unmask();
resp = Ext.util.JSON.decode(r.responseText);
if (resp.success){
viewport.getEl().mask(_('ID_PROCESSING'));
editForm.getForm().submit({
success: function(f,a){
viewport.getEl().unmask();
CloseWindow(); //Hide popup widow
DoSearch(); //Reload store grid
editButton.disable(); //Disable Edit Button
deleteButton.disable(); //Disable Delete Button
PMExt.notify(_('ID_ROLES'),_('ID_ROLES_SUCCESS_UPDATE'));
},
failure: function(f,a){
viewport.getEl().unmask();
switch(a.failureType){
case Ext.form.Action.CLIENT_INVALID:
//Ext.Msg.alert('New Role Form','Invalid Data');
break;
}
}
});
}else{
PMExt.error(_('ID_ROLES'),_('ID_ROLE_EXISTS'));
}
},
failure: function(r,o) {
viewport.getEl().unmask();
}
});
};
//Edit Selected Role
@@ -421,6 +468,8 @@ EditRole = function(){
editForm.getForm().findField('status').setValue(rowSelected.data.ROL_STATUS);
w = new Ext.Window({
autoHeight: true,
id: 'w',
modal: true,
width: 420,
title: _('ID_EDIT_ROLE_TITLE'),
items: [editForm]