details:   https://code.openbravo.com/erp/devel/pi/rev/ebcfc346fd6c
changeset: 26646:ebcfc346fd6c
user:      Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
date:      Thu May 14 14:20:33 2015 +0200
summary:   Fixes issue 29256: Error while completing a Simple G/L Journal in 
Oracle

A query in gl_journal_post has been changed to avoid errors in Oracle when 
retrieving a null id

details:   https://code.openbravo.com/erp/devel/pi/rev/c78dcaae7239
changeset: 26647:c78dcaae7239
user:      Unai Martirena <unai.martirena <at> openbravo.com>
date:      Mon May 18 16:50:47 2015 +0200
summary:   Related to bug 29256: Code Review

Add coalesce in case there is no batch associated to set GL Journal Org, in 
order to avoid issues in the if condition done right after the query if null 
values are compared

diffstat:

 src-db/database/model/functions/GL_JOURNAL_POST.xml |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (22 lines):

diff -r 03198cfe71df -r c78dcaae7239 
src-db/database/model/functions/GL_JOURNAL_POST.xml
--- a/src-db/database/model/functions/GL_JOURNAL_POST.xml       Mon May 18 
11:06:08 2015 +0200
+++ b/src-db/database/model/functions/GL_JOURNAL_POST.xml       Mon May 18 
16:50:47 2015 +0200
@@ -263,13 +263,12 @@
           RAISE_APPLICATION_ERROR(-20000, '@ForcedOrgNotMatchDocument@');
         END IF;
       END LOOP;
-
-      SELECT ad_org_id
+      
+      SELECT COALESCE(gl_journalbatch.ad_org_id, gl_journal.ad_org_id)
       INTO v_BatchOrg_ID
-      FROM gl_journalbatch
-      WHERE gl_journalbatch_id = (select gl_journalbatch_id
-                                 from gl_journal
-                                 where gl_journal_id = v_Record_id);
+      FROM gl_journal LEFT JOIN gl_journalbatch
+      ON gl_journal.gl_journalbatch_id = gl_journalbatch.gl_journalbatch_id
+      WHERE gl_journal.gl_journal_id = v_Record_id;
       
       IF (v_BatchOrg_ID <> v_AD_Org_ID) THEN
         RAISE_APPLICATION_ERROR(-20000, '@BatchAndHeaderDifferentOrg@');

------------------------------------------------------------------------------
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