diff --git a/admin/inc/class.customfields.inc.php b/admin/inc/class.customfields.inc.php index 17125a18d8..b156d89504 100644 --- a/admin/inc/class.customfields.inc.php +++ b/admin/inc/class.customfields.inc.php @@ -300,11 +300,17 @@ class customfields { case 'delete': $this->so->delete($cf_id); - egw_framework::refresh_opener('Saved', 'admin', $cf_id /* Conflicts with accounts 'delete'*/); + egw_framework::refresh_opener('Deleted', 'admin', $cf_id /* Conflicts with accounts 'delete'*/); egw_framework::window_close(); break; case 'save': case 'apply': + if(!$cf_id && $this->fields[$content['cf_name']]) + { + egw_framework::message(lang("Field '%1' already exists !!!",$content['cf_name']),'error'); + $content['cf_name'] = ''; + break; + } if(empty($content['cf_label'])) { $content['cf_label'] = $content['cf_name']; @@ -370,6 +376,10 @@ class customfields { $content['cf_private'] = explode(',',$content['cf_private']); } + if($content['cf_name']) + { + $readonlys['cf_name'] = true; + } } $content['cf_values'] = json_decode($content['cf_values'], true); if (is_array($content['cf_values'])) @@ -421,6 +431,7 @@ class customfields $this->tmpl->exec('admin.customfields.edit',$content,$sel_options,$readonlys,array( 'cf_id' => $cf_id, 'cf_app' => $this->appname, + 'cf_name' => $content['cf_name'], 'use_private' => $this->use_private, ),2); } diff --git a/admin/js/app.js b/admin/js/app.js index 170febc4d2..3d95fbd657 100644 --- a/admin/js/app.js +++ b/admin/js/app.js @@ -797,7 +797,7 @@ app.classes.admin = AppJS.extend( cf_type_change: function(e,widget) { var root = widget.getRoot(); var attributes = widget.getArrayMgr('content').getEntry('attributes['+widget.getValue()+']')||{}; - root.getWidgetById('cf_values').set_statustext(widget.egw().lang(widget.getArrayMgr('content').getEntry('options['+widget.getValue()+']'))||''); + root.getWidgetById('cf_values').set_statustext(widget.egw().lang(widget.getArrayMgr('content').getEntry('options['+widget.getValue()+']')||'')); root.getWidgetById('cf_len').set_disabled(!attributes.cf_len); root.getWidgetById('cf_rows').set_disabled(!attributes.cf_rows); root.getWidgetById('cf_values').set_disabled(!attributes.cf_values); diff --git a/admin/templates/default/customfield_edit.xet b/admin/templates/default/customfield_edit.xet index d1fa8f654a..50db45e0c7 100644 --- a/admin/templates/default/customfield_edit.xet +++ b/admin/templates/default/customfield_edit.xet @@ -61,7 +61,7 @@