Bug #652193 - Upcoming Scheduled Transactions Calendar Starting Month

Error

Patch by Rich

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20746 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2011-06-10 13:31:58 +00:00
parent ae7a9c74e2
commit b7643ad64a

View File

@ -1724,6 +1724,7 @@ gdc_add_tag_markings(GncDenseCal *cal, guint tag)
gchar *name, *info; gchar *name, *info;
gint num_marks, idx; gint num_marks, idx;
GDate **dates; GDate **dates;
GDate *calDate;
// copy the values into the old marking function. // copy the values into the old marking function.
name = gnc_dense_cal_model_get_name(cal->model, tag); name = gnc_dense_cal_model_get_name(cal->model, tag);
@ -1734,14 +1735,19 @@ gdc_add_tag_markings(GncDenseCal *cal, guint tag)
goto cleanup; goto cleanup;
dates = g_new0(GDate*, num_marks); dates = g_new0(GDate*, num_marks);
calDate = g_date_new_dmy(1, cal->month, cal->year);
for (idx = 0; idx < num_marks; idx++) for (idx = 0; idx < num_marks; idx++)
{ {
dates[idx] = g_date_new(); dates[idx] = g_date_new();
gnc_dense_cal_model_get_instance(cal->model, tag, idx, dates[idx]); gnc_dense_cal_model_get_instance(cal->model, tag, idx, dates[idx]);
} }
_gnc_dense_cal_set_month(cal, g_date_get_month(dates[0]), FALSE); if(g_date_get_julian(dates[0]) < g_date_get_julian(calDate))
_gnc_dense_cal_set_year(cal, g_date_get_year(dates[0]), FALSE); {
_gnc_dense_cal_set_month(cal, g_date_get_month(dates[0]), FALSE);
_gnc_dense_cal_set_year(cal, g_date_get_year(dates[0]), FALSE);
}
gdc_mark_add(cal, tag, name, info, num_marks, dates); gdc_mark_add(cal, tag, name, info, num_marks, dates);
@ -1750,7 +1756,8 @@ gdc_add_tag_markings(GncDenseCal *cal, guint tag)
g_date_free(dates[idx]); g_date_free(dates[idx]);
} }
g_free(dates); g_free(dates);
g_date_free(calDate);
cleanup: cleanup:
g_free(info); g_free(info);
} }