The problem:
If you save (hold) a transaction then recall and
complete it, you'll get duplicates of all trans_item,
trans_promotion and trans_tax table data. The same will
happen if you save/recall repeatedly.
This is a little related to BUG:922162
The cause:
EJ records are inserted when you do the save, and
again when you complete it.
There is no primary key on these tables and the system
doesn't do any checking or cleaning up.
The solution:
Step 1. Add a primary key on trans_id and seq_no
(always a good idea to have a PK).
Step 2...
It seems to me that the only safe way to handle this
that covers all eventualities is to delete any existing
data prior to saving the EJ.
The system uses autocommit = true by default, but
(thankfully) the EJ save is setup to use a transaction.
I think I'm just gonna put delete methods in the various
data package classes and call them from the Ej.complete
() method, after the call to updateTransZ() - since this
method does a commit (>_<).
If there is a problem and a rollback occurs, hopefully
things will return to the way they were...