changeset 1234:390dabbf27ed

Empty string for media descriptor is disallowed. This follows server Rev 1ef08710aaeb.
author Tom Gottfried <tom@intevation.de>
date Fri, 28 Oct 2016 21:23:31 +0200
parents a1bbfddb77b9
children d1f43f1e7e84
files app/model/Messprogramm.js app/model/Probe.js app/view/form/Messprogramm.js app/view/form/Probe.js
diffstat 4 files changed, 24 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/app/model/Messprogramm.js	Fri Oct 28 20:04:20 2016 +0200
+++ b/app/model/Messprogramm.js	Fri Oct 28 21:23:31 2016 +0200
@@ -40,7 +40,13 @@
     }, {
         name: 'ortId'
     }, {
-        name: 'mediaDesk'
+        name: 'mediaDesk',
+        serialize: function(value) {
+            if (value === '') {
+                return null;
+            }
+            return value;
+        }
     }, {
         name: 'umwId',
         serialize: function(value) {
--- a/app/model/Probe.js	Fri Oct 28 20:04:20 2016 +0200
+++ b/app/model/Probe.js	Fri Oct 28 21:23:31 2016 +0200
@@ -37,7 +37,13 @@
     }, {
         name: 'probenartId'
     }, {
-        name: 'mediaDesk'
+        name: 'mediaDesk',
+        serialize: function(value) {
+            if (value === '') {
+                return null;
+            }
+            return value;
+        }
     }, {
         name: 'media'
     }, {
--- a/app/view/form/Messprogramm.js	Fri Oct 28 20:04:20 2016 +0200
+++ b/app/view/form/Messprogramm.js	Fri Oct 28 21:23:31 2016 +0200
@@ -560,8 +560,11 @@
     },
 
     setMediaDesk: function(record) {
-        var media = record.get('mediaDesk').split(' ');
-        this.setMediaSN(0, media);
+        var media = record.get('mediaDesk');
+        if (media) {
+            var mediaParts = media.split(' ');
+            this.setMediaSN(0, mediaParts);
+        }
     },
 
     setMediaSN: function(ndx, media, beschreibung) {
--- a/app/view/form/Probe.js	Fri Oct 28 20:04:20 2016 +0200
+++ b/app/view/form/Probe.js	Fri Oct 28 21:23:31 2016 +0200
@@ -410,8 +410,11 @@
     },
 
     setMediaDesk: function(record) {
-        var media = record.get('mediaDesk').split(' ');
-        this.setMediaSN(0, media);
+        var media = record.get('mediaDesk');
+        if (media) {
+            var mediaParts = media.split(' ');
+            this.setMediaSN(0, mediaParts);
+        }
     },
 
     setMediaSN: function(ndx, media) {

http://lada.wald.intevation.org