HOR-3281
This commit is contained in:
@@ -129,15 +129,20 @@ switch ($_POST['action']) {
|
|||||||
echo G::json_encode( $result );
|
echo G::json_encode( $result );
|
||||||
break;
|
break;
|
||||||
case 'exitsGroupName':
|
case 'exitsGroupName':
|
||||||
require_once 'classes/model/Groupwf.php';
|
$groupName = strip_tags($_POST['GRP_NAME']);
|
||||||
G::LoadClass( 'Groupswf' );
|
if ($groupName) {
|
||||||
$oGroup = new Groupwf();
|
require_once 'classes/model/Groupwf.php';
|
||||||
$oCriteria = $oGroup->loadByGroupname( $_POST['GRP_NAME'] );
|
G::LoadClass('Groupswf');
|
||||||
$oDataset = GroupwfPeer::doSelectRS( $oCriteria );
|
$oGroup = new Groupwf();
|
||||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$oCriteria = $oGroup->loadByGroupname($_POST['GRP_NAME']);
|
||||||
$oDataset->next();
|
$oDataset = GroupwfPeer::doSelectRS($oCriteria);
|
||||||
$aRow = $oDataset->getRow();
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$response = ($aRow) ? 'true' : 'false';
|
$oDataset->next();
|
||||||
|
$aRow = $oDataset->getRow();
|
||||||
|
$response = ($aRow) ? \G::json_encode(['success' => true]) : \G::json_decode(['success' => false]);
|
||||||
|
} else {
|
||||||
|
$response = \G::json_encode(['success' => true, 'msg' => \G::LoadTranslation('ID_FIELD_INVALID')]);
|
||||||
|
}
|
||||||
echo $response;
|
echo $response;
|
||||||
break;
|
break;
|
||||||
case 'saveNewGroup':
|
case 'saveNewGroup':
|
||||||
|
|||||||
@@ -182,7 +182,13 @@ Ext.onReady(function(){
|
|||||||
text: _("ID_SAVE"),
|
text: _("ID_SAVE"),
|
||||||
handler: function (btn, ev)
|
handler: function (btn, ev)
|
||||||
{
|
{
|
||||||
if( newForm.getForm().findField('name').getValue().trim() == "") {
|
var reg = new RegExp(/(<([^>]+)>)/ig),
|
||||||
|
nameGroups = newForm.getForm().findField('name').getValue();
|
||||||
|
if (reg.test(nameGroups)){
|
||||||
|
Ext.Msg.alert(_('ID_WARNING'), _("ID_FIELD_INVALID", _("ID_GROUP_NAME")));
|
||||||
|
newForm.getForm().findField('name').setValue("");
|
||||||
|
return false;
|
||||||
|
} else if (nameGroups.trim() == "") {
|
||||||
Ext.Msg.alert(_('ID_WARNING'), _("ID_FIELD_REQUIRED", _("ID_GROUP_NAME")));
|
Ext.Msg.alert(_('ID_WARNING'), _("ID_FIELD_REQUIRED", _("ID_GROUP_NAME")));
|
||||||
newForm.getForm().findField('name').setValue("");
|
newForm.getForm().findField('name').setValue("");
|
||||||
return false;
|
return false;
|
||||||
@@ -434,8 +440,8 @@ CheckGroupName = function(grp_name, function_success, function_failure){
|
|||||||
params: {action: 'exitsGroupName', GRP_NAME: grp_name},
|
params: {action: 'exitsGroupName', GRP_NAME: grp_name},
|
||||||
success: function(resp, opt){
|
success: function(resp, opt){
|
||||||
viewport.getEl().unmask();
|
viewport.getEl().unmask();
|
||||||
var checked = eval(resp.responseText);
|
var response = JSON.parse(resp.responseText);
|
||||||
(!checked) ? function_success() : function_failure();
|
(!response.success) ? function_success() : function_failure(response.msg);
|
||||||
},
|
},
|
||||||
failure: function(r,o) {
|
failure: function(r,o) {
|
||||||
viewport.getEl().unmask();
|
viewport.getEl().unmask();
|
||||||
@@ -452,11 +458,11 @@ SaveNewGroupAction = function(){
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Show Duplicate Group Name Message
|
//Show Duplicate Group Name Message
|
||||||
DuplicateGroupName = function(){
|
DuplicateGroupName = function (msg) {
|
||||||
Ext.getCmp("btnCreateSave").setDisabled(false);
|
Ext.getCmp("btnCreateSave").setDisabled(false);
|
||||||
Ext.getCmp("btnUpdateSave").setDisabled(false);
|
Ext.getCmp("btnUpdateSave").setDisabled(false);
|
||||||
|
newForm.getForm().findField('name').setValue("");
|
||||||
PMExt.warning(_('ID_GROUPS'), _('ID_MSG_GROUP_NAME_EXISTS'));
|
PMExt.warning(_('ID_GROUPS'), msg ? msg : _('ID_MSG_GROUP_NAME_EXISTS'));
|
||||||
};
|
};
|
||||||
|
|
||||||
//Save New Group
|
//Save New Group
|
||||||
|
|||||||
Reference in New Issue
Block a user