details:   https://code.openbravo.com/erp/devel/pi/rev/fbadcf337117
changeset: 22331:fbadcf337117
user:      Pandeeswari Ramakrishnan <pandeeswari.ramakrishnan <at> 
openbravo.com>
date:      Tue Feb 25 11:23:37 2014 +0530
summary:   Fixes Issue 24938: Reset accounting process doesn't work with date 
from and periods in the future

diffstat:

 src/org/openbravo/financial/ResetAccounting.java |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (21 lines):

diff -r ee9a0da05d43 -r fbadcf337117 
src/org/openbravo/financial/ResetAccounting.java
--- a/src/org/openbravo/financial/ResetAccounting.java  Mon Mar 03 12:13:55 
2014 +0100
+++ b/src/org/openbravo/financial/ResetAccounting.java  Tue Feb 25 11:23:37 
2014 +0530
@@ -367,13 +367,13 @@
     }
     String myQuery = "select distinct p from FinancialMgmtPeriodControl e left 
join e.period p left join p.year y left join y.calendar c where c.id = 
:calendarId and e.client.id = :clientId and e.documentCategory = :docbasetype 
and e.periodStatus = 'O' and e.organization.id = :orgPeriodControl";
 
-    if (!("".equals(datefrom))) {
+    if (!("".equals(datefrom)) && !("".equals(dateto))) {
       myQuery = myQuery + " and p.startingDate <= :dateFrom";
+      myQuery = myQuery + " and p.endingDate >= :dateTo";
+    } else if (!("".equals(datefrom)) && ("".equals(dateto))) {
       myQuery = myQuery + " and p.endingDate >= :dateFrom";
-    }
-    if (!("".equals(dateto))) {
+    } else if (("".equals(datefrom)) && !("".equals(dateto))) {
       myQuery = myQuery + " and p.startingDate <= :dateTo";
-      myQuery = myQuery + " and p.endingDate >= :dateTo";
     }
     Query query = OBDal.getInstance().getSession().createQuery(myQuery);
     // TODO: Review orgIds

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to