mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
SX Window: correctly show first sx on calendar when it is moved to next weekday
This commit is contained in:
@@ -182,9 +182,6 @@ gdcs_generic_update_recurrences(GncDenseCalStore *trans, GDate *start, GList *re
|
||||
GDate date, next;
|
||||
|
||||
date = *start;
|
||||
/* go one day before what's in the box so we can get the correct start
|
||||
* date. */
|
||||
g_date_subtract_days(&date, 1);
|
||||
recurrenceListNextInstance(recurrences, &date, &next);
|
||||
|
||||
i = 0;
|
||||
|
||||
@@ -1609,9 +1609,15 @@ gnc_sxed_update_cal(GncSxEditorDialog *sxed)
|
||||
&& g_date_valid(&first_date)
|
||||
&& g_date_compare(last_sx_inst, &first_date) != 0)
|
||||
{
|
||||
/* last occurrence will be passed as initial date to update store
|
||||
* later on as well */
|
||||
start_date = *last_sx_inst;
|
||||
recurrenceListNextInstance(recurrences, &start_date, &first_date);
|
||||
}
|
||||
else
|
||||
/* move one day back so the store can get the proper first recurrence. */
|
||||
g_date_subtract_days(&start_date, 1);
|
||||
|
||||
}
|
||||
|
||||
if (!g_date_valid(&first_date))
|
||||
@@ -1637,17 +1643,17 @@ gnc_sxed_update_cal(GncSxEditorDialog *sxed)
|
||||
GDate end_date;
|
||||
g_date_clear (&end_date, 1);
|
||||
gnc_gdate_set_time64 (&end_date, gnc_date_edit_get_date(sxed->endDateEntry));
|
||||
gnc_dense_cal_store_update_recurrences_date_end(sxed->dense_cal_model, &first_date, recurrences, &end_date);
|
||||
gnc_dense_cal_store_update_recurrences_date_end(sxed->dense_cal_model, &start_date, recurrences, &end_date);
|
||||
}
|
||||
else if (gtk_toggle_button_get_active(sxed->optEndNone))
|
||||
{
|
||||
gnc_dense_cal_store_update_recurrences_no_end(sxed->dense_cal_model, &first_date, recurrences);
|
||||
gnc_dense_cal_store_update_recurrences_no_end(sxed->dense_cal_model, &start_date, recurrences);
|
||||
}
|
||||
else if (gtk_toggle_button_get_active(sxed->optEndCount))
|
||||
{
|
||||
gint num_remain
|
||||
= gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sxed->endRemainSpin));
|
||||
gnc_dense_cal_store_update_recurrences_count_end(sxed->dense_cal_model, &first_date, recurrences, num_remain);
|
||||
gnc_dense_cal_store_update_recurrences_count_end(sxed->dense_cal_model, &start_date, recurrences, num_remain);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1587,9 +1587,14 @@ gnc_sxed_update_cal (GncSxEditorDialog2 *sxed)
|
||||
&& g_date_valid (&first_date)
|
||||
&& g_date_compare (last_sx_inst, &first_date) != 0)
|
||||
{
|
||||
/* last occurrence will be passed as initial date to update store
|
||||
* later on as well */
|
||||
start_date = *last_sx_inst;
|
||||
recurrenceListNextInstance (recurrences, &start_date, &first_date);
|
||||
}
|
||||
else
|
||||
/* move one day back so the store can get the proper first recurrence. */
|
||||
g_date_subtract_days(&start_date, 1);
|
||||
}
|
||||
|
||||
if (!g_date_valid (&first_date))
|
||||
@@ -1615,17 +1620,17 @@ gnc_sxed_update_cal (GncSxEditorDialog2 *sxed)
|
||||
GDate end_date;
|
||||
g_date_clear (&end_date, 1);
|
||||
gnc_gdate_set_time64 (&end_date, gnc_date_edit_get_date (sxed->endDateEntry));
|
||||
gnc_dense_cal_store_update_recurrences_date_end (sxed->dense_cal_model, &first_date, recurrences, &end_date);
|
||||
gnc_dense_cal_store_update_recurrences_date_end (sxed->dense_cal_model, &start_date, recurrences, &end_date);
|
||||
}
|
||||
else if (gtk_toggle_button_get_active (sxed->optEndNone))
|
||||
{
|
||||
gnc_dense_cal_store_update_recurrences_no_end (sxed->dense_cal_model, &first_date, recurrences);
|
||||
gnc_dense_cal_store_update_recurrences_no_end (sxed->dense_cal_model, &start_date, recurrences);
|
||||
}
|
||||
else if (gtk_toggle_button_get_active (sxed->optEndCount))
|
||||
{
|
||||
gint num_remain
|
||||
= gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (sxed->endRemainSpin));
|
||||
gnc_dense_cal_store_update_recurrences_count_end (sxed->dense_cal_model, &first_date, recurrences, num_remain);
|
||||
gnc_dense_cal_store_update_recurrences_count_end (sxed->dense_cal_model, &start_date, recurrences, num_remain);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -715,16 +715,17 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti )
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(sxfti->endDateGDE), (get.type == END_ON_DATE) );
|
||||
gtk_widget_set_sensitive( GTK_WIDGET(sxfti->n_occurences), (get.type == END_AFTER_N_OCCS) );
|
||||
|
||||
/* Use the day preceding the start date for the store to find the correct real start date */
|
||||
switch (get.type)
|
||||
{
|
||||
case NEVER_END:
|
||||
gnc_dense_cal_store_update_recurrences_no_end(sxfti->dense_cal_model, &startDate, schedule);
|
||||
gnc_dense_cal_store_update_recurrences_no_end(sxfti->dense_cal_model, &date, schedule);
|
||||
break;
|
||||
case END_ON_DATE:
|
||||
gnc_dense_cal_store_update_recurrences_date_end(sxfti->dense_cal_model, &startDate, schedule, &get.end_date);
|
||||
gnc_dense_cal_store_update_recurrences_date_end(sxfti->dense_cal_model, &date, schedule, &get.end_date);
|
||||
break;
|
||||
case END_AFTER_N_OCCS:
|
||||
gnc_dense_cal_store_update_recurrences_count_end(sxfti->dense_cal_model, &startDate, schedule, get.n_occurrences);
|
||||
gnc_dense_cal_store_update_recurrences_count_end(sxfti->dense_cal_model, &date, schedule, get.n_occurrences);
|
||||
break;
|
||||
default:
|
||||
g_warning("unknown get.type [%d]\n", get.type);
|
||||
|
||||
Reference in New Issue
Block a user