[Lada-commits] [PATCH] Fix checks for not given foreign keys

Wald Commits scm-commit at wald.intevation.org
Tue Feb 7 14:55:41 CET 2017


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1486475734 -3600
# Node ID 036c594de978854c5d63dadaae00f5b3c3a32c9f
# Parent  ba106500af0b3d0ba61513642b3398cf899a844a
Fix checks for not given foreign keys.

diff -r ba106500af0b -r 036c594de978 app/view/grid/Ortszuordnung.js
--- 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');


More information about the Lada-commits mailing list