Fix occasional not working "up / down" arrow in invoice window.

This was because the "date" field was indeed be set with a different
time of day (noon vs. start of day), depending on the various code
places.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21562 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2011-11-11 21:58:36 +00:00
parent 3a4cd615e8
commit 5e1dde2018

View File

@ -1004,10 +1004,26 @@ void gnc_entry_ledger_move_current_entry_updown (GncEntryLedger *ledger,
* up the current sort ordering from here, so I cowardly refuse to
* tweak the EntryDate in this case. */
{
Timespec t1 = gncEntryGetDate(current),
t2 = gncEntryGetDate(target);
if (!timespec_equal(&t1, &t2))
Timespec t1, t2;
GDate d1 = gncEntryGetDateGDate(current),
d2 = gncEntryGetDateGDate(target);
if (g_date_compare(&d1, &d2) != 0)
return;
/* Special treatment if the equality doesn't hold if we access the
dates as timespec. See the comment in gncEntrySetDateGDate() for the
reason: Some code used the timespec at noon for the EntryDate, other
code used the timespec at the start of day. */
t1 = gncEntryGetDate(current);
t2 = gncEntryGetDate(target);
if (!timespec_equal(&t1, &t2))
{
/* Timespecs are not equal, even though the GDates were equal? Then
we set the GDates again. This will force the timespecs to be equal
as well. */
gncEntrySetDateGDate(current, &d1);
gncEntrySetDateGDate(target, &d2);
}
}
/*g_warning("Ok, current desc='%s' target desc='%s'",