details:   https://code.openbravo.com/erp/devel/pi/rev/a7e06ff77409
changeset: 16910:a7e06ff77409
user:      Ioritz Cia <ioritz.cia <at> openbravo.com>
date:      Mon Jun 25 13:22:26 2012 +0200
summary:   Fixes issue 20183: gl journal is checked like posted when there is 
not lines.
Works fine either in postgres or in oracle.

diffstat:

 src-db/database/model/functions/GL_JOURNAL_POST.xml |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r eae0b8fe7555 -r a7e06ff77409 
src-db/database/model/functions/GL_JOURNAL_POST.xml
--- a/src-db/database/model/functions/GL_JOURNAL_POST.xml       Mon Jun 25 
13:11:14 2012 +0200
+++ b/src-db/database/model/functions/GL_JOURNAL_POST.xml       Mon Jun 25 
13:22:26 2012 +0200
@@ -58,7 +58,6 @@
     v_ControlAmt GL_Journal.ControlAmt%TYPE;
     FINISH_PROCESS BOOLEAN:=false;
     v_is_included NUMBER:=0;
-    v_has_lines NUMBER:=-1;
     v_available_period NUMBER:=0;
     v_is_ready AD_Org.IsReady%TYPE;
     v_is_tr_allow AD_OrgType.IsTransactionsAllowed%TYPE;
@@ -208,13 +207,18 @@
 
       -- Check if the gl journal has lines.
      
-      SELECT 1, documentNo INTO v_has_lines, v_documentNo
+      SELECT max(documentNo) INTO v_documentNo
       FROM GL_Journal
       WHERE EXISTS (SELECT 1
                     FROM GL_JournalLine
                     WHERE GL_JournalLine.GL_Journal_ID = 
GL_Journal.GL_Journal_ID
                     AND GL_JournalLine.GL_Journal_ID = v_Record_ID);
-      IF (v_has_lines=-1) THEN
+
+      IF (v_documentno IS NULL) THEN
+        SELECT documentNo INTO v_documentNo
+        FROM GL_Journal
+        WHERE GL_Journal_ID = v_Record_ID;
+        
         RAISE_APPLICATION_ERROR(-20000, '@GLJournalHasNoLines@' || ' ' || 
v_DocumentNo);
       END IF;
       

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to