[Lada-commits] [PATCH] OrtszuordnungMp fix

Wald Commits scm-commit at wald.intevation.org
Fri Feb 3 21:43:55 CET 2017


# HG changeset patch
# User Maximilian Krambach <mkrambach at intevation.de>
# Date 1486154632 -3600
# Node ID 2e8eba3918b100465e405fdf5ca350979b0d19b3
# Parent  15e4a3e42ad79d35fbdc758466ed78628ebe0cb5
OrtszuordnungMp fix

diff -r 15e4a3e42ad7 -r 2e8eba3918b1 app/controller/form/Ortszuordnung.js
--- 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);
         }
     }
 });
diff -r 15e4a3e42ad7 -r 2e8eba3918b1 app/model/OrtszuordnungMp.js
--- 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',
diff -r 15e4a3e42ad7 -r 2e8eba3918b1 app/view/form/Ortszuordnung.js
--- 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);
         }
     },


More information about the Lada-commits mailing list