Bug 796725 - 4 of 6 Date Posted options fail to return

matching transactions.

gnc_date_edit_get_date returns the time64 value set to 00:00:00 for the
day entered so for the LTE and GT options gnc_date_edit_get_date_end
needs to be used for 23:59:59. For finding transactions on the date,
the use of QOF_DATE_MATCH_DAY needs to be used.
pull/399/head
Robert Fewell 8 years ago
parent 14335b7862
commit 39b24325d9

@ -178,10 +178,23 @@ gncs_validate (GNCSearchCoreType *fe)
return valid;
}
static void
gnc_search_date_set_date_from_edit (GNCSearchDate *fe, GNCDateEdit *de)
{
/* The gnc_date_edit_get_date function returns a value set to the
* start of the day 00:00:00, use gnc_date_edit_get_date_end to get
* value for day end 23:59:59 for LessThanEqual and GreaterThan */
if (fe->how == QOF_COMPARE_LTE || fe->how == QOF_COMPARE_GT)
fe->tt = gnc_date_edit_get_date_end (de);
else
fe->tt = gnc_date_edit_get_date (de);
}
static void
date_changed (GNCDateEdit *date_edit, GNCSearchDate *fe)
{
fe->tt = gnc_date_edit_get_date (date_edit);
gnc_search_date_set_date_from_edit (fe, date_edit);
}
static GtkWidget *
@ -272,9 +285,12 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
/* Make sure we actually use the currently-entered date */
priv = _PRIVATE(fi);
if (priv->entry)
fi->tt = gnc_date_edit_get_date (GNC_DATE_EDIT (priv->entry));
gnc_search_date_set_date_from_edit (fi, GNC_DATE_EDIT (priv->entry));
return qof_query_date_predicate (fi->how, QOF_DATE_MATCH_NORMAL, fi->tt);
if (fi->how == QOF_COMPARE_EQUAL || fi->how == QOF_COMPARE_NEQ)
return qof_query_date_predicate (fi->how, QOF_DATE_MATCH_DAY, fi->tt);
else
return qof_query_date_predicate (fi->how, QOF_DATE_MATCH_NORMAL, fi->tt);
}
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)

Loading…
Cancel
Save