Bug 17539: Fix Already in a transaction error
perl t/db_dependent/Reserves.t 1..72 ok 1 - use C4::Reserves; ok 2 - CheckReserves Test 1 ... ok 52 - Reserve in waiting status cant be canceled ok 53 - Reserving an ageRestricted Biblio without a borrower dateofbirth succeeds DBD::mysql::db begin_work failed: Already in a transaction at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1489. DBD::mysql::db begin_work failed: Already in a transaction at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1489. at /usr/share/perl5/DBIx/Class/Schema.pm line 1080. ... Koha::Object::store('Koha::Patron=HASH(0x9e43b20)') called at /home/ubuntu/kohaclone/C4/Members.pm line 542 C4::Members::ModMember('borrowernumber', 658535, 'dateofbirth', '2001-11-02') called at t/db_dependent/Reserves.t line 516 This patch fixes this issue by replacing dbh autocommit=0 with txn_begin. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
e0e88806fa
commit
c414e76089
1 changed files with 4 additions and 3 deletions
|
@ -50,8 +50,9 @@ $module->mock('userenv', sub {
|
|||
my $dbh = C4::Context->dbh;
|
||||
|
||||
# Start transaction
|
||||
$dbh->{AutoCommit} = 0;
|
||||
$dbh->{RaiseError} = 1;
|
||||
my $database = Koha::Database->new();
|
||||
my $schema = $database->schema();
|
||||
$schema->storage->txn_begin();
|
||||
|
||||
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestriction' where tagfield='521' and tagsubfield='a'");
|
||||
|
@ -678,7 +679,7 @@ is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days');
|
|||
$dbh->do('DELETE FROM reserves', undef, ($bibnum));
|
||||
|
||||
# we reached the finish
|
||||
$dbh->rollback;
|
||||
$schema->storage->txn_rollback();
|
||||
|
||||
sub count_hold_print_messages {
|
||||
my $message_count = $dbh->selectall_arrayref(q{
|
||||
|
|
Loading…
Reference in a new issue