[Lada-commits] [PATCH] Set letzteAenderung in a Bunch of controllers

Wald Commits scm-commit at wald.intevation.org
Tue Nov 17 14:58:27 CET 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1447768697 -3600
# Node ID 24b5684d74d79ed3cead540a2b3a294e490f646f
# Parent  37f30b01788c9965378a153bf6f8867c2a26194e
Set letzteAenderung in a Bunch of controllers.

diff -r 37f30b01788c -r 24b5684d74d7 app/controller/form/Location.js
--- a/app/controller/form/Location.js	Mon Nov 16 11:51:11 2015 +0100
+++ b/app/controller/form/Location.js	Tue Nov 17 14:58:17 2015 +0100
@@ -46,6 +46,9 @@
         for (var key in data) {
             formPanel.getForm().getRecord().set(key, data[key]);
         }
+        if (!formPanel.getForm().getRecord().get('letzteAenderung')) {
+            formPanel.getForm().getRecord().data.letzteAenderung = new Date();
+        }
         formPanel.getForm().getRecord().save({
             success: function(record, response) {
                 var json = Ext.decode(response.response.responseText);
diff -r 37f30b01788c -r 24b5684d74d7 app/controller/form/Messprogramm.js
--- a/app/controller/form/Messprogramm.js	Mon Nov 16 11:51:11 2015 +0100
+++ b/app/controller/form/Messprogramm.js	Tue Nov 17 14:58:17 2015 +0100
@@ -176,7 +176,7 @@
 
     },
     /**
-     * The save function saves the content of the Location form.
+     * The save function saves the content of the Messprogramm form.
      * On success it will reload the Store,
      * on failure, it will display an Errormessage
      */
@@ -186,6 +186,9 @@
         for (var key in data) {
             formPanel.getForm().getRecord().set(key, data[key]);
         }
+        if (!formPanel.getForm().getRecord().get('letzteAenderung')) {
+            formPanel.getForm().getRecord().data.letzteAenderung = new Date();
+        }
         formPanel.getForm().getRecord().save({
             success: function(record, response) {
                 var json = Ext.decode(response.response.responseText);
diff -r 37f30b01788c -r 24b5684d74d7 app/controller/form/Messung.js
--- a/app/controller/form/Messung.js	Mon Nov 16 11:51:11 2015 +0100
+++ b/app/controller/form/Messung.js	Tue Nov 17 14:58:17 2015 +0100
@@ -79,10 +79,11 @@
                 formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
                 var json = response.request.scope.reader.jsonData;
                 if (json) {
-                    if (json.errors.totalCount > 0 || json.warnings.totalCount > 0) {
-                        formPanel.setMessages(json.errors, json.warnings);
+                    if (json.errors || json.warnings) {
+                        if (json.errors.totalCount > 0 || json.warnings.totalCount > 0) {
+                            formPanel.setMessages(json.errors, json.warnings);
+                        }
                     }
-
                     if (json.message) {
                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
                             + ' #' + json.message,
diff -r 37f30b01788c -r 24b5684d74d7 app/controller/form/Ort.js
--- a/app/controller/form/Ort.js	Mon Nov 16 11:51:11 2015 +0100
+++ b/app/controller/form/Ort.js	Tue Nov 17 14:58:17 2015 +0100
@@ -33,7 +33,7 @@
     },
 
      /**
-      * The save function saves the content of the Location form.
+      * The save function saves the content of the Ort form.
       * On success it will reload the Store,
       * on failure, it will display an Errormessage
       */
@@ -43,6 +43,9 @@
         for (var key in data) {
             formPanel.getForm().getRecord().set(key, data[key]);
         }
+        if (!formPanel.getForm().getRecord().get('letzteAenderung')) {
+            formPanel.getForm().getRecord().data.letzteAenderung = new Date();
+        }
         formPanel.getForm().getRecord().save({
             success: function(record, response) {
                 var json = Ext.decode(response.response.responseText);
diff -r 37f30b01788c -r 24b5684d74d7 app/controller/form/Probe.js
--- a/app/controller/form/Probe.js	Mon Nov 16 11:51:11 2015 +0100
+++ b/app/controller/form/Probe.js	Tue Nov 17 14:58:17 2015 +0100
@@ -78,7 +78,7 @@
     },
 
     /**
-     * The save function saves the content of the Location form.
+     * The save function saves the content of the Messung form.
      * On success it will reload the Store,
      * on failure, it will display an Errormessage
      */
@@ -88,6 +88,9 @@
         for (var key in data) {
             formPanel.getForm().getRecord().set(key, data[key]);
         }
+        if (!formPanel.getForm().getRecord().get('letzteAenderung')) {
+            formPanel.getForm().getRecord().data.letzteAenderung = new Date();
+        }
         formPanel.getForm().getRecord().save({
             success: function(record, response) {
                 var json = Ext.decode(response.response.responseText);
diff -r 37f30b01788c -r 24b5684d74d7 app/controller/grid/Messmethode.js
--- a/app/controller/grid/Messmethode.js	Mon Nov 16 11:51:11 2015 +0100
+++ b/app/controller/grid/Messmethode.js	Tue Nov 17 14:58:17 2015 +0100
@@ -250,6 +250,9 @@
      */
     add: function(button) {
         var record = Ext.create('Lada.model.MmtMessprogramm');
+        if (!record.get('letzteAenderung')) {
+            record.data.letzteAenderung = new Date();
+        }
         record.set('messprogrammId', button.up('messmethodengrid').recordId);
         button.up('messmethodengrid').store.insert(0, record);
         button.up('messmethodengrid').rowEditing.startEdit(0, 0);
diff -r 37f30b01788c -r 24b5684d74d7 app/controller/grid/Messwert.js
--- a/app/controller/grid/Messwert.js	Mon Nov 16 11:51:11 2015 +0100
+++ b/app/controller/grid/Messwert.js	Tue Nov 17 14:58:17 2015 +0100
@@ -90,6 +90,9 @@
         var record = Ext.create('Lada.model.Messwert', {
             messungsId: button.up('messwertgrid').recordId
         });
+        if (!record.get('letzteAenderung')) {
+            record.data.letzteAenderung = new Date();
+        }
         button.up('messwertgrid').store.insert(0, record);
         button.up('messwertgrid').rowEditing.startEdit(0, 1);
     },


More information about the Lada-commits mailing list