From c482d618c44dec00768115db08ad475e0b3d8a3f Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Mon, 4 Aug 2003 01:32:07 +0000 Subject: [PATCH] * src/gnome/druid-loan.c: Apply patch to fix a number of off-by-one bugs in the loan druid. Fixes #119001. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8988 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 5 +++++ src/gnome/druid-loan.c | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e1c33b8e7..b514b536fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-08-03 Derek Atkins + + * src/gnome/druid-loan.c: Apply patch to fix a number of + off-by-one bugs in the loan druid. Fixes #119001. + 2003-07-30 Derek Atkins * src/gnome-utils/gnc-account-tree.c: add "(Report)" strings diff --git a/src/gnome/druid-loan.c b/src/gnome/druid-loan.c index e7d44b7b08..14494aeb49 100644 --- a/src/gnome/druid-loan.c +++ b/src/gnome/druid-loan.c @@ -2195,16 +2195,17 @@ ld_create_sxes( LoanDruidData *ldd ) paymentSX->name = g_strdup(ldd->ld.repMemo); paymentSX->start = *ldd->ld.startDate; paymentSX->last = *ldd->ld.repStartDate; + g_date_subtract_months( &paymentSX->last, 1 ); { paymentSX->end = *ldd->ld.repStartDate; - g_date_add_months( &paymentSX->end, ldd->ld.numMonRemain ); + g_date_add_months( &paymentSX->end, ldd->ld.numMonRemain - 1); } paymentSX->freq = ldd->ld.repFreq; /* Figure out the correct current instance-count for the txns in the * SX. */ paymentSX->instNum = (ldd->ld.numPer * ( ldd->ld.perSize == YEARS ? 12 : 1 )) - - ldd->ld.numMonRemain; + - ldd->ld.numMonRemain + 1; paymentSX->mainTxn = gnc_ttinfo_malloc(); gnc_ttinfo_set_currency( paymentSX->mainTxn, @@ -2486,7 +2487,7 @@ ld_get_loan_range( LoanDruidData *ldd, GDate *start, GDate *end ) *start = *ldd->ld.startDate; *end = *start; g_date_add_months( end, - ldd->ld.numPer + ldd->ld.numPer - 1 * ( ldd->ld.perSize == MONTHS ? 1 : 12 ) ); } @@ -2590,7 +2591,7 @@ ld_rev_recalc_schedule( LoanDruidData *ldd ) g_date_subtract_days( &curDate, 1 ); xaccFreqSpecGetNextInstance( ldd->ld.repFreq, &curDate, &curDate ); - for ( i=0; + for ( i=1; g_date_valid( &curDate ) && g_date_compare( &curDate, &end ) <= 0 ; i++,