2001-09-02 Dave Peticolas <dave@krondo.com>

* src/backend/file/sixtp-dom-generators.c (add_kvp_value_node):
	fix warning in case of empty kvp sub-frame

	* src/backend/file/io-gncxml-v2.c (clear_up_account_commodity):
	fix scu values

	* src/engine/Account.c (xaccInitAccount): initialize scu to 0


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5263 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-09-02 21:23:40 +00:00
parent bce196588d
commit 3c48817541
4 changed files with 47 additions and 7 deletions

View File

@ -1,3 +1,13 @@
2001-09-02 Dave Peticolas <dave@krondo.com>
* src/backend/file/sixtp-dom-generators.c (add_kvp_value_node):
fix warning in case of empty kvp sub-frame
* src/backend/file/io-gncxml-v2.c (clear_up_account_commodity):
fix scu values
* src/engine/Account.c (xaccInitAccount): initialize scu to 0
2001-09-02 Christian Stimming <stimming@tuhh.de> 2001-09-02 Christian Stimming <stimming@tuhh.de>
* src/report/standard-reports/average-balance.scm: Ben Stanley * src/report/standard-reports/average-balance.scm: Ben Stanley

View File

@ -59,10 +59,18 @@ static void
clear_up_account_commodity( clear_up_account_commodity(
gnc_commodity_table *tbl, Account *act, gnc_commodity_table *tbl, Account *act,
gnc_commodity * (*getter) (Account *account), gnc_commodity * (*getter) (Account *account),
void (*setter) (Account *account, gnc_commodity *comm)) void (*setter) (Account *account, gnc_commodity *comm),
int (*scu_getter) (Account *account),
void (*scu_setter) (Account *account, int scu))
{ {
gnc_commodity *gcom; gnc_commodity *gcom;
gnc_commodity *com = getter(act); gnc_commodity *com = getter(act);
int old_scu;
if (scu_getter)
old_scu = scu_getter(act);
else
old_scu = 0;
if(!com) if(!com)
{ {
@ -86,6 +94,8 @@ clear_up_account_commodity(
{ {
gnc_commodity_destroy(com); gnc_commodity_destroy(com);
setter(act, gcom); setter(act, gcom);
if (old_scu != 0 && scu_setter)
scu_setter(act, old_scu);
} }
} }
@ -129,11 +139,21 @@ static gboolean
add_account_local(sixtp_gdv2 *data, Account *act) add_account_local(sixtp_gdv2 *data, Account *act)
{ {
clear_up_account_commodity(gnc_book_get_commodity_table(data->book), act, clear_up_account_commodity(gnc_book_get_commodity_table(data->book), act,
DxaccAccountGetCurrency, DxaccAccountSetCurrency); DxaccAccountGetCurrency,
DxaccAccountSetCurrency,
DxaccAccountGetCurrencySCU,
DxaccAccountSetCurrencySCU);
clear_up_account_commodity(gnc_book_get_commodity_table(data->book), act, clear_up_account_commodity(gnc_book_get_commodity_table(data->book), act,
DxaccAccountGetSecurity, DxaccAccountSetSecurity); DxaccAccountGetSecurity,
DxaccAccountSetSecurity,
NULL, NULL);
clear_up_account_commodity(gnc_book_get_commodity_table(data->book), act, clear_up_account_commodity(gnc_book_get_commodity_table(data->book), act,
xaccAccountGetCommodity, xaccAccountSetCommodity); xaccAccountGetCommodity,
xaccAccountSetCommodity,
xaccAccountGetCommoditySCU,
xaccAccountSetCommoditySCU);
xaccAccountScrubCommodity (act); xaccAccountScrubCommodity (act);

View File

@ -298,10 +298,20 @@ add_kvp_value_node(xmlNodePtr node, gchar *tag, kvp_value* val)
break; break;
case KVP_TYPE_FRAME: case KVP_TYPE_FRAME:
{
kvp_frame *frame;
xmlSetProp(val_node, "type", "frame"); xmlSetProp(val_node, "type", "frame");
g_hash_table_foreach(kvp_frame_get_hash(kvp_value_get_frame(val)),
frame = kvp_value_get_frame (val);
if (!frame || !kvp_frame_get_hash (frame))
break;
g_hash_table_foreach(kvp_frame_get_hash(frame),
add_kvp_slot, val_node); add_kvp_slot, val_node);
break; }
break;
default: default:
break; break;
} }

View File

@ -96,7 +96,7 @@ xaccInitAccount (Account * acc)
acc->idata = 0; acc->idata = 0;
acc->commodity = NULL; acc->commodity = NULL;
acc->commodity_scu = 100000; acc->commodity_scu = 0;
acc->splits = NULL; acc->splits = NULL;