diff app/view/form/Probe.js @ 1276:8f37f8832c4a

fix mediadescription in probe form
author Michael Stanko <mstanko@bfs.de>
date Wed, 11 Jan 2017 16:32:51 +0100
parents 03826fba90bb
children 197ba385bc31
line wrap: on
line diff
--- a/app/view/form/Probe.js	Tue Jan 10 10:05:00 2017 +0100
+++ b/app/view/form/Probe.js	Wed Jan 11 16:32:51 2017 +0100
@@ -416,8 +416,9 @@
         }
     },
 
-    setMediaSN: function(ndx, media) {
+    setMediaSN: function(ndx, media, beschreibung) {
         if (ndx >= 12) {
+            mediabeschreibung.setValue(beschreibung);
             return;
         }
         var me = this;
@@ -443,7 +444,15 @@
                 return;
             }
             cbox.select(cbox.store.findRecord('sn', parseInt(media[ndx + 1], 10)));
-            me.setMediaSN(++ndx, media);
+            var mediatext = cbox.store.findRecord('sn', parseInt(media[ndx + 1], 10));
+            if (mediatext !== null) {
+                if ( (ndx <= 3) && (media[1] === '01') && (mediatext.data.beschreibung !== "leer") ) {
+                    beschreibung = mediatext.data.beschreibung;
+                } else if ( (media[1] !== '01') && (mediatext.data.beschreibung !== "leer") && (ndx <= 1) ) {
+                    beschreibung = mediatext.data.beschreibung;
+                }
+            }
+            me.setMediaSN(++ndx, media, beschreibung);
         });
     },
 

http://lada.wald.intevation.org