View | Details | Raw Unified | Return to bug 18651
Collapse All | Expand All

(-)a/C4/Circulation.pm (-5 / +4 lines)
Lines 2175-2185 sub MarkIssueReturned { Link Here
2175
    my $do_not_lock = ( exists $ENV{_} && $ENV{_} =~ m|prove| ) || $ENV{KOHA_NO_TABLE_LOCKS};
2175
    my $do_not_lock = ( exists $ENV{_} && $ENV{_} =~ m|prove| ) || $ENV{KOHA_NO_TABLE_LOCKS};
2176
    $schema->txn_do(sub {
2176
    $schema->txn_do(sub {
2177
2177
2178
        $dbh->do( $query, undef, @bind );
2179
2178
        C4::Context->dbh->do(q|LOCK TABLE old_issues READ|) unless $do_not_lock;
2180
        C4::Context->dbh->do(q|LOCK TABLE old_issues READ|) unless $do_not_lock;
2179
        C4::Context->dbh->do(q|LOCK TABLE old_issues WRITE|) unless $do_not_lock;
2181
        C4::Context->dbh->do(q|LOCK TABLE old_issues WRITE|) unless $do_not_lock;
2180
2182
2181
        $dbh->do( $query, undef, @bind );
2182
2183
        my $original_issue_id = $issue_id;
2183
        my $original_issue_id = $issue_id;
2184
        my $issue = Koha::Checkouts->find( $issue_id ); # FIXME should be fetched earlier
2184
        my $issue = Koha::Checkouts->find( $issue_id ); # FIXME should be fetched earlier
2185
2185
Lines 2196-2201 sub MarkIssueReturned { Link Here
2196
        $old_checkout_data->{issue_id} = $issue_id;
2196
        $old_checkout_data->{issue_id} = $issue_id;
2197
        my $old_checkout = Koha::Old::Checkout->new($old_checkout_data)->store;
2197
        my $old_checkout = Koha::Old::Checkout->new($old_checkout_data)->store;
2198
2198
2199
        C4::Context->dbh->do(q|UNLOCK TABLES|) unless $do_not_lock;
2200
2199
        # Update the fines
2201
        # Update the fines
2200
        $dbh->do(q|UPDATE accountlines SET issue_id = ? WHERE issue_id = ?|, undef, $old_checkout->issue_id, $issue->issue_id);
2202
        $dbh->do(q|UPDATE accountlines SET issue_id = ? WHERE issue_id = ?|, undef, $old_checkout->issue_id, $issue->issue_id);
2201
2203
Lines 2214-2221 sub MarkIssueReturned { Link Here
2214
            my $patron = Koha::Patrons->find( $borrowernumber );
2216
            my $patron = Koha::Patrons->find( $borrowernumber );
2215
            $item->last_returned_by( $patron );
2217
            $item->last_returned_by( $patron );
2216
        }
2218
        }
2217
2218
        C4::Context->dbh->do(q|UNLOCK TABLES|) unless $do_not_lock;
2219
    });
2219
    });
2220
2220
2221
    return $issue_id;
2221
    return $issue_id;
2222
- 

Return to bug 18651