Bug 290059

Summary: Schedules moved to next processing day not shown correctly
Product: [Applications] kmymoney Reporter: David Houlden <djhoulden>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: iann_bugzilla
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Proposed patch to solve the problem
Improved patch to solve the problem

Description David Houlden 2011-12-28 23:31:27 UTC
Version:           git master (using KDE 4.5.5) 
OS:                Linux

This has a lot in common with bug 262945. Some of what I described on that bug was fixed (the home page part) but other problems remain and I have found an additional problem.

I have a monthly schedule set up for a payment on the 15th of each month. This
schedule is coming to an end and the last payment is due on 15th Jan which is a Sunday. The first thing I noticed was that the payment was not being picked up by a cash flow forecast report configured to look out 30 days. I opened the schedule editor and it is set up like this.
Frequency: 1 month
Type: Withdrawal
Next Due Date: 15/01/2012
If schedule falls on a non processing day change to next processing day.
Amount is an estimate: Not selected.
Enter schedule automatically: Selected.
Schedule will end at some time: Selected.
Number of transactions remaining: 0.  (This doesn't look right)
Date of final transaction: 15/01/2012.

In the schedule editor I changed the option for a non processing day to be "Do
nothing" and saved the schedule. Now, the payment appears on the cash flow forecast report. The schedule editor now shows 1 transaction remaining with a
final transaction date of 15/01/2011 which is all correct. Selecting the option 
to move to next processing day shows the bug again, it no longer appears
on the report and shows zero transactions remaining.

Reproducible: Always

Steps to Reproduce:
As described above.

Actual Results:  
Schedule not picked up by report and shows zero transactions remaining in schedule editor.

Expected Results:  
Schedule should be picked up by report and should show one transaction remaining.
Comment 1 Ian Neal 2011-12-29 00:22:16 UTC
Could you see if the patch on bug 289306 helps in any way?
Comment 2 Ian Neal 2011-12-29 00:24:31 UTC
Sorry on review board http://git.reviewboard.kde.org/r/103456/ for bug 289306 (it would be nice if bugs linked to review board requests as well as the existing way round from review boards to bugs)
Comment 3 David Houlden 2011-12-29 11:21:20 UTC
Hi Ian, I applied those patches but I still see the same problems I described above.
Comment 4 Thomas Baumgart 2012-01-01 13:01:14 UTC
I identified the problem and enhanced the testcase to trigger the problem. Code of the testcase is in git master.
Comment 5 Thomas Baumgart 2012-01-01 13:22:30 UTC
Created attachment 67298 [details]
Proposed patch to solve the problem

Can you please try if the attached patch a) solves the problem and b) does not cause other trouble like on the home page and report back here? Thanks in advance. As a side effect,
Comment 6 David Houlden 2012-01-01 22:17:11 UTC
Thomas, thanks for the patch which I have applied.

The report now picks up the schedule correctly. However, the schedule editor still shows zero schedules remaining instead of one.

I haven't seen any other problems but I have a number of schedules due over the next three days so I will watch those carefully and report back.

By the way, your comment #5 appears to have been truncated. What's the side effect? Is it good or bad ;-)
Comment 7 Thomas Baumgart 2012-01-02 09:03:29 UTC
Thanks for the hint on my comment #5 . Maybe caused by a Ctrl+V into the wrong window ;) So for the records, that unfinished sentence should not be there at all.

I'll take a look into the schedule editor issue then.
Comment 8 Thomas Baumgart 2012-01-02 10:41:03 UTC
Created attachment 67333 [details]
Improved patch to solve the problem

This should solve the problem with the number of payments if the series ends on a non-processing day and is moved forward. BTW: the testcases are updated in git master already and should fail w/o the patch.
Comment 9 David Houlden 2012-01-02 11:48:14 UTC
Thanks Thomas. All looks ok now. As mentioned, I have some schedules which should get automatically added to the ledger over the next couple of days so I will monitor those.
Comment 10 David Houlden 2012-01-04 11:42:32 UTC
My schedules have processed as expected so I think this patch can be committed at your convenience.
Comment 11 Thomas Baumgart 2012-01-04 16:35:41 UTC
Git commit e26cd48e69abdacdc6fae8aa7f6a6b9775173841 by Thomas Baumgart.
Committed on 04/01/2012 at 17:32.
Pushed by tbaumgart into branch 'master'.

Fix schedule handling

M  +5    -3    kmymoney/mymoney/mymoneyscheduled.cpp

http://commits.kde.org/kmymoney/e26cd48e69abdacdc6fae8aa7f6a6b9775173841
Comment 12 Thomas Baumgart 2012-01-04 16:37:31 UTC
Git commit fa2e67d3ff855a8cb33adee0c49ff06793e20834 by Thomas Baumgart.
Committed on 04/01/2012 at 17:32.
Pushed by tbaumgart into branch '4.6'.

Fix schedule handling
(cherry picked from commit e26cd48e69abdacdc6fae8aa7f6a6b9775173841)

M  +5    -3    kmymoney/mymoney/mymoneyscheduled.cpp

http://commits.kde.org/kmymoney/fa2e67d3ff855a8cb33adee0c49ff06793e20834