Open aungzwin10 opened 2 years ago
@aungzwin10 thanks for the report. From your report, I understand that you have a lot of payments that pay exactly one invoice (I'm assuming that the payment gets entered on the invoice screen.) The code was written the way it is, because there's the possibility to create payments that are associated with more than one transaction. I was having trouble understanding howto determine which payment records to delete and which ones need to stick around. (The ones that still have links need to stick around, obviously, but the point was how to put that in the SQL in the procedure you're quoting.)
@ehuelsmann Yes, payment entered on the invoice screen at the time of saving invoice.
Save payment id
in the variable before payment_link
delete. Then after deleting the payment_links
(meaning after following lines) https://github.com/ledgersmb/LedgerSMB/blob/b4768e57b7e94110499094b62cc6f7297e34e17d/sql/modules/Drafts.sql#L127-L135
find entries in the payment_links
associated to that payment_id
. If there is no entry in the payment_links
, delete the payment id
, otherwise, leave it.
Do you think the above scenario enough?
2nd vote to get sorted - we also do a lot of single invoice/single payment (think of LSMB as a POS terminal)
I've been contemplating this issue. The solution - I think - is to collect the payment and the transaction into a batch and have the "Delete" option mean batch deletion of the two.
Version
1.9.13
What browsers are you seeing the problem on?
This problem isn't browser related
What happened?
When deleting the draft transaction,
draft_delete
only deletes theacc_trans
, tax related table,payment_links
andar/ap/gl
. However, if the transaction exist payments, it doesn't delete record inpayment
. So, there are lots of record left inpayment
which do not allocate to any transactions.Please take a look at the
draft_delete
function. https://github.com/ledgersmb/LedgerSMB/blob/b4768e57b7e94110499094b62cc6f7297e34e17d/sql/modules/Drafts.sql#L117-L163What should have happened?
If the payment exists in the transaction, delete both
payment
andpayment_links
.