changeset 972:24b5684d74d7

Set letzteAenderung in a Bunch of controllers.
author Dustin Demuth <dustin@intevation.de>
date Tue, 17 Nov 2015 14:58:17 +0100
parents 37f30b01788c
children 989736bf4ffb
files app/controller/form/Location.js app/controller/form/Messprogramm.js app/controller/form/Messung.js app/controller/form/Ort.js app/controller/form/Probe.js app/controller/grid/Messmethode.js app/controller/grid/Messwert.js
diffstat 7 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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);
--- 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,
--- 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);
--- 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);
--- 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);
--- 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);
     },

http://lada.wald.intevation.org