mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add some verbosity to scrubbing
This gives the user a primitive way to track progress for long running Check & Repair actions by adding --log gnc.engine.scrub=info to the command line options
This commit is contained in:
parent
208cf514f3
commit
de8d4c801f
@ -283,8 +283,9 @@ xaccAccountTreeScrubImbalance (Account *acc)
|
||||
void
|
||||
xaccAccountScrubImbalance (Account *acc)
|
||||
{
|
||||
GList *node;
|
||||
GList *node, *splits;
|
||||
const char *str;
|
||||
gint split_count = 0, curr_split_no = 1;
|
||||
|
||||
if (!acc) return;
|
||||
|
||||
@ -292,14 +293,23 @@ xaccAccountScrubImbalance (Account *acc)
|
||||
str = str ? str : "(null)";
|
||||
PINFO ("Looking for imbalance in account %s \n", str);
|
||||
|
||||
for (node = xaccAccountGetSplitList(acc); node; node = node->next)
|
||||
splits = xaccAccountGetSplitList(acc);
|
||||
split_count = g_list_length (splits);
|
||||
for (node = splits; node; node = node->next)
|
||||
{
|
||||
Split *split = node->data;
|
||||
Transaction *trans = xaccSplitGetParent(split);
|
||||
|
||||
PINFO("Start processing split %d of %d",
|
||||
curr_split_no, split_count);
|
||||
|
||||
xaccTransScrubCurrency(trans);
|
||||
|
||||
xaccTransScrubImbalance (trans, gnc_account_get_root (acc), NULL);
|
||||
|
||||
PINFO("Finished processing split %d of %d",
|
||||
curr_split_no, split_count);
|
||||
curr_split_no++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,10 @@
|
||||
#include "ScrubBusiness.h"
|
||||
#include "Transaction.h"
|
||||
|
||||
static QofLogModule log_module = GNC_MOD_LOT;
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "gnc.engine.scrub"
|
||||
|
||||
static QofLogModule log_module = G_LOG_DOMAIN;
|
||||
|
||||
// A helper function that takes two splits. If the splits are of opposite sign
|
||||
// it reduces the biggest split to have the same value (but with opposite sign)
|
||||
@ -465,22 +468,39 @@ void
|
||||
gncScrubBusinessAccountLots (Account *acc)
|
||||
{
|
||||
LotList *lots, *node;
|
||||
gint lot_count = 0;
|
||||
gint curr_lot_no = 1;
|
||||
const gchar *str;
|
||||
|
||||
if (!acc) return;
|
||||
if (FALSE == xaccAccountIsAPARType (xaccAccountGetType (acc))) return;
|
||||
|
||||
ENTER ("(acc=%s)", xaccAccountGetName(acc));
|
||||
str = xaccAccountGetName(acc);
|
||||
str = str ? str : "(null)";
|
||||
|
||||
ENTER ("(acc=%s)", str);
|
||||
PINFO ("Cleaning up superfluous lot links in account %s \n", str);
|
||||
xaccAccountBeginEdit(acc);
|
||||
|
||||
lots = xaccAccountGetLotList(acc);
|
||||
lot_count = g_list_length (lots);
|
||||
for (node = lots; node; node = node->next)
|
||||
{
|
||||
GNCLot *lot = node->data;
|
||||
|
||||
PINFO("Start processing lot %d of %d",
|
||||
curr_lot_no, lot_count);
|
||||
|
||||
if (lot)
|
||||
gncScrubBusinessLot (lot);
|
||||
|
||||
PINFO("Finished processing lot %d of %d",
|
||||
curr_lot_no, lot_count);
|
||||
curr_lot_no++;
|
||||
}
|
||||
g_list_free(lots);
|
||||
xaccAccountCommitEdit(acc);
|
||||
LEAVE ("(acc=%s)", xaccAccountGetName(acc));
|
||||
LEAVE ("(acc=%s)", str);
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
|
@ -3736,10 +3736,8 @@ gnc_plugin_page_register_cmd_scrub_all (GtkAction *action,
|
||||
GncPluginPageRegisterPrivate *priv;
|
||||
Query *query;
|
||||
Account *root;
|
||||
Transaction *trans;
|
||||
GNCLot *lot;
|
||||
Split *split;
|
||||
GList *node;
|
||||
GList *node, *splits;
|
||||
gint split_count = 0, curr_split_no = 1;
|
||||
|
||||
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
|
||||
|
||||
@ -3756,10 +3754,17 @@ gnc_plugin_page_register_cmd_scrub_all (GtkAction *action,
|
||||
gnc_suspend_gui_refresh();
|
||||
root = gnc_get_current_root_account();
|
||||
|
||||
for (node = qof_query_run(query); node; node = node->next)
|
||||
splits = qof_query_run(query);
|
||||
split_count = g_list_length (splits);
|
||||
for (node = splits; node; node = node->next)
|
||||
{
|
||||
split = node->data;
|
||||
trans = xaccSplitGetParent(split);
|
||||
GNCLot *lot;
|
||||
Split *split = node->data;
|
||||
Transaction *trans = xaccSplitGetParent(split);
|
||||
|
||||
|
||||
PINFO("Start processing split %d of %d",
|
||||
curr_split_no, split_count);
|
||||
|
||||
xaccTransScrubOrphans(trans);
|
||||
xaccTransScrubImbalance(trans, root, NULL);
|
||||
@ -3767,6 +3772,10 @@ gnc_plugin_page_register_cmd_scrub_all (GtkAction *action,
|
||||
lot = xaccSplitGetLot (split);
|
||||
if (lot && xaccAccountIsAPARType (xaccAccountGetType (xaccSplitGetAccount (split))))
|
||||
gncScrubBusinessLot (lot);
|
||||
|
||||
PINFO("Finished processing split %d of %d",
|
||||
curr_split_no, split_count);
|
||||
curr_split_no++;
|
||||
}
|
||||
|
||||
gnc_resume_gui_refresh();
|
||||
|
Loading…
Reference in New Issue
Block a user