[Gnucash-changes] change fifo/lifo policy to not serve up splits
with a zero amount
Linas Vepstas
linas at cvs.gnucash.org
Sat Jul 3 15:03:46 EDT 2004
Log Message:
-----------
change fifo/lifo policy to not serve up splits with a zero amount
Modified Files:
--------------
gnucash/src/engine:
policy.c
Revision Data
-------------
Index: policy.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/policy.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lsrc/engine/policy.c -Lsrc/engine/policy.c -u -r1.7 -r1.8
--- src/engine/policy.c
+++ src/engine/policy.c
@@ -55,11 +55,11 @@
gboolean want_positive;
gnc_numeric baln;
- if (!pcy || !lot || !lot->account || !lot->splits) return NULL;
+ if (!pcy || !lot || !lot->account || !lot->splits) return NULL;
/* Recomputing the balance re-evaluates the lot closure */
baln = gnc_lot_get_balance (lot);
- if (gnc_lot_is_closed(lot)) return NULL;
+ if (gnc_lot_is_closed(lot)) return NULL;
want_positive = gnc_numeric_negative_p (baln);
@@ -84,9 +84,12 @@
if (split->lot) goto donext;
/* Allow equiv currencies */
- is_match = gnc_commodity_equiv (common_currency,
+ is_match = gnc_commodity_equiv (common_currency,
split->parent->common_currency);
- if (FALSE == is_match) goto donext;
+ if (FALSE == is_match) goto donext;
+
+ /* Disallow zero-amount splits in general. */
+ if (gnc_numeric_zero_p(split->amount)) goto donext;
is_positive = gnc_numeric_positive_p (split->amount);
if ((want_positive && is_positive) ||
More information about the gnucash-changes
mailing list