diff app/controller/form/Probe.js @ 1278:cb9609380056

merge
author Michael Stanko <mstanko@bfs.de>
date Mon, 16 Jan 2017 14:53:00 +0100
parents 8f37f8832c4a
children 8012e5212bd5
line wrap: on
line diff
--- a/app/controller/form/Probe.js	Mon Jan 16 14:32:41 2017 +0100
+++ b/app/controller/form/Probe.js	Mon Jan 16 14:53:00 2017 +0100
@@ -230,8 +230,8 @@
         var desk = field.up('deskriptor');
         var media = field.up('probeform').down('textfield[name="mediaDesk"]');
         var current = media.getValue().split(' ');
-
         if (current.length < 12) {
+            var value;
             for (var i = 0; i < 12; i++) {
                 if (i === 0) {
                     current.push('D:');
@@ -272,6 +272,35 @@
             }
         }
         media.setValue(current.join(' ').trim());
+
+        if (current[0].length == 0) {
+            current.splice(0,1);
+        }
+        var mediatext = field.up('probeform').down('textfield[name="media"]');
+
+        if ( (desk.layer === 0 ) && (records[0].get('sn') === 0) ){
+            mediatext.setValue('');
+        } else {
+            if ( current[1] === '01') { 
+                if ( (current[4] !== '00') && (desk.layer === 3) ) {
+                    mediatext.setValue(records[0].data.beschreibung);
+                } else if ( (current[3] !== '00') && (desk.layer === 2) ) {
+                    mediatext.setValue(records[0].data.beschreibung);
+                } else if ( (current[2] !== '00') && (desk.layer === 1) ) {
+                    mediatext.setValue(records[0].data.beschreibung);
+                } else if ( (current[1] !== '00') && (desk.layer === 0 )) {
+                    mediatext.setValue(records[0].data.beschreibung);
+                } 
+            }
+
+            if ( current[1] !== '01') { 
+                if ((current[2] !== '00') && (desk.layer === 1 )) {
+                    mediatext.setValue(records[0].data.beschreibung);
+                } else if ((current[1] !== '00') && (desk.layer === 0 )) {
+                    mediatext.setValue(records[0].data.beschreibung);
+                } 
+            }
+        }
     },
 
     clearChildDesk: function(field) {

http://lada.wald.intevation.org