Merge Jean Laroche's 'Fix-3-SX-Problems' into maint

https://github.com/Gnucash/gnucash/pull/690
This commit is contained in:
John Ralls 2020-04-25 14:40:57 -07:00
commit 63232f388f
4 changed files with 12 additions and 11 deletions

View File

@ -1939,10 +1939,13 @@ gdc_model_added_cb(GncDenseCalModel *model, guint added_tag, gpointer user_data)
static void static void
gdc_model_update_cb(GncDenseCalModel *model, guint update_tag, gpointer user_data) gdc_model_update_cb(GncDenseCalModel *model, guint update_tag, gpointer user_data)
{ {
GncDenseCal *cal = GNC_DENSE_CAL(user_data); GncDenseCal *cal = GNC_DENSE_CAL (user_data);
g_debug("gdc_model_update_cb update for tag [%d]\n", update_tag); gint num_marks = 0;
gdc_mark_remove(cal, update_tag, FALSE); g_debug ("gdc_model_update_cb update for tag [%d]\n", update_tag);
gdc_add_tag_markings(cal, update_tag); num_marks = gnc_dense_cal_model_get_instance_count (cal->model, update_tag);
// We need to redraw if there are no mark, to ensure they're all erased.
gdc_mark_remove (cal, update_tag, num_marks==0);
gdc_add_tag_markings (cal, update_tag);
} }

View File

@ -1598,7 +1598,6 @@ gnc_sxed_update_cal(GncSxEditorDialog *sxed)
g_date_clear(&start_date, 1); g_date_clear(&start_date, 1);
gnc_frequency_save_to_recurrence(sxed->gncfreq, &recurrences, &start_date); gnc_frequency_save_to_recurrence(sxed->gncfreq, &recurrences, &start_date);
g_date_subtract_days(&start_date, 1);
recurrenceListNextInstance(recurrences, &start_date, &first_date); recurrenceListNextInstance(recurrences, &start_date, &first_date);
/* Deal with the fact that this SX may have been run before [the /* Deal with the fact that this SX may have been run before [the
@ -1609,10 +1608,10 @@ gnc_sxed_update_cal(GncSxEditorDialog *sxed)
last_sx_inst = xaccSchedXactionGetLastOccurDate(sxed->sx); last_sx_inst = xaccSchedXactionGetLastOccurDate(sxed->sx);
if (g_date_valid(last_sx_inst) if (g_date_valid(last_sx_inst)
&& g_date_valid(&first_date) && g_date_valid(&first_date)
&& g_date_compare(last_sx_inst, &first_date) != 0) && g_date_compare(last_sx_inst, &first_date) > 0)
{ {
/* last occurrence will be passed as initial date to update store /* last occurrence will be passed as initial date to update store
* later on as well */ * later on as well, but only if it's past first_date */
start_date = *last_sx_inst; start_date = *last_sx_inst;
recurrenceListNextInstance(recurrences, &start_date, &first_date); recurrenceListNextInstance(recurrences, &start_date, &first_date);
} }

View File

@ -809,7 +809,6 @@ gnc_ledger_display2_internal (Account *lead_account, Query *q,
ld->use_double_line_default = use_double_line; ld->use_double_line_default = use_double_line;
// JEAN: add mismatched_commodities
ld->model = gnc_tree_model_split_reg_new (reg_type, style, use_double_line, is_template, mismatched_commodities); ld->model = gnc_tree_model_split_reg_new (reg_type, style, use_double_line, is_template, mismatched_commodities);
gnc_tree_model_split_reg_set_data (ld->model, ld, gnc_ledger_display2_parent); gnc_tree_model_split_reg_set_data (ld->model, ld, gnc_ledger_display2_parent);

View File

@ -931,13 +931,13 @@ xaccSchedXactionGetNextInstance (const SchedXaction *sx, SXTmpStateData *tsd)
* we're at the beginning. We want to pretend prev_occur is the day before * we're at the beginning. We want to pretend prev_occur is the day before
* the start_date in case the start_date is today so that the SX will fire * the start_date in case the start_date is today so that the SX will fire
* today. If start_date isn't valid either then the SX will fire anyway, no * today. If start_date isn't valid either then the SX will fire anyway, no
* harm done. * harm done. prev_occur cannot be before start_date either.
*/ */
if (! g_date_valid( &prev_occur ) && g_date_valid(&sx->start_date)) if (g_date_valid (&sx->start_date) && (!g_date_valid ( &prev_occur ) || g_date_compare (&prev_occur, &sx->start_date)<0))
{ {
/* We must be at the beginning. */ /* We must be at the beginning. */
prev_occur = sx->start_date; prev_occur = sx->start_date;
g_date_subtract_days( &prev_occur, 1 ); g_date_subtract_days (&prev_occur, 1 );
} }
recurrenceListNextInstance(sx->schedule, &prev_occur, &next_occur); recurrenceListNextInstance(sx->schedule, &prev_occur, &next_occur);