@@ -, +, @@ functionality --- C4/Circulation.pm | 3 --- C4/Items.pm | 3 +++ t/db_dependent/Items.t | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -1806,9 +1806,6 @@ sub AddReturn { unless ($item) { return ( 0, { BadBarcode => $barcode } ); # no barcode means no item or borrower. bail out. } - if ($item->{deleted_on}) { - return ( 0, { BadBarcode => $barcode } ); - } my $itemnumber = $item->{ itemnumber }; my $itemtype = $item->{itype}; # GetItem called effective_itemtype --- a/C4/Items.pm +++ a/C4/Items.pm @@ -146,6 +146,8 @@ Return item information, for a given itemnumber or barcode. The return value is a hashref mapping item column names to values. If C<$serial> is true, include serial publication data. +This accessor will not return deleted items. + =cut sub GetItem { @@ -160,6 +162,7 @@ sub GetItem { } return unless ( $item ); + return if ( $item->deleted_on ); my $data = $item->unblessed(); $data->{itype} = $item->effective_itemtype(); # set the correct itype --- a/t/db_dependent/Items.t +++ a/t/db_dependent/Items.t @@ -45,7 +45,7 @@ my $location = 'My Location'; subtest 'General Add, Get and Del tests' => sub { - plan tests => 16; + plan tests => 17; $schema->storage->txn_begin; @@ -80,8 +80,10 @@ subtest 'General Add, Get and Del tests' => sub { # Delete item. DelItem({ biblionumber => $bibnum, itemnumber => $itemnumber }); + my $deletedItem = Koha::Items->find({ itemnumber => $itemnumber }); + isnt($deletedItem->deleted_on, undef, "Item marked deleted as expected."); my $getdeleted = GetItem($itemnumber); - isnt($getdeleted->{'deleted_on'}, undef, "Item deleted as expected."); + is($getdeleted->{'itemnumber'}, undef, "Item not returned by GetItem as expected."); ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, permanent_location => 'my permanent location', itype => $itemtype->{itemtype} } , $bibnum); $getitem = GetItem($itemnumber); --