Change gncOwnerGetBalanceInCurrency to only cosider lots that contain an invoice.

This function is currently only used in the owner tree code and this change
will cause payments not properly linked to invoices to be ignored when computing
owner balances.
This commit is contained in:
Mike Alexander 2014-08-31 02:36:59 -04:00
parent a028ae0f98
commit 67f84774e9

View File

@ -1133,8 +1133,10 @@ gncOwnerGetBalanceInCurrency (const GncOwner *owner,
{
GNCLot *lot = lot_node->data;
gnc_numeric lot_balance = gnc_lot_get_balance (lot);
balance = gnc_numeric_add (balance, lot_balance,
gnc_commodity_get_fraction (owner_currency), GNC_HOW_RND_ROUND_HALF_UP);
GncInvoice *invoice = gncInvoiceGetInvoiceFromLot(lot);
if (invoice)
balance = gnc_numeric_add (balance, lot_balance,
gnc_commodity_get_fraction (owner_currency), GNC_HOW_RND_ROUND_HALF_UP);
}
}