details:   https://code.openbravo.com/erp/devel/pi/rev/46f51c5b045d
changeset: 19650:46f51c5b045d
user:      Ioritz Cia <ioritz.cia <at> openbravo.com>
date:      Mon Feb 11 13:33:15 2013 +0100
summary:   Fixes issue 22166: Wrong behaviour in the multiple product selector.
- Sales Dimensional Report.
- Shipments Dimensional Report
- Sales Order Report.

diffstat:

 
src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJRFilter.html
    |  15 +++-
 src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderFilterJR.html           
      |  15 +++-
 
src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJRFilter.html
 |  15 +++-
 src/org/openbravo/erpCommon/info/ProductMultiple.html                          
      |   5 +-
 src/org/openbravo/erpCommon/info/ProductMultiple.java                          
      |  46 ++++++++-
 src/org/openbravo/erpCommon/info/ProductMultiple.xml                           
      |   3 +
 src/org/openbravo/erpCommon/info/ProductMultiple_data.xsql                     
      |   2 +
 7 files changed, 88 insertions(+), 13 deletions(-)

diffs (293 lines):

diff -r 5265a23b7dbe -r 46f51c5b045d 
src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJRFilter.html
--- 
a/src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJRFilter.html
 Tue Feb 12 12:34:50 2013 +0530
+++ 
b/src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJRFilter.html
 Mon Feb 11 13:33:15 2013 +0100
@@ -116,6 +116,19 @@
        function onResizeDo(){
                resizeArea();
        }
+       function callProductMultipleSelector(strTop, strLeft, strSelectorName, 
strWindowName, validate, strForm, strItem){
+         if (strSelectorName!=null) {
+               gForm = (strForm==null)?"forms[0]":strForm;
+               gFieldKey=strItem;
+               gValidate = (validate==null)?false:validate;
+               var parameters=new Array();
+               for (var i=7;arguments[i]!=null;i++) {
+                 parameters[i-7] = arguments[i];
+               }
+               parameters = addArrayValue(parameters, "isSoTrx='Y'", 
"isSoTrx='Y'", true);
+               windowSearch(strSelectorName, null, 900, strTop, strLeft, 
strWindowName, parameters, null);
+         }
+       }
        </script>
 </head>
     <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" 
onload="onLoadDo();" onresize="onResizeDo();">
@@ -512,7 +525,7 @@
                             <tr>
                           <td>
                             <a class="List_Button_TopLink" href="#"
-                              onclick="openMultiSearch(null, null, 
'../info/ProductMultiple.html', 'SELECTOR_PRODUCT', false, 'frmMain', 
'inpmProductId_IN');return false;"
+                              onclick="callProductMultipleSelector(null, null, 
'../info/ProductMultiple.html', 'SELECTOR_PRODUCT', false, 'frmMain', 
'inpmProductId_IN');return false;"
                               onfocus="setWindowElementFocus(this); 
window.status='Add'; return true;"
                               onblur="window.status=''; return true;"
                               
onkeypress="this.className='List_Button_TopLink_active'; return true;"
diff -r 5265a23b7dbe -r 46f51c5b045d 
src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderFilterJR.html
--- a/src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderFilterJR.html      
Tue Feb 12 12:34:50 2013 +0530
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportSalesOrderFilterJR.html      
Mon Feb 11 13:33:15 2013 +0100
@@ -102,6 +102,19 @@
        function onResizeDo(){
                resizeArea();
        }
+       function callProductMultipleSelector(strTop, strLeft, strSelectorName, 
strWindowName, validate, strForm, strItem){
+         if (strSelectorName!=null) {
+           gForm = (strForm==null)?"forms[0]":strForm;
+           gFieldKey=strItem;
+           gValidate = (validate==null)?false:validate;
+           var parameters=new Array();
+           for (var i=7;arguments[i]!=null;i++) {
+             parameters[i-7] = arguments[i];
+           }
+           parameters = addArrayValue(parameters, "isSoTrx='Y'", 
"isSoTrx='Y'", true);
+           windowSearch(strSelectorName, null, 900, strTop, strLeft, 
strWindowName, parameters, null);
+         }
+       }
        </script>
 </head>
     <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" 
onload="onLoadDo();" onresize="onResizeDo();">
@@ -440,7 +453,7 @@
                             <tr>
                               <td>
                                 <a class="List_Button_TopLink" href="#"
-                                  onclick="openMultiSearch(null, null, 
'../info/ProductMultiple.html', 'SELECTOR_PRODUCT', false, 'frmMain', 
'inpmProductId_IN');return false;"
+                                  onclick="callProductMultipleSelector(null, 
null, '../info/ProductMultiple.html', 'SELECTOR_PRODUCT', false, 'frmMain', 
'inpmProductId_IN');return false;"
                                   onfocus="setWindowElementFocus(this); 
window.status='Add'; return true;"
                                   onblur="window.status=''; return true;"
                                   
onkeypress="this.className='List_Button_TopLink_active'; return true;"
diff -r 5265a23b7dbe -r 46f51c5b045d 
src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJRFilter.html
--- 
a/src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJRFilter.html
      Tue Feb 12 12:34:50 2013 +0530
+++ 
b/src/org/openbravo/erpCommon/ad_reports/ReportShipmentDimensionalAnalyzeJRFilter.html
      Mon Feb 11 13:33:15 2013 +0100
@@ -123,6 +123,19 @@
        function onResizeDo(){
                resizeArea();
        }
+       function callProductMultipleSelector(strTop, strLeft, strSelectorName, 
strWindowName, validate, strForm, strItem){
+         if (strSelectorName!=null) {
+           gForm = (strForm==null)?"forms[0]":strForm;
+           gFieldKey=strItem;
+           gValidate = (validate==null)?false:validate;
+           var parameters=new Array();
+           for (var i=7;arguments[i]!=null;i++) {
+             parameters[i-7] = arguments[i];
+           }
+           parameters = addArrayValue(parameters, "isSoTrx='Y'", 
"isSoTrx='Y'", true);
+           windowSearch(strSelectorName, null, 900, strTop, strLeft, 
strWindowName, parameters, null);
+         }
+       }
        </script>
 </head>
     <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" 
onload="onLoadDo();" onresize="onResizeDo();" id="form">
@@ -519,7 +532,7 @@
                             <tr>
                               <td>
                                 <a class="List_Button_TopLink" href="#"
-                                  onclick="openMultiSearch(null, null, 
'../info/ProductMultiple.html', 'SELECTOR_PRODUCT', false, 'frmMain', 
'inpmProductId_IN');return false;"
+                                  onclick="callProductMultipleSelector(null, 
null, '../info/ProductMultiple.html', 'SELECTOR_PRODUCT', false, 'frmMain', 
'inpmProductId_IN');return false;"
                                   onfocus="setWindowElementFocus(this); 
window.status='Add'; return true;"
                                   onblur="window.status=''; return true;"
                                   
onkeypress="this.className='List_Button_TopLink_active'; return true;"
diff -r 5265a23b7dbe -r 46f51c5b045d 
src/org/openbravo/erpCommon/info/ProductMultiple.html
--- a/src/org/openbravo/erpCommon/info/ProductMultiple.html     Tue Feb 12 
12:34:50 2013 +0530
+++ b/src/org/openbravo/erpCommon/info/ProductMultiple.html     Mon Feb 11 
13:33:15 2013 +0100
@@ -124,6 +124,7 @@
 <form name="frmSelector" method="post" action="ProductMultiple.html" 
target="medio">
        <input type="hidden" name="Command" />
        <input type="hidden" name="IsPopUpCall" value="1" />
+       <input type="hidden" name="isSoTrx" id="fieldIsSoTrx" value="N" />
        <div class="Popup_ContentPane_CircleLogo">
                <div class="Popup_WindowLogo">
                        <img class="Popup_WindowLogo_Icon 
Popup_WindowLogo_Icon_product" src="../../../../../web/images/blank.gif" 
border="0" />
@@ -285,8 +286,8 @@
                            <td>
                              <div id="grid" 
dojotype="openbravo.widget.DataGrid"
                                
structureurl="../info/ProductMultiple.html?Command=STRUCTURE"
-                               
dataurl="../info/ProductMultiple.html?Command=DATA"
-                               
updatesurl="../info/ProductMultiple.html?Command=DATA"
+                               
dataurl="../info/ProductMultiple.html?Command=DATAqq"
+                               
updatesurl="../info/ProductMultiple.html?Command=DATAqq"
                                calculatenumrows="true" editable="false" 
sortable="true"
                                deleteable="true" oninvalidvalue="alert" 
onscroll="updateHeader"
                                ongridload="onGridLoadDo" buffersize="3.0" 
showlinenumbers="true"
diff -r 5265a23b7dbe -r 46f51c5b045d 
src/org/openbravo/erpCommon/info/ProductMultiple.java
--- a/src/org/openbravo/erpCommon/info/ProductMultiple.java     Tue Feb 12 
12:34:50 2013 +0530
+++ b/src/org/openbravo/erpCommon/info/ProductMultiple.java     Mon Feb 11 
13:33:15 2013 +0100
@@ -20,6 +20,8 @@
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Vector;
 
 import javax.servlet.ServletConfig;
@@ -66,7 +68,8 @@
       // vars.setSessionValue("ProductMultiple.name", strNameValue + "%");
       String strKeyValue = vars.getGlobalVariable("inpKey", 
"ProductMultiple.key", "");
       String strNameValue = vars.getGlobalVariable("inpName", 
"ProductMultiple.name", "");
-      PrintPage(response, vars, strKeyValue, strNameValue);
+
+      PrintPage(response, vars, strKeyValue, strNameValue, 
isCalledFromSoTrx(request));
     } else if (vars.commandIn("STRUCTURE")) {
       printGridStructure(response, vars);
     } else if (vars.commandIn("DATA")) {
@@ -89,14 +92,16 @@
       String strPageSize = vars.getStringParameter("page_size");
       String strSortCols = vars.getInStringParameter("sort_cols", 
columnFilter);
       String strSortDirs = vars.getInStringParameter("sort_dirs", 
directionFilter);
+      String[] strIsSoTrx = request.getParameterValues("isSoTrx");
+      boolean isSoTrx = (strIsSoTrx != null) ? 
("'Y'".equalsIgnoreCase(strIsSoTrx[0])) : false;
 
       if (action.equalsIgnoreCase("getRows")) { // Asking for data rows
         printGridData(response, vars, strKey, strName, strProductCategory, 
strOrg, strSortCols,
-            strSortDirs, strOffset, strPageSize, strNewFilter);
+            strSortDirs, strOffset, strPageSize, strNewFilter, isSoTrx);
       } else if (action.equalsIgnoreCase("getIdsInRange")) {
         // asking for selected rows
         printGridDataSelectedRows(response, vars, strKey, strName, 
strProductCategory, strOrg,
-            strSortCols, strSortDirs);
+            strSortCols, strSortDirs, isSoTrx);
       } else {
         throw new ServletException("Unimplemented action in DATA request: " + 
action);
       }
@@ -105,7 +110,7 @@
   }
 
   private void PrintPage(HttpServletResponse response, VariablesSecureApp 
vars, String strKeyValue,
-      String strNameValue) throws IOException, ServletException {
+      String strNameValue, boolean isSoTrx) throws IOException, 
ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Output: Multiple products seeker Frame Set");
     XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
@@ -121,6 +126,7 @@
         "ALERT_MSG=\"" + Utility.messageBD(this, "NoProductSelected", 
vars.getLanguage()) + "\";");
     xmlDocument.setParameter("theme", vars.getTheme());
     xmlDocument.setParameter("name", strNameValue);
+    xmlDocument.setParameter("gridSoTrx", ((isSoTrx) ? "&isSoTrx='Y'" : ""));
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, 
"TABLEDIR",
           "M_Product_Category_ID", "", "", Utility.getContext(this, vars, 
"#AccessibleOrgTree",
@@ -196,8 +202,8 @@
 
   private void printGridData(HttpServletResponse response, VariablesSecureApp 
vars, String strKey,
       String strName, String strProductCategory, String strOrg, String 
strOrderCols,
-      String strOrderDirs, String strOffset, String strPageSize, String 
strNewFilter)
-      throws IOException, ServletException {
+      String strOrderDirs, String strOffset, String strPageSize, String 
strNewFilter,
+      boolean isSoTrx) throws IOException, ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Output: print page rows");
     int page = 0;
@@ -236,7 +242,7 @@
             pgLimit = TableSQLData.maxRowsPerGridPage + " OFFSET " + offset;
           }
           strNumRows = ProductMultipleData.countRows(this, rownum, strKey, 
strName,
-              strProductCategory,
+              strProductCategory, (isSoTrx) ? "Y" : null,
               Utility.getContext(this, vars, "#User_Client", 
"ProductMultiple"),
               Utility.getSelectorOrgs(this, vars, strOrg), pgLimit, oraLimit1, 
oraLimit2);
           vars.setSessionValue("BusinessPartnerInfo.numrows", strNumRows);
@@ -249,11 +255,13 @@
           String oraLimit1 = String.valueOf(offset + pageSize);
           String oraLimit2 = (offset + 1) + " AND " + oraLimit1;
           data = ProductMultipleData.select(this, "ROWNUM", strKey, strName, 
strProductCategory,
+              (isSoTrx) ? "Y" : null,
               Utility.getContext(this, vars, "#User_Client", 
"ProductMultiple"),
               Utility.getSelectorOrgs(this, vars, strOrg), strOrderBy, "", 
oraLimit1, oraLimit2);
         } else {
           String pgLimit = pageSize + " OFFSET " + offset;
           data = ProductMultipleData.select(this, "1", strKey, strName, 
strProductCategory,
+              (isSoTrx) ? "Y" : null,
               Utility.getContext(this, vars, "#User_Client", 
"ProductMultiple"),
               Utility.getSelectorOrgs(this, vars, strOrg), strOrderBy, 
pgLimit, "", "");
         }
@@ -345,7 +353,7 @@
    */
   private void printGridDataSelectedRows(HttpServletResponse response, 
VariablesSecureApp vars,
       String strKey, String strName, String strProductCategory, String strOrg, 
String strOrderCols,
-      String strOrderDirs) throws IOException, ServletException {
+      String strOrderDirs, boolean isSoTrx) throws IOException, 
ServletException {
     int minOffset = new 
Integer(vars.getStringParameter("minOffset")).intValue();
     int maxOffset = new 
Integer(vars.getStringParameter("maxOffset")).intValue();
     log4j.debug("Output: print page ids, minOffset: " + minOffset + ", 
maxOffset: " + maxOffset);
@@ -371,6 +379,7 @@
         String oraLimit1 = String.valueOf(maxOffset);
         String oraLimit2 = (minOffset + 1) + " AND " + oraLimit1;
         data = ProductMultipleData.select(this, "ROWNUM", strKey, strName, 
strProductCategory,
+            (isSoTrx) ? "Y" : null,
             Utility.getContext(this, vars, "#User_Client", "ProductMultiple"),
             Utility.getSelectorOrgs(this, vars, strOrg), strOrderBy, "", 
oraLimit1, oraLimit2);
       } else {
@@ -378,6 +387,7 @@
         int pageSize = maxOffset - minOffset + 1;
         String pgLimit = pageSize + " OFFSET " + minOffset;
         data = ProductMultipleData.select(this, "1", strKey, strName, 
strProductCategory,
+            (isSoTrx) ? "Y" : null,
             Utility.getContext(this, vars, "#User_Client", "ProductMultiple"),
             Utility.getSelectorOrgs(this, vars, strOrg), strOrderBy, pgLimit, 
"", "");
 
@@ -416,4 +426,24 @@
   public String getServletInfo() {
     return "Servlet that presents the multiple products seeker";
   } // end of getServletInfo() method
+
+  /*
+   * Currently this is only being used when the selector is called from: - 
Sales Dimensional Report
+   * - Shipments Dimensional Report - Sales Order Report
+   */
+  private boolean isCalledFromSoTrx(HttpServletRequest request) {
+    HashMap parameters = (HashMap) request.getParameterMap();
+    Iterator it = parameters.keySet().iterator();
+    String[] value;
+    boolean isSoTrx = false;
+    while (it.hasNext()) {
+      String key = (String) it.next();
+      if (key.toLowerCase().contains("issotrx")) {
+        value = (String[]) (parameters.get(key));
+        isSoTrx = value[0].contains("isSoTrx='Y'");
+      }
+    }
+
+    return isSoTrx;
+  }
 }
diff -r 5265a23b7dbe -r 46f51c5b045d 
src/org/openbravo/erpCommon/info/ProductMultiple.xml
--- a/src/org/openbravo/erpCommon/info/ProductMultiple.xml      Tue Feb 12 
12:34:50 2013 +0530
+++ b/src/org/openbravo/erpCommon/info/ProductMultiple.xml      Mon Feb 11 
13:33:15 2013 +0100
@@ -25,7 +25,10 @@
        <PARAMETER id="paramCSS" name="theme" attribute="href" 
replace="Default"/>
        <PARAMETER id="fieldKey" name="key" attribute="value"/>
        <PARAMETER id="fieldName" name="name" attribute="value"/>
+    <PARAMETER id="fieldIsSoTrx" name="isSoTrx" attribute="value"/>
        <PARAMETER id="fieldSelected" name="category" />
+    <PARAMETER id="grid" name="gridSoTrx" attribute="dataurl" replace="qq"/>
+    <PARAMETER id="grid" name="gridSoTrx" attribute="updatesurl" replace="qq"/>
        <SUBREPORT id="reportM_Product_Category_ID" 
name="reportM_Product_Category_ID" 
report="org/openbravo/erpCommon/reference/List">
                <ARGUMENT name="parameterListSelected" withId="fieldSelected"/>
        </SUBREPORT>
diff -r 5265a23b7dbe -r 46f51c5b045d 
src/org/openbravo/erpCommon/info/ProductMultiple_data.xsql
--- a/src/org/openbravo/erpCommon/info/ProductMultiple_data.xsql        Tue Feb 
12 12:34:50 2013 +0530
+++ b/src/org/openbravo/erpCommon/info/ProductMultiple_data.xsql        Mon Feb 
11 13:33:15 2013 +0100
@@ -44,6 +44,7 @@
         <Parameter name="key" ignoreValue="%" optional="true" after="WHERE 
"><![CDATA[ UPPER(p.Value) LIKE UPPER(?) AND ]]></Parameter>
         <Parameter name="name" ignoreValue="%" optional="true" after="WHERE 
"><![CDATA[ UPPER(p.Name) LIKE UPPER(?) AND ]]></Parameter>
         <Parameter name="productCategory" optional="true" after="WHERE 
"><![CDATA[ p.M_Product_Category_ID = ? AND ]]></Parameter>
+        <Parameter name="isSoTrx" optional="true" after="AND 
p.IsSummary='N'"><![CDATA[ AND p.issold = ? ]]></Parameter>
         <Parameter name="adUserClient" type="replace" optional="true" 
after="p.AD_Client_ID IN (" text="'1'"/>
         <Parameter name="adUserOrg" type="replace" optional="true" 
after="p.AD_Org_ID IN (" text="'1'"/>
         <Parameter name="orderBy" type="replace" optional="true" after="ORDER 
BY " text="PRODUCT_CATEGORY" />
@@ -73,6 +74,7 @@
         <Parameter name="key" ignoreValue="%" optional="true" after="WHERE 
"><![CDATA[ UPPER(p.Value) LIKE UPPER(?) AND ]]></Parameter>
         <Parameter name="name" ignoreValue="%" optional="true" after="WHERE 
"><![CDATA[ UPPER(p.Name) LIKE UPPER(?) AND ]]></Parameter>
         <Parameter name="productCategory" optional="true" after="WHERE 
"><![CDATA[ p.M_Product_Category_ID = ? AND ]]></Parameter>
+        <Parameter name="isSoTrx" optional="true" after="AND 
p.IsSummary='N'"><![CDATA[ AND p.issold = ? ]]></Parameter>
         <Parameter name="adUserClient" type="replace" optional="true" 
after="p.AD_Client_ID IN (" text="'1'"/>
         <Parameter name="adUserOrg" type="replace" optional="true" 
after="p.AD_Org_ID IN (" text="'1'"/>
         <Parameter name="pgLimit" type="argument" optional="true" after="AND 
1=1"><![CDATA[LIMIT ]]></Parameter>

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to