mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
fix handling of account commodities when closing periods
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9476 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
d0fe8b67ed
commit
542ce3bed4
@ -157,6 +157,8 @@ xaccMallocAccount (QofBook *book)
|
|||||||
Account *
|
Account *
|
||||||
xaccCloneAccountSimple(const Account *from, QofBook *book)
|
xaccCloneAccountSimple(const Account *from, QofBook *book)
|
||||||
{
|
{
|
||||||
|
const char * ucom;
|
||||||
|
const gnc_commodity_table * comtbl;
|
||||||
Account *ret;
|
Account *ret;
|
||||||
|
|
||||||
if (!from || !book) return NULL;
|
if (!from || !book) return NULL;
|
||||||
@ -178,7 +180,12 @@ xaccCloneAccountSimple(const Account *from, QofBook *book)
|
|||||||
|
|
||||||
ret->kvp_data = kvp_frame_copy(from->kvp_data);
|
ret->kvp_data = kvp_frame_copy(from->kvp_data);
|
||||||
|
|
||||||
ret->commodity = from->commodity;
|
/* The new book should contain a commodity that matches
|
||||||
|
* the one in the old book. Find it, use it. */
|
||||||
|
ucom = gnc_commodity_get_unique_name (from->commodity);
|
||||||
|
comtbl = gnc_commodity_table_get_table (book);
|
||||||
|
ret->commodity = gnc_commodity_table_lookup_unique (comtbl, ucom);
|
||||||
|
|
||||||
ret->commodity_scu = from->commodity_scu;
|
ret->commodity_scu = from->commodity_scu;
|
||||||
ret->non_standard_scu = from->non_standard_scu;
|
ret->non_standard_scu = from->non_standard_scu;
|
||||||
ret->core_dirty = TRUE;
|
ret->core_dirty = TRUE;
|
||||||
@ -212,7 +219,12 @@ xaccCloneAccount (const Account *from, QofBook *book,
|
|||||||
|
|
||||||
ret->kvp_data = kvp_frame_copy(from->kvp_data);
|
ret->kvp_data = kvp_frame_copy(from->kvp_data);
|
||||||
|
|
||||||
ret->commodity = from->commodity;
|
/* The new book should contain a commodity that matches
|
||||||
|
* the one in the old book. Find it, use it. */
|
||||||
|
ucom = gnc_commodity_get_unique_name (from->commodity);
|
||||||
|
comtbl = gnc_commodity_table_get_table (book);
|
||||||
|
ret->commodity = gnc_commodity_table_lookup_unique (comtbl, ucom);
|
||||||
|
|
||||||
ret->commodity_scu = from->commodity_scu;
|
ret->commodity_scu = from->commodity_scu;
|
||||||
ret->non_standard_scu = from->non_standard_scu;
|
ret->non_standard_scu = from->non_standard_scu;
|
||||||
ret->core_dirty = TRUE;
|
ret->core_dirty = TRUE;
|
||||||
|
@ -118,9 +118,13 @@ Account * xaccCloneAccount (const Account *from, QofBook *book,
|
|||||||
/** The xaccCloneAccountSimple() routine makes a simple copy of the
|
/** The xaccCloneAccountSimple() routine makes a simple copy of the
|
||||||
* indicated account, placing it in the indicated book. It copies
|
* indicated account, placing it in the indicated book. It copies
|
||||||
* the account type, name, description, and the kvp values;
|
* the account type, name, description, and the kvp values;
|
||||||
* it does not copy splits/transactions. Note also that it
|
* it does not copy splits/transactions. The book should have
|
||||||
* does NOT use the 'gemini' kvp value to indicate where it
|
* a commodity table in it that has commodities with the same
|
||||||
* was copied from.*/
|
* unique name as the ones being copied in the account (the
|
||||||
|
* commodities in the clone will be those from the book).
|
||||||
|
* Note that this routines does *NOT* use the 'gemini' kvp value
|
||||||
|
* to indicate where it was copied from.
|
||||||
|
*/
|
||||||
Account * xaccCloneAccountSimple (const Account *from, QofBook *book);
|
Account * xaccCloneAccountSimple (const Account *from, QofBook *book);
|
||||||
|
|
||||||
/** The xaccAccountBeginEdit() subroutine is the first phase of
|
/** The xaccAccountBeginEdit() subroutine is the first phase of
|
||||||
|
Loading…
Reference in New Issue
Block a user