mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Check for a duplicate price in add_price before adding it to the list instead of after.
This commit is contained in:
parent
c7f87f253b
commit
60ae86d178
@ -1109,6 +1109,12 @@ add_price(GNCPriceDB *db, GNCPrice *p)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!insert_or_replace_price(db, p))
|
||||||
|
{
|
||||||
|
LEAVE("A better price already exists");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
currency_hash = g_hash_table_lookup(db->commodity_hash, commodity);
|
currency_hash = g_hash_table_lookup(db->commodity_hash, commodity);
|
||||||
if (!currency_hash)
|
if (!currency_hash)
|
||||||
{
|
{
|
||||||
@ -1128,11 +1134,6 @@ add_price(GNCPriceDB *db, GNCPrice *p)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!insert_or_replace_price(db, p))
|
|
||||||
{
|
|
||||||
LEAVE("A better price already exists");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
g_hash_table_insert(currency_hash, currency, price_list);
|
g_hash_table_insert(currency_hash, currency, price_list);
|
||||||
p->db = db;
|
p->db = db;
|
||||||
qof_event_gen (&p->inst, QOF_EVENT_ADD, NULL);
|
qof_event_gen (&p->inst, QOF_EVENT_ADD, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user