details:   https://code.openbravo.com/erp/devel/pi/rev/5cffde20b3b1
changeset: 30350:5cffde20b3b1
user:      Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
date:      Fri Sep 30 13:09:10 2016 +0200
summary:   Related to issue 34068: Code review improvements

details:   https://code.openbravo.com/erp/devel/pi/rev/3184adb3f998
changeset: 30351:3184adb3f998
user:      Sanjota <sanjota.nelagi <at> promantia.com>
date:      Fri Sep 30 15:47:22 2016 +0530
summary:   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.

diffstat:

 src-db/database/model/functions/M_UPDATE_STOCK_VALUATION.xml              |  4 
++--
 src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility.java      |  6 
++++--
 src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility_data.xsql |  3 
++-
 3 files changed, 8 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r 79f4c2e75d1f -r 3184adb3f998 
src-db/database/model/functions/M_UPDATE_STOCK_VALUATION.xml
--- a/src-db/database/model/functions/M_UPDATE_STOCK_VALUATION.xml      Thu Sep 
29 14:59:52 2016 -0400
+++ b/src-db/database/model/functions/M_UPDATE_STOCK_VALUATION.xml      Fri Sep 
30 15:47:22 2016 +0530
@@ -90,8 +90,8 @@
   END IF;
   IF (v_count > 0) THEN
     UPDATE m_stock_valuation
-    SET stock = stock + p_stock,
-        stock_valuation = (CASE WHEN v_stock = 0 THEN 0 ELSE stock_valuation + 
p_valuation END),
+    SET stock = v_stock,
+        stock_valuation = v_valuation,
         unit_price = v_unit_price
     WHERE ad_client_id = p_client
       AND ad_org_id = p_org
diff -r 79f4c2e75d1f -r 3184adb3f998 
src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility.java
--- a/src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility.java      
Thu Sep 29 14:59:52 2016 -0400
+++ 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";
     }
diff -r 79f4c2e75d1f -r 3184adb3f998 
src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility_data.xsql
--- a/src/org/openbravo/erpCommon/businessUtility/EndYearCloseUtility_data.xsql 
Thu Sep 29 14:59:52 2016 -0400
+++ 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>

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to