diff app/view/grid/Ortszuordnung.js @ 1351:036c594de978

Fix checks for not given foreign keys.
author Tom Gottfried <tom@intevation.de>
date Tue, 07 Feb 2017 14:55:34 +0100
parents c05a5534f0d9
children 76ff6d084167
line wrap: on
line diff
--- a/app/view/grid/Ortszuordnung.js	Tue Feb 07 14:45:11 2017 +0100
+++ b/app/view/grid/Ortszuordnung.js	Tue Feb 07 14:55:34 2017 +0100
@@ -105,10 +105,14 @@
                 var store = Ext.data.StoreManager.get('orte');
                 var staaten = Ext.data.StoreManager.get('staaten');
                 var ortRecord = store.getById(value);
-                if (!ortRecord || ortRecord.get('staatId') === '') {
+                if (!ortRecord) {
                     return '';
                 }
-                var record = staaten.getById(ortRecord.get('staatId'));
+                var stId = ortRecord.get('staatId');
+                if (stId == undefined || stId == null || stId === '') {
+                    return '';
+                }
+                var record = staaten.getById(stId);
                 return record.get('staatIso');
             }
         }, {
@@ -132,10 +136,13 @@
                 var gemeinden =
                     Ext.data.StoreManager.get('verwaltungseinheiten');
                 var record = store.getById(value);
-                if (!record || record.get('gemId') === '') {
+                if (!record) {
                     return '';
                 }
                 var gemid = record.get('gemId');
+                if (gemid == undefined || gemid == null || gemid === '') {
+                    return '';
+                }
                 var record2 = gemeinden.getById(gemid);
                 return record2.get('bezeichnung');
             }
@@ -146,7 +153,11 @@
             renderer: function(value) {
                 var store = Ext.data.StoreManager.get('orte');
                 var record = store.getById(value);
-                if (!record || !record.get('anlageId')) {
+                if (!record) {
+                    return '';
+                }
+                var ktaId = record.get('anlageId');
+                if (ktaId == undefined || ktaId == null || ktaId === '') {
                     return '';
                 }
                 var ktas = Ext.data.StoreManager.get('ktas');

http://lada.wald.intevation.org