Generate REMOVE events when a Split is removed from a Transaction.

Pass the *old* parent transaction (since the Split may be moving into 
   a new transaction) and the old index of the Split in the old Transaction's
   list of Splits.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13468 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker
2006-03-04 03:21:34 +00:00
parent 22ee7eb47f
commit d0f3042d8f
3 changed files with 43 additions and 4 deletions

View File

@@ -46,6 +46,7 @@
#include "gnc-engine.h"
#include "gnc-lot-p.h"
#include "gnc-lot.h"
#include "gnc-event.h"
/* Notes about xaccTransBeginEdit(), xaccTransCommitEdit(), and
@@ -954,15 +955,18 @@ static void trans_cleanup_commit(Transaction *trans)
if ((s->parent != trans) || s->inst.do_free) {
/* Existing split either moved to another transaction or
was destroyed, drop from list */
GncEventData ed;
ed.parent = trans;
ed.idx = g_list_index(trans->splits, s);
trans->splits = g_list_remove(trans->splits, s);
//gnc_engine_gen_event(&trans->inst, QOF_EVENT_REMOVE);
qof_event_gen(&s->inst.entity, QOF_EVENT_REMOVE, &ed);
}
if (s->parent == trans) {
/* Split was either destroyed or just changed */
//if (s->inst.do_free)
// gnc_engine_gen_event(&trans->inst, QOF_EVENT_REMOVE);
//else gnc_engine_gen_event(&trans->inst, QOF_EVENT_MODIFY);
if (s->inst.do_free)
qof_event_gen(&s->inst.entity, QOF_EVENT_DESTROY, NULL);
else qof_event_gen(&s->inst.entity, QOF_EVENT_MODIFY, NULL);
xaccSplitCommitEdit(s);
}
}