Fixes issue 29884: Error while completing a Simple G/L Journal in Oracle
authorAlvaro Ferraz <alvaro.ferraz@openbravo.com>
Thu, 14 May 2015 14:20:33 +0200
changeset 26698 cca5b0c34a32
parent 26697 cbea2f4da446
child 26699 c279b5411456
Fixes issue 29884: 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
src-db/database/model/functions/GL_JOURNAL_POST.xml
--- a/src-db/database/model/functions/GL_JOURNAL_POST.xml	Thu May 14 17:24:16 2015 +0200
+++ b/src-db/database/model/functions/GL_JOURNAL_POST.xml	Thu May 14 14:20:33 2015 +0200
@@ -263,13 +263,12 @@
           RAISE_APPLICATION_ERROR(-20000, '@ForcedOrgNotMatchDocument@');
         END IF;
       END LOOP;
-
-      SELECT ad_org_id
+      
+      SELECT gl_journalbatch.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@');