details:   /erp/devel/pi/rev/b98f5e7b8c8c
changeset: 10903:b98f5e7b8c8c
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Mon Feb 28 11:33:40 2011 +0100
summary:   Fixes issue 15851: The 'Show Audit Trail' button (footprints) should 
only be active for rows with actual changes

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
 |  26 ++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diffs (43 lines):

diff -r 5db9f78864bc -r b98f5e7b8c8c 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
    Mon Feb 28 10:54:04 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
    Mon Feb 28 11:33:40 2011 +0100
@@ -153,6 +153,27 @@
       }
     },
     keyboardShortcutId: 'ToolBar_Undo'
+  },
+  // This offers a mechanism to add properties at runtime to buttons created 
through
+  // templates and java
+  BUTTON_PROPERTIES: {
+    'audit' : {
+      updateState: function(){
+        var view = this.view, form = view.viewForm, grid = view.viewGrid;
+        var selectedRecords = grid.getSelectedRecords();
+        var disabled = false;
+        if (selectedRecords && selectedRecords.length > 1) {
+            disabled = true;
+        } else if (view.isShowingForm && form.isNew) {
+          disabled = true;
+        } else if (view.isEditingGrid && grid.getEditForm().isNew) {
+          disabled = true;
+        } else if (selectedRecords && selectedRecords.length > 0 && 
selectedRecords[0].updated && selectedRecords[0].creationDate && 
selectedRecords[0].updated.getTime() === 
selectedRecords[0].creationDate.getTime()){
+          disabled = true;          
+        }
+        this.setDisabled(disabled);
+      }
+    }
   }
 });
 
@@ -189,6 +210,11 @@
     if (this.leftMembers) {
       for (i = 0; i < this.leftMembers.length; i++) {
         newMembers[j] = this.leftMembers[i];
+        
+        if (newMembers[j].buttonType && 
isc.OBToolbar.BUTTON_PROPERTIES[newMembers[j].buttonType]) {
+          isc.addProperties(newMembers[j], 
isc.OBToolbar.BUTTON_PROPERTIES[newMembers[j].buttonType]);
+        }
+        
         
OB.TestRegistry.register('org.openbravo.client.application.toolbar.button.' + 
this.leftMembers[i].buttonType + '.' + this.view.tabId, this.leftMembers[i]);
         
         newMembers[j].toolBar = this;

------------------------------------------------------------------------------
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