details:   https://code.openbravo.com/erp/devel/pi/rev/908de9299675
changeset: 26421:908de9299675
user:      Fernando Soto <fernando.soto <at> peoplewalking.com>
date:      Mon Mar 23 14:11:56 2015 -0500
summary:   Fixed bug 28952: Period Not Updated in G/L Journal if Acct Date 
belongs to a closed period.

Modified SL_Journal_Period class (callout) to display a error message if the 
Acct. Date belongs to a closed period.
Modified GL_JOURNAL_CHK_RESTRICT_TRG trigger to not allow to save if the Acct. 
Date belongs to a closed period.
Created UpdateGLJournalDateAcct to fix the data.

details:   https://code.openbravo.com/erp/devel/pi/rev/17cd117fb31b
changeset: 26422:17cd117fb31b
user:      Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
date:      Tue May 05 18:10:20 2015 +0200
summary:   Related to issue 28952: Code review

Remove unused lines of code

diffstat:

 src-db/database/model/triggers/GL_JOURNAL_CHK_RESTRICT_TRG.xml |  15 ++++++-
 src/org/openbravo/erpCommon/ad_callouts/SL_Journal_Period.java |  18 ++++++++-
 2 files changed, 28 insertions(+), 5 deletions(-)

diffs (70 lines):

diff -r b509a9c376d0 -r 17cd117fb31b 
src-db/database/model/triggers/GL_JOURNAL_CHK_RESTRICT_TRG.xml
--- a/src-db/database/model/triggers/GL_JOURNAL_CHK_RESTRICT_TRG.xml    Fri Mar 
27 15:57:12 2015 -0500
+++ b/src-db/database/model/triggers/GL_JOURNAL_CHK_RESTRICT_TRG.xml    Tue May 
05 18:10:20 2015 +0200
@@ -19,12 +19,11 @@
     * under the License.
     * The Original Code is Openbravo ERP.
     * The Initial Developer of the Original Code is Openbravo SLU
-    * All portions are Copyright (C) 2001-2012 Openbravo SLU
+    * All portions are Copyright (C) 2001-2015 Openbravo SLU
     * All Rights Reserved.
     * Contributor(s):  ______________________________________.
     ************************************************************************/
-    v_DateNull DATE := TO_DATE('01-01-1900', 'DD-MM-YYYY');
-        
+    v_DateNull DATE := TO_DATE('01-01-1900', 'DD-MM-YYYY');  
 BEGIN
     
     IF AD_isTriggerEnabled()='N' THEN RETURN;
@@ -59,6 +58,13 @@
         )) 
         THEN RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
       END IF;    
+
+      
+      IF (:old.DateAcct <> :new.DateAcct and 
+        c_chk_open_period(:new.AD_ORG_ID, :new.DATEACCT, null, 
:new.C_DOCTYPE_ID) <> 1) THEN 
+        RAISE_APPLICATION_ERROR(-20000, '@PeriodNotValid@');
+      END IF;
+
     END IF;
     IF(DELETING) THEN
       IF(:old.Processed='Y') THEN
@@ -69,6 +75,9 @@
       IF(:NEW.Processed='Y') THEN
         RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
       END IF;
+      IF (c_chk_open_period(:new.AD_ORG_ID, :new.DATEACCT, null, 
:new.C_DOCTYPE_ID) <> 1) THEN 
+        RAISE_APPLICATION_ERROR(-20000, '@PeriodNotValid@');
+      END IF;
     END IF;
     END GL_JOURNAL_CHK_RESTRICT_TRG
 ]]></body>
diff -r b509a9c376d0 -r 17cd117fb31b 
src/org/openbravo/erpCommon/ad_callouts/SL_Journal_Period.java
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Journal_Period.java    Fri Mar 
27 15:57:12 2015 -0500
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Journal_Period.java    Tue May 
05 18:10:20 2015 +0200
@@ -103,8 +103,22 @@
     // When DateAcct is changed, set C_Period_ID
     if (strChanged.equals("inpdateacct")) {
       strcPeriodId = SLJournalPeriodData.period(this, stradClientId, 
stradOrgId, strDateAcct);
-      if (strcPeriodId.equals(""))
-        strcPeriodId = strcPeriodIdNew;
+      if (strcPeriodId.equals("")) {
+        StringBuffer resultado = new StringBuffer();
+        resultado.append("var calloutName='SL_Journal_Period';\n\n");
+        resultado.append("var respuesta = new Array(");
+        resultado.append("new Array(\"ERROR\", \""
+            + Utility.messageBD(this, "PeriodNotValid", vars.getLanguage()) + 
"\")");
+        resultado.append(");");
+        xmlDocument.setParameter("array", resultado.toString());
+        xmlDocument.setParameter("frameName", "appFrame");
+        response.setContentType("text/html; charset=UTF-8");
+        PrintWriter out = response.getWriter();
+        out.println(xmlDocument.print());
+        out.close();
+        return;
+      }
+
     }
     boolean isStandardPeriod = true;
     if (strChanged.equals("inpcPeriodId") && !strcPeriodId.equals("")) {

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to