diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index 1aa34ba369..706eb03a80 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -452,6 +452,42 @@ xaccMallocTransaction (QofBook *book) return trans; } +#ifdef DUMP_FUNCTIONS +/* Please don't delete this function. Although it is not called by + any other code in GnuCash, it is useful when debugging. For example + it can be called using the gdb "call" command when stopped at a + breakpoint. */ +void +xaccTransDump (const Transaction *trans, const char *tag) +{ + GList *node; + + printf("%s Trans %p", tag, trans); + printf(" Entered: %s\n", gnc_print_date(trans->date_entered)); + printf(" Posted: %s\n", gnc_print_date(trans->date_posted)); + printf(" Num: %s\n", trans->num ? trans->num : "(null)"); + printf(" Description: %s\n", + trans->description ? trans->description : "(null)"); + printf(" Currency: %s\n", + gnc_commodity_get_printname(trans->common_currency)); + printf(" version: %x\n", qof_instance_get_version(trans)); + printf(" version_chk: %x\n", qof_instance_get_version_check(trans)); + printf(" editlevel: %x\n", qof_instance_get_editlevel(trans)); + printf(" orig: %p\n", trans->orig); + printf(" idata: %x\n", qof_instance_get_idata(trans)); + printf(" splits: "); + for (node = trans->splits; node; node = node->next) + { + printf("%p ", node->data); + } + printf("\n"); + for (node = trans->splits; node; node = node->next) + { + xaccSplitDump(node->data, tag); + } + printf("\n"); +} +#endif void xaccTransSortSplits (Transaction *trans) diff --git a/src/engine/Transaction.h b/src/engine/Transaction.h index 5df7fb90a0..e6f36b7b8e 100644 --- a/src/engine/Transaction.h +++ b/src/engine/Transaction.h @@ -632,6 +632,10 @@ Timespec xaccTransGetVoidTime(const Transaction *tr); #define TRANS_SPLITLIST "split-list" /* for guid_match_all */ /**@}*/ +#ifdef DUMP_FUNCTIONS +void xaccTransDump (const Transaction *trans, const char *tag); +#endif + #define RECONCILED_MATCH_TYPE "reconciled-match" /** \deprecated */