[Lada-commits] [PATCH] fix mediadescription in probe form

Wald Commits scm-commit at wald.intevation.org
Wed Jan 11 16:32:56 CET 2017


# HG changeset patch
# User Michael Stanko <mstanko at bfs.de>
# Date 1484148771 -3600
# Node ID 8f37f8832c4ab3d7cf444f9c01049b01b5ee233f
# Parent  1df7a0899ebee2482ec1fc46fdd21b7a714952d5
fix mediadescription in probe form

diff -r 1df7a0899ebe -r 8f37f8832c4a app/controller/form/Messprogramm.js
--- a/app/controller/form/Messprogramm.js	Tue Jan 10 10:05:00 2017 +0100
+++ b/app/controller/form/Messprogramm.js	Wed Jan 11 16:32:51 2017 +0100
@@ -318,7 +318,6 @@
         }
     },
 
-
     deskriptorSelect: function(field, records) {
         var desk = field.up('deskriptor');
         var media = field.up('messprogrammform').down('textfield[name="mediaDesk"]');
@@ -366,36 +365,34 @@
         }
         media.setValue(current.join(' ').trim());
 
-		if (current[0].length == 0) {
-			current.splice(0,1);
-		}
-		var mediatext = field.up('messprogrammform').down('textfield[name="media"]');
-		
-		if ( (desk.layer === 0 ) && (records[0].get('sn') === 0) ){
-				mediatext.setValue('');
-		} else {
-				if ( current[1] === '01') { 
-					if ( (current[5] !== '00') && (desk.layer === 4 ) ){
-						//mediatext.setValue(records[0].data.beschreibung);
-					} else 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);
-					} 
-				}
+        if (current[0].length == 0) {
+            current.splice(0,1);
+        }
+        var mediatext = field.up('messprogrammform').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) {
diff -r 1df7a0899ebe -r 8f37f8832c4a app/controller/form/Probe.js
--- a/app/controller/form/Probe.js	Tue Jan 10 10:05:00 2017 +0100
+++ b/app/controller/form/Probe.js	Wed Jan 11 16:32:51 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) {
diff -r 1df7a0899ebe -r 8f37f8832c4a app/view/form/Messprogramm.js
--- a/app/view/form/Messprogramm.js	Tue Jan 10 10:05:00 2017 +0100
+++ b/app/view/form/Messprogramm.js	Wed Jan 11 16:32:51 2017 +0100
@@ -538,20 +538,21 @@
                 laborMstId = '';
             }
             var id = this.down('messstellelabor').store.count() + 1;
-			if ( messRecord.get('mstId') === messRecord.get('laborMstId') ) {
-				displayCombi = mstId.get('messStelle');
-			} else {
-				displayCombi = mstId.get('messStelle') + '/' + laborMstId
-			}
-			var newStore = Ext.create('Ext.data.Store', {
-				model: 'Lada.model.MessstelleLabor',
-				data: [{
-					id: id,
-					laborMst: messRecord.get('laborMstId'),
-					messStelle: messRecord.get('mstId'),
-					displayCombi: displayCombi
-				}]
-			});
+            if ( messRecord.get('mstId') === messRecord.get('laborMstId') ) {
+                displayCombi = mstId.get('messStelle');
+            } else {
+                displayCombi = mstId.get('messStelle') + '/' + laborMstId
+
+            }
+            var newStore = Ext.create('Ext.data.Store', {
+                model: 'Lada.model.MessstelleLabor',
+                data: [{
+                    id: id,
+                    laborMst: messRecord.get('laborMstId'),
+                    messStelle: messRecord.get('mstId'),
+                    displayCombi: displayCombi
+                }]
+            });
             this.down('messstellelabor').down('combobox').store = newStore;
             this.down('messstellelabor').setValue(id);
         }
@@ -578,9 +579,8 @@
 
     setMediaSN: function(ndx, media, beschreibung) {
         var mediabeschreibung = this.getForm().findField('media');
-		
         if (ndx >= 12) {
-			mediabeschreibung.setValue(beschreibung);
+            mediabeschreibung.setValue(beschreibung);
             return;
         }
         var me = this;
@@ -606,14 +606,14 @@
                 return;
             }
             cbox.select(cbox.store.findRecord('sn', parseInt(media[ndx + 1], 10)));
-			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;
-				}
-			}
+            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);
         });
     },
diff -r 1df7a0899ebe -r 8f37f8832c4a app/view/form/Probe.js
--- 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);
         });
     },
 


More information about the Lada-commits mailing list