details:   https://code.openbravo.com/erp/devel/pi/rev/5e8878153d02
changeset: 24379:5e8878153d02
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Thu Sep 04 10:13:18 2014 +0200
summary:   Fixes issue 27529: Param windows use context of owner view, not 
source view

When in a parameter window the context info of the underlying tab is requested, 
the tab to be should should be the tab where the parameter window is declared, 
even if one of its subtabs is currently active.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
 |  12 ++++++---
 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
         |   6 +++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (77 lines):

diff -r 37e6593b3db7 -r 5e8878153d02 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
      Thu Sep 04 12:51:59 2014 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
      Thu Sep 04 10:13:18 2014 +0200
@@ -179,7 +179,7 @@
         currentValues = isc.shallowClone(form.getValues());
       }
       OB.Utilities.fixNull250(currentValues);
-      parentContext = (this.view.sourceView && 
this.view.sourceView.getContextInfo(false, true, true, true)) || {};
+      parentContext = this.view.getUnderLyingRecordContext(false, true, true, 
true);
 
       try {
         if (isc.isA.Function(this.originalShowIf)) {
@@ -289,7 +289,7 @@
     this.members.push(this.loading);
     this.Super('initWidget', arguments);
 
-    context = this.sourceView ? this.sourceView.getContextInfo(false, true, 
true, true) : {};
+    context =  this.getUnderLyingRecordContext(false, true, true, true);
 
     
OB.RemoteCallManager.call('org.openbravo.client.application.process.DefaultsProcessActionHandler',
 context, {
       processId: this.processId,
@@ -442,7 +442,7 @@
 
   doProcess: function (btnValue) {
     var i, tmp, view = this,
-        grid, allProperties = (this.sourceView && 
this.sourceView.getContextInfo(false, true, false, true)) || {},
+        grid, allProperties = this.getUnderLyingRecordContext(false, true, 
false, true),
         selection, len, allRows, params, tab, actionHandlerCall;
     // activeView = view.parentWindow && view.parentWindow.activeView,  ???.
     if (this.resultLayout && this.resultLayout.destroy) {
@@ -570,7 +570,7 @@
     if (!form) {
       return;
     }
-    parentContext = (this.sourceView && this.sourceView.getContextInfo(false, 
true, true, true)) || {};
+    parentContext = this.getUnderLyingRecordContext(false, true, true, true);
 
     fields = form.getFields();
     for (i = 0; i < fields.length; i++) {
@@ -617,6 +617,10 @@
     return result;
   },
 
+  getUnderLyingRecordContext: function (onlySessionProperties, classicMode, 
forceSettingContextVars, convertToClassicFormat) {
+    return (this.buttonOwnerView && 
this.buttonOwnerView.getContextInfo(onlySessionProperties, classicMode, 
forceSettingContextVars, convertToClassicFormat)) || {};
+  },
+
   // returns true if any non-grid required parameter does not have a value
   allRequiredParametersSet: function () {
     var i, item, length = this.theForm.getItems().length,
diff -r 37e6593b3db7 -r 5e8878153d02 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- 
a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Thu Sep 04 12:51:59 2014 +0200
+++ 
b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Thu Sep 04 10:13:18 2014 +0200
@@ -386,10 +386,14 @@
     // on purpose not passing the third boolean param
     if (this.selector && this.selector.form && this.selector.form.view && 
this.selector.form.view.getContextInfo) {
       isc.addProperties(data, this.selector.form.view.getContextInfo(false, 
true));
+    } else if (this.view && this.view.getUnderLyingRecordContext) {
+      isc.addProperties(data, this.view.getUnderLyingRecordContext(false, 
true));
     } else if (this.view && this.view.sourceView && 
this.view.sourceView.getContextInfo) {
       isc.addProperties(data, this.view.sourceView.getContextInfo(false, 
true));
     }
 
+
+
     callback = function (resp, data, req) {
       selectorWindow.fetchDefaultsCallback(resp, data, req);
     };
@@ -1016,6 +1020,8 @@
     if (selector.form && selector.form.view && 
selector.form.view.getContextInfo) {
       // for table and table dir reference values needs to be transformed to 
classic (ex.: true -> Y)
       isc.addProperties(params, selector.form.view.getContextInfo(false, true, 
null, selector.isComboReference));
+    } else if (selector.view && selector.view.getUnderLyingRecordContext) {
+      isc.addProperties(params, 
selector.view.getUnderLyingRecordContext(false, true, null, 
selector.isComboReference));
     } else if (selector.view && selector.view.sourceView && 
selector.view.sourceView.getContextInfo) {
       isc.addProperties(params, selector.view.sourceView.getContextInfo(false, 
true, null, selector.isComboReference));
     } else if (selector.grid && selector.grid.contentView && 
selector.grid.contentView.getContextInfo) {

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to