mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
* src/engine/Account.c (xaccCloneAccountSimple): new func.
(xaccAccountEnumAsString): change arg to GNCAccountType. * src/engine/Account.c (xaccAccountGetChildren): Add children group if ->children == NULL. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4151 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
+24
-1
@@ -135,6 +135,27 @@ xaccMallocAccount (void)
|
||||
return acc;
|
||||
}
|
||||
|
||||
Account *
|
||||
xaccCloneAccountSimple(const Account *from)
|
||||
{
|
||||
Account *ret;
|
||||
|
||||
ret = xaccMallocAccount();
|
||||
xaccInitAccount(ret);
|
||||
|
||||
ret->type = from->type;
|
||||
|
||||
ret->accountName = g_strdup(from->accountName);
|
||||
ret->accountCode = g_strdup(from->accountCode);
|
||||
ret->description = g_strdup(from->description);
|
||||
|
||||
ret->kvp_data = kvp_frame_copy(from->kvp_data);
|
||||
|
||||
ret->currency = from->currency;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
@@ -1273,6 +1294,8 @@ AccountGroup *
|
||||
xaccAccountGetChildren (Account *acc)
|
||||
{
|
||||
if (!acc) return NULL;
|
||||
if (acc->children == NULL)
|
||||
acc->children = xaccMallocAccountGroup ();
|
||||
return (acc->children);
|
||||
}
|
||||
|
||||
@@ -1755,7 +1778,7 @@ xaccAccountHasAncestor (Account *account, Account * ancestor)
|
||||
#define GNC_RETURN_ENUM_AS_STRING(x) case (x): return #x;
|
||||
|
||||
char *
|
||||
xaccAccountTypeEnumAsString(int type) {
|
||||
xaccAccountTypeEnumAsString(GNCAccountType type) {
|
||||
switch(type) {
|
||||
GNC_RETURN_ENUM_AS_STRING(NO_TYPE);
|
||||
GNC_RETURN_ENUM_AS_STRING(BANK);
|
||||
|
||||
@@ -110,7 +110,7 @@ char * xaccAccountGetTypeStr (int type); /* GUI names */
|
||||
/* Conversion routines for the account types to/from strings.
|
||||
Critical for the text communication mechanisms. i.e. INCOME ->
|
||||
"INCOME". */
|
||||
char * xaccAccountTypeEnumAsString (int type);
|
||||
char * xaccAccountTypeEnumAsString (GNCAccountType type);
|
||||
gboolean xaccAccountStringToType (const char* str, int *type);
|
||||
GNCAccountType xaccAccountStringToEnum (const char* str);
|
||||
|
||||
@@ -129,6 +129,7 @@ gboolean xaccAccountEqual(Account *a, Account* b, gboolean check_guids);
|
||||
* (by calling xaccAccountBeginEdit()) before calling this routine.
|
||||
*/
|
||||
Account *xaccMallocAccount (void);
|
||||
Account * xaccCloneAccountSimple(const Account *from);
|
||||
void xaccAccountBeginEdit (Account *account);
|
||||
void xaccAccountCommitEdit (Account *account);
|
||||
void xaccAccountDestroy (Account *account);
|
||||
|
||||
Reference in New Issue
Block a user