]> git.koha-community.org Git - koha.git/commit
Bug 32442: (bug 28739 follow-up) Ensure txn is rollbacked
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 14 Dec 2022 07:42:03 +0000 (08:42 +0100)
committerJacob O'Mara <jacob.omara@ptfs-europe.com>
Tue, 31 Jan 2023 17:45:43 +0000 (17:45 +0000)
commit3a175662e3a504d5dbb5e63cb1bc72b14d138118
treed32ec70f2c2fec9850919fe7d8db56de1825c10e
parenta188bf97faa72444c0674fba0f767913bb7b234e
Bug 32442: (bug 28739 follow-up) Ensure txn is rollbacked

If the TT process call is returning false and so the croak is raised,
then the txn is not rollbacked and the txn is not commited either.

We need to ensure the txn will be correctly rollbacked.

Test plan:
1. Go to any notice and create some invalid Template Toolkit:

[% IF ( 1 == 1 %]
test
[% END %]

2. Save and continue

3. Logout of Koha and attempt to log back in
=> Without this patch you got
Transaction aborted: DBIx::Class::Storage::DBI::mysql::_exec_svp_release(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_4 does not exist at /kohadevbox/koha/Koha/Object.pm line 170
. Rollback failed: DBIx::Class::Storage::DBI::mysql::_exec_svp_rollback(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_3 does not exist at /kohadevbox/koha/Koha/Patron.pm line 363 at /kohadevbox/koha/Koha/Patron.pm line 363
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
=> With this patch applied the login works successfully

QA Note: The test is not testing that the txn is rolledback, I didn't
manage to test that.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 494a63f9e81c2255de162ec5daad1fb2f28dc67b)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
C4/Letters.pm