[Lada-commits] [PATCH 3 of 3] Empty string for media descriptor is disallowed

Wald Commits scm-commit at wald.intevation.org
Fri Oct 28 21:24:16 CEST 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1477682611 -7200
# Node ID 390dabbf27ed54b8c88c37a5e758f1a707cb115d
# Parent  a1bbfddb77b9ac45f0e86e6cb52a8b41630849ff
Empty string for media descriptor is disallowed.

This follows server Rev 1ef08710aaeb.

diff -r a1bbfddb77b9 -r 390dabbf27ed app/model/Messprogramm.js
--- 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) {
diff -r a1bbfddb77b9 -r 390dabbf27ed app/model/Probe.js
--- 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'
     }, {
diff -r a1bbfddb77b9 -r 390dabbf27ed app/view/form/Messprogramm.js
--- 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) {
diff -r a1bbfddb77b9 -r 390dabbf27ed app/view/form/Probe.js
--- 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) {


More information about the Lada-commits mailing list