Fixes issue 34096: Added Organization Filter in End Year Close process
authorSanjota <sanjota.nelagi@promantia.com>
Fri, 30 Sep 2016 15:47:22 +0530
changeset 30612 3184adb3f998
parent 30611 5cffde20b3b1
child 30613 3d435a4c1794
child 30616 538700cbd709
Fixes issue 34096: Added Organization Filter in End Year Close process

Added Organization Filter in End Year Close process to close year to look at years closed for selected organization.
src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility.java
src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility_data.xsql
--- a/src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility.java	Fri Sep 30 13:09:10 2016 +0200
+++ b/src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility.java	Fri Sep 30 15:47:22 2016 +0530
@@ -68,7 +68,8 @@
     String strOrgId = organization.getId();
     OBError myError = new OBError();
     try {
-      boolean isYearNotClose = EndYearCloseUtilityData.selectYearNotClosed(conn, strYearId);
+      boolean isYearNotClose = EndYearCloseUtilityData.selectYearNotClosed(conn, strYearId,
+          strOrgId);
       if (isYearNotClose) {
         throw new OBException(Utility.messageBD(conn, "YearNotClose", vars.getLanguage()));
       }
@@ -384,7 +385,8 @@
       String strRegFactAcctGroupId, String strCloseFactAcctGroupId,
       String strDivideUpFactAcctGroupId, String strOpenUpFactAcctGroupId, String strOrgClosingId)
       throws ServletException {
-    boolean isYearNotAllowed = EndYearCloseUtilityData.selectUndoAllowed(conn, strYearId, stradOrgId);
+    boolean isYearNotAllowed = EndYearCloseUtilityData.selectUndoAllowed(conn, strYearId,
+        stradOrgId);
     if (isYearNotAllowed) {
       return "UndoNotAllowedForYear";
     }
--- a/src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility_data.xsql	Fri Sep 30 13:09:10 2016 +0200
+++ b/src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility_data.xsql	Fri Sep 30 15:47:22 2016 +0530
@@ -564,10 +564,11 @@
         where y1.c_year_id = ?
         and y1.c_calendar_id = y2.c_calendar_id
         and y1.year>y2.year
-        and not exists (select 1 from ad_org_closing where ad_org_closing.c_year_id = y2.c_year_id)
+        and not exists (select 1 from ad_org_closing where ad_org_closing.c_year_id = y2.c_year_id and ad_org_closing.ad_org_id = ?)
       ]]>
     </Sql>
     <Parameter name="cYearId"/>
+    <Parameter name="cOrgId"/>
   </SqlMethod>
   <SqlMethod name="selectUndoAllowed" type="preparedStatement" return="boolean">
     <SqlMethodComment></SqlMethodComment>