changeset 1341:2e8eba3918b1

OrtszuordnungMp fix
author Maximilian Krambach <mkrambach@intevation.de>
date Fri, 03 Feb 2017 21:43:52 +0100
parents 15e4a3e42ad7
children d5e270fa91e4
files app/controller/form/Ortszuordnung.js app/model/OrtszuordnungMp.js app/view/form/Ortszuordnung.js
diffstat 3 files changed, 6 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/form/Ortszuordnung.js	Fri Feb 03 20:35:53 2017 +0100
+++ b/app/controller/form/Ortszuordnung.js	Fri Feb 03 21:43:52 2017 +0100
@@ -112,7 +112,7 @@
         var recordData = form.getForm().getRecord().data;
         var currentOrt = null;
         if (recordData.ortId !== undefined) {
-            currentOrt = recordData.ortId;
+            currentOrt = recordData.ortId[0];
         } else {
             currentOrt = recordData.ort;
         }
@@ -191,25 +191,16 @@
      */
     validityChange: function(form, valid) {
         if (form.isDirty()) {
-            if (valid) {
-                if (form.getValues().ortId !== ''
-                    && /[UEZA]/.test(form.getValues().ortszuordnungTyp)) {
-                    // valid ortzuordnung(Probe)
-                    form.owner.down('button[action=save]').setDisabled(false);
-                } else if (form.getValues().ort !== ''
-                    && /[UEZA]/.test(form.getValues().ortsTyp)) {
-                    // valid ortzuordnung(messprogramm)
-                    form.owner.down('button[action=save]').setDisabled(false);
-                } else {
-                    form.owner.down('button[action=save]').setDisabled(true);
-                }
+            form.owner.down('button[action=revert]').setDisabled(false);
+            if (valid && form.getValues().ortId !== '') {
+                form.owner.down('button[action=save]').setDisabled(false);
             } else {
-                //invalid
                 form.owner.down('button[action=save]').setDisabled(true);
             }
         } else {
             //not dirty
             form.owner.down('button[action=save]').setDisabled(true);
+            form.owner.down('button[action=revert]').setDisabled(true);
         }
     }
 });
--- a/app/model/OrtszuordnungMp.js	Fri Feb 03 20:35:53 2017 +0100
+++ b/app/model/OrtszuordnungMp.js	Fri Feb 03 21:43:52 2017 +0100
@@ -43,14 +43,6 @@
             }
             return value;
         }
-    }, {
-        name: 'parentModified',
-        serialize: function(value) {
-            if (value === '') {
-                return null;
-            }
-            return value;
-        }
     }],
 
     idProperty: 'id',
--- a/app/view/form/Ortszuordnung.js	Fri Feb 03 20:35:53 2017 +0100
+++ b/app/view/form/Ortszuordnung.js	Fri Feb 03 21:43:52 2017 +0100
@@ -143,11 +143,7 @@
     setOrt: function(row, selRecord, index, opts) {
         var newOrtId = selRecord.get('id');
         if (newOrtId) {
-            if (this.type == 'probe') {
-                this.getForm().setValues({ortId: newOrtId});
-            } else {
-                this.getForm().setValues({ort: newOrtId});
-            }
+            this.getForm().setValues({ortId: newOrtId});
             this.setOrtInfo(selRecord);
         }
     },

http://lada.wald.intevation.org