Related to bug 29884: Code Review
authorUnai Martirena <unai.martirena@openbravo.com>
Mon, 18 May 2015 17:30:26 +0200
changeset 26699 c279b5411456
parent 26698 cca5b0c34a32
child 26700 ba8075e92bef
Related to bug 29884: 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
src-db/database/model/functions/GL_JOURNAL_POST.xml
--- a/src-db/database/model/functions/GL_JOURNAL_POST.xml	Thu May 14 14:20:33 2015 +0200
+++ b/src-db/database/model/functions/GL_JOURNAL_POST.xml	Mon May 18 17:30:26 2015 +0200
@@ -264,7 +264,7 @@
         END IF;
       END LOOP;
       
-      SELECT gl_journalbatch.ad_org_id
+      SELECT COALESCE(gl_journalbatch.ad_org_id, gl_journal.ad_org_id)
       INTO v_BatchOrg_ID
       FROM gl_journal LEFT JOIN gl_journalbatch
       ON gl_journal.gl_journalbatch_id = gl_journalbatch.gl_journalbatch_id