mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-11-02 20:30:45 -06:00
Reapply filter when number of sub-accounts change
When viewing a register that displays sub-accounts, if the number of sub-accounts is changed, the query is rebuilt from the remaining sub-accounts but when a filter is being used it is not applied after. Fixed by checking the original query for a filter and if so applying that after query rebuilt.
This commit is contained in:
1 parent
0de4ce1106
commit
8bd7deb3dc
5 files changed
+80
-2
No files matched your search
@@ -502,6 +502,44 @@ xaccQueryAddClearedMatch(QofQuery * q, cleared_match_t how, QofQueryOp op)
|
||||
qof_query_add_term (q, param_list, pred_data, op);
|
||||
}
|
||||
|
||||
cleared_match_t
|
||||
xaccQueryGetClearedMatch(QofQuery * q)
|
||||
{
|
||||
QofQueryPredData *term_data;
|
||||
cleared_match_t cleared_match = CLEARED_ALL;
|
||||
GSList *param_list;
|
||||
GSList *terms, *tmp;
|
||||
char *chars = nullptr;
|
||||
|
||||
param_list = qof_query_build_param_list (SPLIT_RECONCILE, nullptr);
|
||||
terms = qof_query_get_term_type (q, param_list);
|
||||
g_slist_free (param_list);
|
||||
|
||||
for (tmp = terms; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
term_data = static_cast<QofQueryPredData*>(tmp->data);
|
||||
|
||||
if (qof_query_char_predicate_get_char (term_data, &chars))
|
||||
{
|
||||
cleared_match = CLEARED_NONE;
|
||||
|
||||
if (strstr (chars, "c"))
|
||||
cleared_match = (cleared_match_t)(cleared_match | CLEARED_CLEARED);
|
||||
if (strstr (chars, "y"))
|
||||
cleared_match = (cleared_match_t)(cleared_match | CLEARED_RECONCILED);
|
||||
if (strstr (chars, "f"))
|
||||
cleared_match = (cleared_match_t)(cleared_match | CLEARED_FROZEN);
|
||||
if (strstr (chars, "n"))
|
||||
cleared_match = (cleared_match_t)(cleared_match | CLEARED_NO);
|
||||
if (strstr (chars, "v"))
|
||||
cleared_match = (cleared_match_t)(cleared_match | CLEARED_VOIDED);
|
||||
}
|
||||
}
|
||||
g_slist_free (terms);
|
||||
|
||||
return cleared_match;
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddGUIDMatch(QofQuery * q, const GncGUID *guid,
|
||||
QofIdType id_type, QofQueryOp op)
|
||||
@@ -532,8 +570,8 @@ xaccQueryAddGUIDMatch(QofQuery * q, const GncGUID *guid,
|
||||
void
|
||||
xaccQueryAddClosingTransMatch(QofQuery *q, gboolean value, QofQueryOp op)
|
||||
{
|
||||
GSList *param_list;
|
||||
|
||||
GSList *param_list;
|
||||
|
||||
param_list = qof_query_build_param_list(SPLIT_TRANS, TRANS_IS_CLOSING, nullptr);
|
||||
qof_query_add_boolean_match(q, param_list, value, op);
|
||||
}
|
||||
|
||||
@@ -180,6 +180,8 @@ typedef enum
|
||||
} cleared_match_t;
|
||||
|
||||
void xaccQueryAddClearedMatch(QofQuery * q, cleared_match_t how, QofQueryOp op);
|
||||
cleared_match_t xaccQueryGetClearedMatch(QofQuery * q);
|
||||
|
||||
void xaccQueryAddGUIDMatch(QofQuery * q, const GncGUID *guid,
|
||||
QofIdType id_type, QofQueryOp op);
|
||||
|
||||
|
||||
@@ -1205,6 +1205,18 @@ qof_query_char_predicate (QofCharMatch options, const char *chars)
|
||||
return ((QofQueryPredData*)pdata);
|
||||
}
|
||||
|
||||
gboolean
|
||||
qof_query_char_predicate_get_char (const QofQueryPredData *pd, char **chars)
|
||||
{
|
||||
const query_char_t pdata = (const query_char_t)pd;
|
||||
|
||||
if (pdata->pd.type_name != query_char_type)
|
||||
return FALSE;
|
||||
|
||||
*chars = g_strdup (pdata->char_list);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static char *
|
||||
char_to_string (gpointer object, QofParam *getter)
|
||||
{
|
||||
|
||||
@@ -184,6 +184,8 @@ void qof_query_core_predicate_free (QofQueryPredData *pdata);
|
||||
|
||||
/** Retrieve a predicate. */
|
||||
gboolean qof_query_date_predicate_get_date (const QofQueryPredData *pd, time64 *date);
|
||||
gboolean qof_query_char_predicate_get_char (const QofQueryPredData *pd, char **chars);
|
||||
|
||||
/** Return a printable string for a core data object. Caller needs
|
||||
* to g_free() the returned string.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user