[Lada-commits] [PATCH] insert and preset OrtId field on Orterstellung

Wald Commits scm-commit at wald.intevation.org
Thu Feb 2 16:59:28 CET 2017


# HG changeset patch
# User Maximilian Krambach <mkrambach at intevation.de>
# Date 1486051165 -3600
# Node ID 1bcc3a62e9095010c40d07aed84bcd698c7de3d6
# Parent  6075731bc4f1b5da1d69ba0d5a4e2eb9c3a8b9d3
insert and preset OrtId field on Orterstellung

diff -r 6075731bc4f1 -r 1bcc3a62e909 app/controller/grid/Ortszuordnung.js
--- a/app/controller/grid/Ortszuordnung.js	Thu Feb 02 16:43:53 2017 +0100
+++ b/app/controller/grid/Ortszuordnung.js	Thu Feb 02 16:59:25 2017 +0100
@@ -171,8 +171,10 @@
     cloneort: function(button) {
         var grid = button.up('ortszuordnungwindow').down('ortstammdatengrid').getView();
         var selected = grid.getSelectionModel().getSelection()[0];
-         Ext.create('Lada.view.window.Ortserstellung', {
-             record: Ext.create('Lada.model.Ort', selected.data),
+        var newRecord = Ext.create('Lada.model.Ort', selected.data);
+        newRecord.set('ortId', '');
+        Ext.create('Lada.view.window.Ortserstellung', {
+             record: newRecord,
              parentWindow: button.up('ortszuordnungwindow')
         }).show();
     },
@@ -252,7 +254,8 @@
                     item.get('berichtstext').indexOf(filter) > -1) {
                     return true;
                 }
-                if (item.get('gemId').indexOf(filter) > -1) {
+                if (item.get('gemId') &&
+                    item.get('gemId').indexOf(filter) > -1) {
                     return true;
                 }
             }});
@@ -289,7 +292,11 @@
         this.searchField.reset();
         Ext.create('Lada.view.window.Ortserstellung', {
             record: Ext.create('Lada.model.Ort', {
-                gemId: record.get('id')
+                gemId: record.get('id'),
+                ortId: record.get('id'),
+                kurztext: record.get('bezeichnung'),
+                langtext: record.get('bezeichnung'),
+                berichtstext: record.get('bezeichnung')
             }),
             parentWindow: panel
         }).show();
@@ -301,7 +308,11 @@
         this.searchField.reset();
         Ext.create('Lada.view.window.Ortserstellung', {
             record: Ext.create('Lada.model.Ort', {
-                staatId: record.get('id')
+                staatId: record.get('id'),
+                ortId: 'Staat_' + record.get('staatIso'),
+                kurztext: record.get('staat'),
+                langtext: record.get('staat'),
+                berichtstext: record.get('staat')
             }),
             parentWindow: win
         }).show();
diff -r 6075731bc4f1 -r 1bcc3a62e909 app/model/Ort.js
--- a/app/model/Ort.js	Thu Feb 02 16:43:53 2017 +0100
+++ b/app/model/Ort.js	Thu Feb 02 16:59:25 2017 +0100
@@ -17,7 +17,13 @@
     }, {
         name: 'aktiv'
     }, {
-        name: 'ortId'
+        name: 'ortId',
+        convert: function(v) {
+            if (v === '') {
+                return null;
+            }
+            return v;
+        }
     }, {
         name: 'nutsCode'
     }, {
diff -r 6075731bc4f1 -r 1bcc3a62e909 app/view/form/Ortserstellung.js
--- a/app/view/form/Ortserstellung.js	Thu Feb 02 16:43:53 2017 +0100
+++ b/app/view/form/Ortserstellung.js	Thu Feb 02 16:59:25 2017 +0100
@@ -35,6 +35,12 @@
             labelWidth: 125,
             value: Lada.netzbetreiber[0]
         }, {
+            xtype: 'textfield',
+            name: 'ortId',
+            maxLength: 10,
+            labelWidth: 125,
+            fieldLabel: i18n.getMsg('orte.ortId')
+        }, {
             xtype: 'checkbox',
             name: 'aktiv',
             fieldLabel: 'aktiv:'
@@ -265,7 +271,6 @@
         }
         this_panel.record.set('letzteAenderung', 0);
         this_panel.record.set('id', null);
-        this_panel.record.set('ortId', null);
         this_panel.record.set('netzbetreiberId', Lada.netzbetreiber[0]);
         this_panel.record.save({
             success: function(record, response) {


More information about the Lada-commits mailing list