@@ -, +, @@ commit be156d9ad9e5bcfadab34d44f90e04fd61e256ad Bug 15854: Use a READ and WRITE LOCK on message_queue commit b40456f7dd4b8a988f9c6a5718452936101cb8ff Bug 18364: Do not LOCK/UNLOCK tables from tests --- C4/Circulation.pm | 7 +++++++ 1 file changed, 7 insertions(+) --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -2172,7 +2172,12 @@ sub MarkIssueReturned { push @bind, $issue_id; # FIXME Improve the return value and handle it from callers + my $do_not_lock = ( exists $ENV{_} && $ENV{_} =~ m|prove| ) || $ENV{KOHA_NO_TABLE_LOCKS}; $schema->txn_do(sub { + + C4::Context->dbh->do(q|LOCK TABLE message_queue READ|) unless $do_not_lock; + C4::Context->dbh->do(q|LOCK TABLE message_queue WRITE|) unless $do_not_lock; + $dbh->do( $query, undef, @bind ); my $original_issue_id = $issue_id; @@ -2209,6 +2214,8 @@ sub MarkIssueReturned { my $patron = Koha::Patrons->find( $borrowernumber ); $item->last_returned_by( $patron ); } + + C4::Context->dbh->do(q|UNLOCK TABLES|) unless $do_not_lock; }); return $issue_id; --