Get QIF import working again. One bad function conversion when

removing the Group structure.  Mostly scheme function calls with wrong
names, and some swigification issues.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/remove-group2@15571 57a11ea4-9604-0410-9ed3-97b8803252fd
zzzoldfeatures/remove-group2
David Hampton 20 years ago
parent 119cfd351f
commit 830b198ea7

@ -149,6 +149,12 @@ xaccInitAccount (Account * acc, QofBook *book)
LEAVE ("account=%p\n", acc);
}
QofBook *
gnc_account_get_book(const Account *account)
{
return qof_instance_get_book(QOF_INSTANCE(account));
}
/********************************************************************\
\********************************************************************/
@ -3169,8 +3175,7 @@ gnc_account_copy_children (Account *to, Account *from)
void
gnc_account_merge_children (Account *parent)
{
GList *node_a;
GList *node_b;
GList *node_a, *node_b, *work, *worker;
if (!parent) return;
@ -3198,8 +3203,11 @@ gnc_account_merge_children (Account *parent)
/* consolidate children */
if (acc_b->children) {
acc_a->children = g_list_concat(acc_a->children, acc_b->children);
acc_b->children = NULL;
work = g_list_copy(acc_b->children);
for (worker = work; worker; worker = g_list_next(worker))
gnc_account_append_child (acc_a, (Account *)worker->data);
g_list_free(work);
qof_event_gen (&acc_a->inst.entity, QOF_EVENT_MODIFY, NULL);
qof_event_gen (&acc_b->inst.entity, QOF_EVENT_MODIFY, NULL);
}

@ -216,7 +216,6 @@ Account *gnc_book_get_root_account(QofBook *book);
void gnc_book_set_root_account(QofBook *book, Account *root);
/** @deprecated */
#define gnc_account_get_book(X) qof_instance_get_book(QOF_INSTANCE(X))
#define xaccAccountGetGUID(X) qof_entity_get_guid(QOF_ENTITY(X))
#define xaccAccountReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
@ -233,6 +232,7 @@ Account * xaccAccountLookup (const GUID *guid, QofBook *book);
/** @name Account general setters/getters
@{ */
QofBook *gnc_account_get_book(const Account *account);
/** Set the account's type */
void xaccAccountSetType (Account *account, GNCAccountType);
/** Set the account's name */

@ -85,6 +85,10 @@ functions. */
%include <Split.h>
%include <engine-helpers.h>
AccountList * gnc_account_get_children (const Account *account);
AccountList * gnc_account_get_descendants (const Account *account);
%ignore gnc_account_get_children;
%ignore gnc_account_get_descendants;
%include <Account.h>
%include <Transaction.h>
%include <gnc-pricedb.h>

@ -606,7 +606,7 @@
(not (hash-ref stock-hash stock-name)))
(let* ((separator (string-ref (gnc-get-account-separator-string) 0))
(existing-gnc-acct
(gnc-get-account-from-full-name
(gnc-account-lookup-by-full-name
(gnc-get-current-root-account)
(qif-map-entry:gnc-name map-entry)))
(book (gnc-account-get-book (gnc:get-current-root-account)))

@ -87,7 +87,7 @@
;; query won't find anything. optimize this later.
(xaccQueryAddSingleAccountMatch
sq
(gnc-get-account-from-full-name
(gnc-account-lookup-by-full-name
old-root (gnc-account-get-full-name
(xaccSplitGetAccount split)))
QOF-QUERY-AND)
@ -158,7 +158,7 @@
(define (gnc:account-tree-catenate-and-merge old-root new-root)
;; stuff the new accounts into the old account tree and merge the accounts
(gnc:account-join-children old-root new-root)
(gnc:account-begin-edit new-root)
(gnc:account-destroy new-root)
(gnc:account-merge-children old-root))
(gnc-account-join-children old-root new-root)
(xaccAccountBeginEdit new-root)
(xaccAccountDestroy new-root)
(gnc-account-merge-children old-root))

@ -19,7 +19,7 @@
(gnc-name (qif-map-entry:gnc-name acct-info))
(existing-account (hash-ref gnc-acct-hash gnc-name))
(same-gnc-account
(gnc-get-account-from-full-name old-root gnc-name))
(gnc-account-lookup-by-full-name old-root gnc-name))
(allowed-types
(qif-map-entry:allowed-types acct-info))
(make-new-acct #f)
@ -38,12 +38,12 @@
#t))))
(define (make-unique-name-variant long-name short-name)
(if (not (null? (gnc-get-account-from-full-name old-root long-name)))
(if (not (null? (gnc-account-lookup-by-full-name old-root long-name)))
(let loop ((count 2))
(let* ((test-name
(string-append long-name (sprintf #f " %a" count)))
(test-acct
(gnc-get-account-from-full-name old-root test-name)))
(gnc-account-lookup-by-full-name old-root test-name)))
(if (and (not (null? test-acct)) (not (compatible? test-acct)))
(loop (+ 1 count))
(string-append short-name (sprintf #f " %a" count)))))
@ -158,8 +158,8 @@
pinfo #t default-currency #f default-currency
gnc-acct-hash old-root new-root))))
(if (and parent-acct (not (null? parent-acct)))
(gnc:account-append-child parent-acct new-acct)
(gnc:account-append-child new-root new-acct))
(gnc-account-append-child parent-acct new-acct)
(gnc-account-append-child new-root new-acct))
(hash-set! gnc-acct-hash gnc-name new-acct)
new-acct))))

Loading…
Cancel
Save