Bug 20086: Execute AddRenewal in a transaction to avoid partial success and doubled...
authorNick <nick@bywatersolutions.com>
Thu, 17 Oct 2019 14:31:27 +0000 (14:31 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 21 Oct 2019 08:46:46 +0000 (09:46 +0100)
commit9658cd4d18b330711a7a8e3391a83d52b35050c6
tree72d83c8df8f4520c18d037e1bcc781d0f2d7ca37
parent8a243ffd94bc1dcae49c712818a79007579b4f6c
Bug 20086: Execute AddRenewal in a transaction to avoid partial success and doubled fines

This patch starts a transaction and only commits if renewal and fines
updates and charges are successful (partial in any cna be problematic)

There is no feedback (as currently there is none either) but if part
fails, all fails.

I didn't include stats and notifications in the transaction, but we
could. (Edit JD: not true, they are included)

To test:
1 - Apply patch
2 - prove t/db_dependent/Circulation.t
3 - Attempt circs and renewals should be no difference
4 - If possible make part of transaction fail and ensure all fails

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended: commit title and one indendation (return statement)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
C4/Circulation.pm