changeset 1235:d1f43f1e7e84

Fix setting Netzbetreiber in Messprogramm.
author Tom Gottfried <tom@intevation.de>
date Mon, 31 Oct 2016 10:05:10 +0100
parents 390dabbf27ed
children cfc24d2ae268
files app/model/Messprogramm.js app/view/form/Messprogramm.js app/view/form/Probe.js
diffstat 3 files changed, 8 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/app/model/Messprogramm.js	Fri Oct 28 21:23:31 2016 +0200
+++ b/app/model/Messprogramm.js	Mon Oct 31 10:05:10 2016 +0100
@@ -19,15 +19,6 @@
         name: 'test',
         type: 'boolean'
     }, {
-        name: 'netzbetreiberId',
-        serialize: function(value) {
-            if (value === '') {
-                return null;
-            }
-            return value;
-        },
-        persist: false
-    }, {
         name: 'mstId'
     }, {
         name: 'laborMstId'
--- a/app/view/form/Messprogramm.js	Fri Oct 28 21:23:31 2016 +0200
+++ b/app/view/form/Messprogramm.js	Mon Oct 31 10:05:10 2016 +0100
@@ -134,13 +134,14 @@
                                 }
                             }, {
                                 xtype: 'netzbetreiber',
-                                name: 'netzbetreiberId',
                                 editable: false,
                                 readOnly: true,
+                                isFormField: false,
+                                submitValue: false,
                                 fieldLabel: i18n.getMsg('netzbetreiberId'),
                                 margin : '0, 5, 5, 5',
                                 width : '35%',
-                                labelWidth: 80,
+                                labelWidth: 80
                             }, {
                                 xtype: 'datenbasis',
                                 editable: false,
@@ -517,8 +518,8 @@
                 .synchronizeFields
         );
         var mstStore = Ext.data.StoreManager.get('messstellen');
+        var mstId = mstStore.getById(messRecord.get('mstId'));
         if (!messRecord.get('owner')) {
-            var mstId = mstStore.getById(messRecord.get('mstId'));
             if (!mstId) {
                 return;
             }
@@ -557,6 +558,7 @@
             });
             this.down('messstellelabor').setValue(items.getAt(0));
         }
+        this.down('netzbetreiber').setValue(mstId.get('netzbetreiberId'));
     },
 
     setMediaDesk: function(record) {
@@ -653,7 +655,7 @@
         this.down('cbox[name=baId]').clearWarningOrError();
         this.down('chkbox[name=test]').clearWarningOrError();
         this.down('cbox[name=probenartId]').clearWarningOrError();
-        this.down('cbox[name=netzbetreiberId]').clearWarningOrError();
+        this.down('netzbetreiber').clearWarningOrError();
         // clear messages in intervall definition
         this.down('fset[name=probenIntervallFieldset]').clearMessages();
         this.down('cbox[name=probenintervall]').clearWarningOrError();
--- a/app/view/form/Probe.js	Fri Oct 28 21:23:31 2016 +0200
+++ b/app/view/form/Probe.js	Mon Oct 31 10:05:10 2016 +0100
@@ -135,11 +135,10 @@
                                 readOnly: true,
                                 isFormField: false,
                                 submitValue: false,
-                                fieldLabel: 'Netzbetreiber',
+                                fieldLabel: i18n.getMsg('netzbetreiberId'),
                                 margin: '0, 5, 5, 5',
                                 width: '35%',
-                                labelWidth: 80,
-                                allowBlank: false
+                                labelWidth: 80
                             }, {
                                 xtype: 'datenbasis',
                                 editable: false,

http://lada.wald.intevation.org