details:   /erp/devel/pi/rev/35fe465f97b4
changeset: 11210:35fe465f97b4
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Mar 14 10:34:00 2011 +0100
summary:   fixed bug 16251: Show accounting and tranlsation tabs preferences 
don't work

details:   /erp/devel/pi/rev/36dfae98fcdc
changeset: 11211:36dfae98fcdc
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Mar 14 10:34:56 2011 +0100
summary:   related to bug 16251: save client porperties when changing session 
prefs

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
 |   2 +
 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
        |   8 +++++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-property-store.js
      |  14 +++++----
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
       |   5 +++
 src/org/openbravo/erpCommon/ad_forms/ShowSessionPreferences.html               
                            |  15 ++++++++-
 5 files changed, 36 insertions(+), 8 deletions(-)

diffs (114 lines):

diff -r f7ae04ce02e5 -r 36dfae98fcdc 
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
        Mon Mar 14 10:03:58 2011 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
        Mon Mar 14 10:34:56 2011 +0100
@@ -32,6 +32,8 @@
     
     defaultEditMode: ${tabComponent.defaultEditMode},
     mapping250: '${tabComponent.mapping250?js_string}',
+    isAcctTab: ${tabComponent.acctTab?string}, 
+    isTrlTab: ${tabComponent.trlTab?string},
     
     standardProperties:{
       inpTabId: '${tabComponent.tabId}',
diff -r f7ae04ce02e5 -r 36dfae98fcdc 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
       Mon Mar 14 10:03:58 2011 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
       Mon Mar 14 10:34:56 2011 +0100
@@ -274,6 +274,14 @@
     this.tabTitle = tabTitle;
   }
 
+  public boolean isAcctTab() {
+    return tab.isAccountingTab();
+  }
+
+  public boolean isTrlTab() {
+    return tab.isTranslationTab();
+  }
+
   public List<FieldProperty> getAllFields() {
     List<FieldProperty> fields = new ArrayList<FieldProperty>();
     for (Field field : tab.getADFieldList()) {
diff -r f7ae04ce02e5 -r 36dfae98fcdc 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-property-store.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-property-store.js
     Mon Mar 14 10:03:58 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-property-store.js
     Mon Mar 14 10:34:56 2011 +0100
@@ -74,18 +74,20 @@
     // * {{{propertyName}}}: the name of the property
     // * {{{value}}}: the value of the property
     //
-    set: function(/* String */propertyName, /* Object */ value, windowId){
+    set: function(/* String */propertyName, /* Object */ value, windowId, 
noSetInServer){
       var currentValue = OB.Properties[propertyName], data={property: 
propertyName}, localPropertyName=propertyName;
       if(windowId){
-       data.windowId=windowId;
-       localPropertyName=propertyName + '_' + windowId;
+        data.windowId=windowId;
+        localPropertyName=propertyName + '_' + windowId;
       }
       // set it locally
       OB.Properties[localPropertyName] = value;
       
-      // and set it in the server also
-      
OB.RemoteCallManager.call('org.openbravo.client.application.StorePropertyActionHandler',
 value, data, function(){
-      });
+      if (!noSetInServer) {
+        // and set it in the server also
+        
OB.RemoteCallManager.call('org.openbravo.client.application.StorePropertyActionHandler',
 value, data, function(){
+        });
+      }
       
       // call the listeners
       for (var i = 0; i < this.listeners.length; i++) {
diff -r f7ae04ce02e5 -r 36dfae98fcdc 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Mon Mar 14 10:03:58 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Mon Mar 14 10:34:56 2011 +0100
@@ -499,6 +499,11 @@
   // this
   // parent.
   addChildView: function(childView){
+    if ((childView.isTrlTab && OB.PropertyStore.get('ShowTrl', this.windowId) 
!== 'Y') ||
+        (childView.isAcctTab && OB.PropertyStore.get('ShowAcct', 
this.windowId) !== 'Y')){
+      return;
+    }
+    
     this.standardWindow.addView(childView);
     
     childView.parentView = this;
diff -r f7ae04ce02e5 -r 36dfae98fcdc 
src/org/openbravo/erpCommon/ad_forms/ShowSessionPreferences.html
--- a/src/org/openbravo/erpCommon/ad_forms/ShowSessionPreferences.html  Mon Mar 
14 10:03:58 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/ShowSessionPreferences.html  Mon Mar 
14 10:34:56 2011 +0100
@@ -13,7 +13,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo S.L.U. 
+ * All portions are Copyright (C) 2001-2011 Openbravo S.L.U. 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -71,6 +71,17 @@
        function onResizeDo(){
                resizeArea();
        }
+       
+       function savePreferences(){
+      if (getFrame('LayoutMDI') && getFrame('LayoutMDI').OB) {
+        // If using 3.0 layout, set in PropertyStore the preferences used in 
3.0 style windows
+        var OB = getFrame('LayoutMDI').OB;
+        
+        OB.PropertyStore.set('ShowTrl', 
document.frmMain.inpTranslate.checked?'Y':'N', null, true);
+        OB.PropertyStore.set('ShowAcct', 
document.frmMain.inpAccounting.checked?'Y':'N', null, true);
+      }
+      submitCommandForm('SAVE_PREFERENCES', false, null, 
'ShowSessionPreferences.html', '_self');
+    }
        </script>
 </head>
 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" 
onload="onLoadDo();" onresize="onResizeDo();" id="paramMessage">
@@ -425,7 +436,7 @@
                       <button type="button" 
                         id="buttonSave" 
                         class="ButtonLink" 
-                        onclick="submitCommandForm('SAVE_PREFERENCES', false, 
null, 'ShowSessionPreferences.html', '_self');return false;" 
+                        onclick="savePreferences(); return false;" 
                         onfocus="buttonEvent('onfocus', this); 
window.status='Save'; return true;" 
                         onblur="buttonEvent('onblur', this);" 
                         onkeyup="buttonEvent('onkeyup', this);" 

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to