[OpenbravoERP-commits] devel/pi: Fixed bug 30735: SL_ProductPrice_PriceListVersion is b...

2015-09-10 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/13211c4cc0a0
changeset: 27561:13211c4cc0a0
user:  Víctor Martínez Romanos  openbravo.com>
date:  Thu Sep 10 11:39:20 2015 +0200
summary:   Fixed bug 30735: SL_ProductPrice_PriceListVersion is back with 
improvements

The SL_ProductPrice_PriceListVersion callout has been associated again to the 
Price List Version column.
This callout sets the Product Price's Organization equal to the Price List 
Version's Organization only in the case the current role has write access to 
the PLV's Organization.

Besides, this callout has been improved:
+ Run in admin mode
+ The validation to know whether it was a valid organization was wrong, because 
the indexOf() may also return 0 when a record is found. Besides using indexOf() 
to run this validation could be wrong when the Price List version is defined 
for * organization (since any of the organization's UUID in the role might 
contain a 0).
So this validation has been completely rewritten using StringTokenizer.
+ Finally, in case the role is defined for Client or Client+Organization user 
level, we force to include * in the list of valid organizations.

diffstat:

 src-db/database/sourcedata/AD_COLUMN.xml  
|   1 +
 src/org/openbravo/erpCommon/ad_callouts/SL_ProductPrice_PriceListVersion.java 
|  51 ++---
 2 files changed, 36 insertions(+), 16 deletions(-)

diffs (93 lines):

diff -r 36616fa1a496 -r 13211c4cc0a0 src-db/database/sourcedata/AD_COLUMN.xml
--- a/src-db/database/sourcedata/AD_COLUMN.xml  Wed Sep 09 21:09:32 2015 +
+++ b/src-db/database/sourcedata/AD_COLUMN.xml  Thu Sep 10 11:39:20 2015 +0200
@@ -40713,6 +40713,7 @@
   
   
   
+  

   
   
   
diff -r 36616fa1a496 -r 13211c4cc0a0 
src/org/openbravo/erpCommon/ad_callouts/SL_ProductPrice_PriceListVersion.java
--- 
a/src/org/openbravo/erpCommon/ad_callouts/SL_ProductPrice_PriceListVersion.java 
Wed Sep 09 21:09:32 2015 +
+++ 
b/src/org/openbravo/erpCommon/ad_callouts/SL_ProductPrice_PriceListVersion.java 
Thu Sep 10 11:39:20 2015 +0200
@@ -20,20 +20,22 @@
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.StringTokenizer;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.lang.StringUtils;
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.model.ad.access.Role;
 import org.openbravo.model.pricing.pricelist.PriceListVersion;
 import org.openbravo.xmlEngine.XmlDocument;
 
-@Deprecated
 public class SL_ProductPrice_PriceListVersion extends HttpSecureAppServlet {
   private static final long serialVersionUID = 1L;
 
@@ -59,22 +61,39 @@
 XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
 "org/openbravo/erpCommon/ad_callouts/CallOut").createXmlDocument();
 
-StringBuilder resultado = new StringBuilder();
-boolean hasAccessTo = false;
+try {
+  OBContext.setAdminMode();
+  StringBuilder resultado = new StringBuilder();
+  boolean hasAccessTo = false;
 
-PriceListVersion plv = OBDal.getInstance().get(PriceListVersion.class, 
strPriceListV);
-Role role = OBDal.getInstance().get(Role.class, vars.getRole());
-hasAccessTo = 
role.getOrganizationList().indexOf(plv.getOrganization().getId()) > 0;
+  // If the role has access to the Price List Version Organization, we set 
this organization to
+  // the record.
+  PriceListVersion plv = OBDal.getInstance().get(PriceListVersion.class, 
strPriceListV);
+  final String plvOrgId = plv.getOrganization().getId();
+  Role role = OBDal.getInstance().get(Role.class, vars.getRole());
+  String roleOrgListStr = role.getOrganizationList();
+  if (StringUtils.contains(role.getUserLevel(), "C")) {
+// If the role is for Client or Client + Organization, we add * 
organization to the list
+roleOrgListStr = roleOrgListStr + ",0";
+  }
+  StringTokenizer roleOrgList = new StringTokenizer(
+  StringUtils.deleteWhitespace(roleOrgListStr), ",");
+  while (!hasAccessTo && roleOrgList.hasMoreTokens()) {
+hasAccessTo = StringUtils.equals(roleOrgList.nextToken(), plvOrgId);
+  }
 
-resultado.append("var 
calloutName='SL_ProductPrice_PriceListVersion';\n\n");
-resultado.append("var respuesta = new Array(");
-resultado.append("new Array(\"inpadOrgId\", \""
-+ ((hasAccessTo) ? plv.getOrganization().getId() : strOrg) + "\"));");
-xmlDocument.setParameter("array", resultado.toString());
-xmlDocument.setParameter("frameName", "appFrame");
-response.setContentType("text/html; charset=UTF-8");
-PrintWriter out = response.getWriter();
-out.println(xmlDocument.print());
-

[OpenbravoERP-commits] devel/main: 6 new changesets

2015-09-10 Thread hg
details:   https://code.openbravo.com/erp/devel/main/rev/b4dbd8ccb5ca
changeset: 27557:b4dbd8ccb5ca
user:  Alvaro Ferraz  openbravo.com>
date:  Fri Sep 04 14:47:22 2015 +0200
summary:   Fixes issue 30586: Performance problems in 
ProductCharacteristicEventHandler

Many loops inside ProductCharacteristicEventHandler have been replaced or 
removed.
Loops to check if there is any wrong result, have been replaced with a unique 
result query.
Loops inside getValuesToAdd method have been replaced with a query and results 
will be returned with a ScrollableResults.
Loop to retrieve existingValues has been replaced with a query.

details:   https://code.openbravo.com/erp/devel/main/rev/16ed86fcdf7f
changeset: 27558:16ed86fcdf7f
user:  Atul Gaware  openbravo.com>
date:  Wed Jul 15 23:48:05 2015 +0530
summary:   Fixes Issue 27440:pl-function c_order_status is broken: uuid bug

Variable v_CountNotPaid wrongly set as VARCHAR during merge r2.5x
into trunk

details:   https://code.openbravo.com/erp/devel/main/rev/a07dc1b84ebd
changeset: 27559:a07dc1b84ebd
user:  Atul Gaware  openbravo.com>
date:  Fri Jul 17 19:17:49 2015 +0530
summary:   Fixes Issue 27444:pl-function ad_org_chk_ready has datatype mismatch

Return type of ad_org_chk_ready changed to numeric.

details:   https://code.openbravo.com/erp/devel/main/rev/36616fa1a496
changeset: 27560:36616fa1a496
user:  RM packaging bot  openbravo.com>
date:  Wed Sep 09 21:09:32 2015 +
summary:   CI: merge back from main

details:   https://code.openbravo.com/erp/devel/main/rev/13211c4cc0a0
changeset: 27561:13211c4cc0a0
user:  Víctor Martínez Romanos  openbravo.com>
date:  Thu Sep 10 11:39:20 2015 +0200
summary:   Fixed bug 30735: SL_ProductPrice_PriceListVersion is back with 
improvements

The SL_ProductPrice_PriceListVersion callout has been associated again to the 
Price List Version column.
This callout sets the Product Price's Organization equal to the Price List 
Version's Organization only in the case the current role has write access to 
the PLV's Organization.

Besides, this callout has been improved:
+ Run in admin mode
+ The validation to know whether it was a valid organization was wrong, because 
the indexOf() may also return 0 when a record is found. Besides using indexOf() 
to run this validation could be wrong when the Price List version is defined 
for * organization (since any of the organization's UUID in the role might 
contain a 0).
So this validation has been completely rewritten using StringTokenizer.
+ Finally, in case the role is defined for Client or Client+Organization user 
level, we force to include * in the list of valid organizations.

details:   https://code.openbravo.com/erp/devel/main/rev/2828f6cbe752
changeset: 27562:2828f6cbe752
user:  RM packaging bot  openbravo.com>
date:  Fri Sep 11 04:15:12 2015 +
summary:   CI: update AD_MODULE to version 27561

diffstat:

 modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml  
   |2 +-
 
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
  |4 +-
 
modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE.xml
   |2 +-
 
modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
|2 +-
 modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml   
   |2 +-
 
modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
   |2 +-
 
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml
 |2 +-
 
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
  |8 +-
 
modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE.xml
  |2 +-
 
modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
   |2 +-
 modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE.xml   
   |2 +-
 
modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
   |6 +-
 modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE.xml 
   |2 +-
 
modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
 |4 +-
 
modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE.xml 
  |2 +-
 
modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
|2 +-
 modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE.xml  
   |2 +-
 

[OpenbravoERP-commits] devel/pi: 2 new changesets

2015-09-10 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/2828f6cbe752
changeset: 27562:2828f6cbe752
user:  RM packaging bot  openbravo.com>
date:  Fri Sep 11 04:15:12 2015 +
summary:   CI: update AD_MODULE to version 27561

details:   https://code.openbravo.com/erp/devel/pi/rev/8640bd33c410
changeset: 27563:8640bd33c410
user:  RM packaging bot  openbravo.com>
date:  Fri Sep 11 04:31:36 2015 +
summary:   CI: merge back from main

diffstat:

 modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml  
   |   2 +-
 
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
  |   4 +-
 
modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE.xml
   |   2 +-
 
modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
|   2 +-
 modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml   
   |   2 +-
 
modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
   |   2 +-
 
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml
 |   2 +-
 
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
  |   8 +-
 
modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE.xml
  |   2 +-
 
modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
   |   2 +-
 modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE.xml   
   |   2 +-
 
modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
   |   6 +-
 modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE.xml 
   |   2 +-
 
modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
 |   4 +-
 
modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE.xml 
  |   2 +-
 
modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
|   2 +-
 modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE.xml  
   |   2 +-
 
modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
  |   2 +-
 
modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE.xml
|   2 +-
 
modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
 |   2 +-
 
modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE.xml
 |   2 +-
 
modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
  |   2 +-
 
modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE.xml
 |   2 +-
 
modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
  |  10 ++--
 
modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE.xml
 |   2 +-
 
modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
  |   4 +-
 
modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE.xml
 |   2 +-
 
modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
  |   2 +-
 modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE.xml
   |   2 +-
 
modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
|   2 +-
 
modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE.xml
 |   2 +-
 
modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
  |  12 ++--
 
modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE.xml
|   2 +-
 
modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
 |   2 +-
 
modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE.xml
  |   2 +-
 
modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
   |   6 +-
 
modules/org.openbravo.utility.cleanup.log/src-db/database/sourcedata/AD_MODULE.xml
|   2 +-
 
modules/org.openbravo.utility.cleanup.log/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
 |   2 +-