@@ -, +, @@ --- C4/Circulation.pm | 2 +- t/db_dependent/Circulation.t | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -836,7 +836,7 @@ sub CanBookBeIssued { ); #increment items.localuse - my $localuse_count = $item_object->localuse; + my $localuse_count = $item_object->localuse || 0; $localuse_count++; $item_object->localuse( $localuse_count )->store; --- a/t/db_dependent/Circulation.t +++ a/t/db_dependent/Circulation.t @@ -2434,7 +2434,7 @@ subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { }; subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { - plan tests => 11; + plan tests => 13; my $library = $builder->build_object( { class => 'Koha::Libraries' } ); my $patron_category_x = $builder->build_object( @@ -2481,11 +2481,16 @@ subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { my $issue = AddIssue( $patron_2, $item_2->barcode ); $item_2->discard_changes; ok( $item_2->onloan, "Item is checked out" ); + is( $item_2->localuse, undef , 'No localuse is recorded.'); ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->barcode ); $item_2->discard_changes; ok( !$item_2->onloan, "Checked out item is returned" ); + AddIssue( $patron, $item_2->barcode); + $item_2->discard_changes; # refresh + is( $item_2->localuse, 1 , 'Localuse is recorded.'); + # TODO There are other tests to provide here }; @@ -6217,7 +6222,6 @@ subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { }; - $schema->storage->txn_rollback; C4::Context->clear_syspref_cache(); $branches = Koha::Libraries->search(); --