Related to 39171: Use ad_periodcontrolallowed_org_id column instead of calling
authorSandra Huguet <sandra.huguet@openbravo.com>
Tue, 11 Sep 2018 15:58:39 -0400
changeset 34771 7671c9b22d7e
parent 34770 6bac4a0d2846
child 34772 ad75d3cb1744
Related to 39171: Use ad_periodcontrolallowed_org_id column instead of calling
ad_org_getperiodcontrolallow() function to improve performance.

The ad_org_getperiodcontrolallow column of each organization stores it period
control allowed organization. Using it is more efficient than invoke the ad_org_getperiodcontrolallow()
function as this one is recursive and implies extra queries that are unnecesaries
as the information is in the requested organizations.
src/org/openbravo/financial/ResetAccounting.java
--- a/src/org/openbravo/financial/ResetAccounting.java	Tue Sep 04 15:23:34 2018 +0200
+++ b/src/org/openbravo/financial/ResetAccounting.java	Tue Sep 11 15:58:39 2018 -0400
@@ -110,7 +110,7 @@
             // period control associated
             Map<String, String> organizationPeriodControl = new HashMap<>();
 
-            String myQuery1 = "select ad_org_id, ad_org_getperiodcontrolallow(ad_org_id) from ad_org where ad_org_id in (:orgIds)";
+            String myQuery1 = "select ad_org_id, ad_periodcontrolallowed_org_id from ad_org where ad_org_id in (:orgIds)";
 
             @SuppressWarnings("rawtypes")
             Query query1 = OBDal.getInstance().getSession().createNativeQuery(myQuery1);