void xaccTransScrubOrphans (Transaction *trans) { SplitList *node; QofBook *book = NULL; Account *root = NULL; if (!trans) return; for (node = trans->splits; node; node = node->next) { Split *split = node->data; if (split->acc) { TransScrubOrphansFast (trans, gnc_account_get_root(split->acc)); return; } } /* If we got to here, then *none* of the splits belonged to an * account. Not a happy situation. We should dig an account * out of the book the transaction belongs to. * XXX we should probably *always* to this, instead of the above loop! */ PINFO ("Free Floating Transaction!"); book = xaccTransGetBook (trans); root = gnc_book_get_root_account (book); TransScrubOrphansFast (trans, root); }
void xaccAccountScrubOrphans (Account *acc, QofPercentageFunc percentagefunc) { GList *node, *splits; const char *str; const char *message = _( "Looking for orphans in account %s: %u of %u"); guint total_splits = 0; guint current_split = 0; if (!acc) return; str = xaccAccountGetName (acc); str = str ? str : "(null)"; PINFO ("Looking for orphans in account %s \n", str); splits = xaccAccountGetSplitList(acc); total_splits = g_list_length (splits); for (node = splits; node; node = node->next) { Split *split = node->data; if (current_split % 100 == 0) { char *progress_msg = g_strdup_printf (message, str, current_split, total_splits); (percentagefunc)(progress_msg, (100 * current_split) / total_splits); g_free (progress_msg); } TransScrubOrphansFast (xaccSplitGetParent (split), gnc_account_get_root (acc)); current_split++; } (percentagefunc)(NULL, -1.0); }
static void gnc_split_register_load_xfer_cells (SplitRegister *reg, Account *base_account) { Account *root = NULL; QuickFill *qf; ComboCell *cell; GtkListStore *store; if (base_account) root = gnc_account_get_root(base_account); if (root == NULL) root = gnc_get_current_root_account(); if (root == NULL) return; qf = gnc_get_shared_account_name_quickfill (root, QKEY, skip_cb, NULL); store = gnc_get_shared_account_name_list_store (root, QKEY, skip_cb, NULL); cell = (ComboCell *) gnc_table_layout_get_cell (reg->table->layout, XFRM_CELL); gnc_combo_cell_use_quickfill_cache (cell, qf); gnc_combo_cell_use_list_store_cache (cell, store); cell = (ComboCell *) gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL); gnc_combo_cell_use_quickfill_cache (cell, qf); gnc_combo_cell_use_list_store_cache (cell, store); }
void xaccAccountScrubImbalance (Account *acc) { GList *node, *splits; const char *str; gint split_count = 0, curr_split_no = 1; if (!acc) return; str = xaccAccountGetName(acc); str = str ? str : "(null)"; PINFO ("Looking for imbalance in account %s \n", str); 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++; } }
void xaccAccountScrubImbalance (Account *acc, QofPercentageFunc percentagefunc) { GList *node, *splits; const char *str; const char *message = _( "Looking for imbalances in account %s: %u of %u"); gint split_count = 0, curr_split_no = 0; if (!acc) return; str = xaccAccountGetName(acc); str = str ? str : "(null)"; PINFO ("Looking for imbalances in account %s \n", str); 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 + 1, split_count); if (curr_split_no % 100 == 0) { char *progress_msg = g_strdup_printf (message, str, curr_split_no, split_count); (percentagefunc)(progress_msg, (100 * curr_split_no) / split_count); g_free (progress_msg); } TransScrubOrphansFast (xaccSplitGetParent (split), gnc_account_get_root (acc)); (percentagefunc)(NULL, 0.0); xaccTransScrubCurrency(trans); xaccTransScrubImbalance (trans, gnc_account_get_root (acc), NULL); PINFO("Finished processing split %d of %d", curr_split_no + 1, split_count); curr_split_no++; } (percentagefunc)(NULL, -1.0); }
void xaccAccountScrubOrphans (Account *acc) { GList *node; const char *str; if (!acc) return; str = xaccAccountGetName (acc); str = str ? str : "(null)"; PINFO ("Looking for orphans in account %s \n", str); for (node = xaccAccountGetSplitList(acc); node; node = node->next) { Split *split = node->data; TransScrubOrphansFast (xaccSplitGetParent (split), gnc_account_get_root (acc)); } }
void xaccAccountScrubImbalance (Account *acc) { GList *node; const char *str; if (!acc) return; str = xaccAccountGetName(acc); str = str ? str : "(null)"; PINFO ("Looking for imbalance in account %s \n", str); for (node = xaccAccountGetSplitList(acc); node; node = node->next) { Split *split = node->data; Transaction *trans = xaccSplitGetParent(split); xaccTransScrubCurrency(trans); xaccTransScrubImbalance (trans, gnc_account_get_root (acc), NULL); } }