From af8a963adbab6e369e957fcc84633a618147553f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 2 Dec 2019 12:02:28 +0100 Subject: [PATCH] Bug 23463: Replace recently added occurrences Few occurrences have been added since this patchset has been originaly written --- Koha/Checkout.pm | 2 +- Koha/Item.pm | 10 ---------- t/db_dependent/Circulation.t | 2 +- t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t | 4 ++-- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm index f789de6d8d..d385d613dd 100644 --- a/Koha/Checkout.pm +++ b/Koha/Checkout.pm @@ -137,7 +137,7 @@ sub claim_returned { )->store(); my $ClaimReturnedLostValue = C4::Context->preference('ClaimReturnedLostValue'); - C4::Items::ModItem( { itemlost => $ClaimReturnedLostValue }, undef, $self->itemnumber ); + $self->item->itemlost($ClaimReturnedLostValue)->store; my $ClaimReturnedChargeFee = C4::Context->preference('ClaimReturnedChargeFee'); $charge_lost_fee = diff --git a/Koha/Item.pm b/Koha/Item.pm index 6b79d6e865..820dbfd525 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -540,16 +540,6 @@ sub current_holds { return Koha::Holds->_new_from_dbic($hold_rs); } -=head3 holds - -=cut - -sub holds { - my ( $self ) = @_; - my $hold_rs = $self->_result->reserves->search; - return Koha::Holds->_new_from_dbic($hold_rs); -} - =head3 stockrotationitem my $sritem = Koha::Item->stockrotationitem; diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index d348b58a1e..1c5b413d61 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -2668,7 +2668,7 @@ subtest 'Cancel transfers on lost items' => sub { is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Items holding branch is the transfers origin branch before it is marked as lost' ); #Simulate item being marked as lost and confirm the transfer is deleted and the items holding branch is the transfers source branch - ModItem( { itemlost => 1 }, $item->biblionumber, $item->itemnumber ); + $item->itemlost(1)->store; LostItem( $item->itemnumber, 'test', 1 ); ($datesent,$frombranch,$tobranch) = GetTransfers($item->itemnumber); is( $tobranch, undef, 'The transfer on the lost item has been deleted as the LostItemCancelOutstandingTransfer is enabled'); diff --git a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t index 99dacec4dd..18a138c778 100755 --- a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t +++ b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t @@ -68,11 +68,11 @@ subtest 'after_biblio_action() and after_item_action() hooks tests' => sub { qr/after_item_action called with action: create, ref: Koha::Item/, 'AddItem calls the hook with action=create'; - warning_like { C4::Items::ModItem({ location => 'shelves' }, $biblio_id, $item->itemnumber); } + warning_like { $item->location('shelves')->store; } qr/after_item_action called with action: modify, ref: Koha::Item/, 'ModItem calls the hook with action=modify'; - warning_like { C4::Items::DelItem({ itemnumber => $item->itemnumber }); } + warning_like { $item->delete; } qr/after_item_action called with action: delete/, 'DelItem calls the hook with action=delete, item_id passed'; -- 2.11.0