details:   /erp/devel/pi/rev/28f9c6ff72bc
changeset: 10857:28f9c6ff72bc
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Thu Feb 24 09:13:53 2011 +0100
summary:   Prevent update of referenced entities

details:   /erp/devel/pi/rev/a8b48b4236a4
changeset: 10858:a8b48b4236a4
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Thu Feb 24 09:14:26 2011 +0100
summary:   Solve issue that auto save form was not cleared

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js
 |  12 ++++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
                |   5 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
                |  26 +++++----
 3 files changed, 32 insertions(+), 11 deletions(-)

diffs (96 lines):

diff -r 23ea69d38e57 -r a8b48b4236a4 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js
   Wed Feb 23 20:08:16 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js
   Thu Feb 24 09:14:26 2011 +0100
@@ -60,6 +60,18 @@
   },
   
   performDSOperation: function(operationType, data, callback, 
requestProperties){
+    // only update the values of the record itself but not of any referenced 
+    // entity
+    if (operationType === 'update' || operationType === 'add') {
+      var correctedData = {};
+      for (var prop in data) {
+        if (data.hasOwnProperty(prop) && !prop.contains('.')) {
+          correctedData[prop] = data[prop];
+        }
+      }
+      data = correctedData;
+    }
+    
     // requestProperties.showPrompt = false;
     // set the current selected record before the delay
     var currentRecord = this.view.viewGrid.getSelectedRecord();
diff -r 23ea69d38e57 -r a8b48b4236a4 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Wed Feb 23 20:08:16 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Thu Feb 24 09:14:26 2011 +0100
@@ -656,6 +656,11 @@
   // in contrast to other actions which are done at blur
   // see: handleItemChange
   itemChangeActions: function(){
+    // special case, item change is called when the inline form is being hidden
+    if (!this.view.isShowingForm && !this.view.isEditingGrid) {
+      return;
+    }
+    
     // remove the message
     this.setHasChanged(true);
     this.view.messageBar.hide();
diff -r 23ea69d38e57 -r a8b48b4236a4 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Wed Feb 23 20:08:16 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Thu Feb 24 09:14:26 2011 +0100
@@ -1088,7 +1088,6 @@
     if (!this.getSelectedRecord()) {
       this.selectRecord(record);
     }
-    this.view.messageBar.hide();
   },
   
   editComplete: function(rowNum, colNum, newValues, oldValues, 
editCompletionEvent, dsResponse){
@@ -1115,12 +1114,6 @@
     // remove any new pointer
     delete record._new;
     
-    // remove the error style/message
-    this.setRecordErrorMessage(rowNum, null);
-    
-    // update after the error message has been removed
-    this.view.updateTabTitle();
-    
     // success invoke the action, if any there
     this.view.standardWindow.autoSaveDone(this.view, true);
     
@@ -1131,7 +1124,11 @@
     } else if (this.getSelectedRecord() === record) {
       this.view.refreshChildViews();
     }
-    
+        
+    // remove the error style/message
+    this.setRecordErrorMessage(rowNum, null);
+    // update after the error message has been removed
+    this.view.updateTabTitle();
     this.view.toolBar.updateButtonState(true);
     this.view.messageBar.hide();
     this.view.refreshParentRecord();
@@ -1215,11 +1212,18 @@
     }
   },
   
-  saveEdits : function (editCompletionEvent, callback, rowNum, colNum, 
validateOnly) {
-    return this.Super('saveEdits', arguments);
+  saveEdits: function (editCompletionEvent, callback, rowNum, colNum, 
validateOnly) {
+    var ret = this.Super('saveEdits', arguments);
+    // save was not done, because there were no changes probably
+    if (!ret) {
+      this.view.standardWindow.cleanUpAutoSaveProperties();
+      this.view.updateTabTitle();
+      this.view.toolBar.updateButtonState(true);
+    }
+    return ret;
   },
   
-  // saveEdits: when saving, first check if a FIC call needs to be done to 
update to the 
+  // saveEditedValues: when saving, first check if a FIC call needs to be done 
to update to the 
   // latest values. This can happen when the focus is in a field and the save 
action is
   // done, at that point first try to force a fic call (handleItemChange) and 
if that
   // indeed happens stop the saveEdit until the fic returns

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to