From 00f6bcf207f12a64068d803e15bf37bbdb449a80 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 6 Nov 2023 11:53:53 -0300 Subject: [PATCH] Bug 35269: Rename `update_item_location` to `location_update_trigger` This patch renames all occurences of the method. Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind Signed-off-by: Katrin Fischer --- C4/Circulation.pm | 4 ++-- Koha/Item.pm | 6 +++--- t/db_dependent/Koha/Item.t | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 3d4a3efa90..ac28b2e74b 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1728,7 +1728,7 @@ sub AddIssue { } # Update item location - $item_object->update_item_location( 'checkout' ); + $item_object->location_update_trigger( 'checkout' ); if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) { UpdateTotalIssues( $item_object->biblionumber, 1, undef, { skip_holds_queue => 1 } ); @@ -2199,7 +2199,7 @@ sub AddReturn { my $patron_unblessed = $patron ? $patron->unblessed : {}; # Update item location - my $loc_messages = $item->update_item_location( 'checkin' ); + my $loc_messages = $item->location_update_trigger( 'checkin' ); foreach my $loc_msg_key ( keys %$loc_messages ) { $messages->{ $loc_msg_key } = $loc_messages->{ $loc_msg_key }; } diff --git a/Koha/Item.pm b/Koha/Item.pm index 2b6f0a2a37..11ca23e947 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -2356,15 +2356,15 @@ sub strings_map { } -=head3 update_item_location +=head3 location_update_trigger - $item->update_item_location( $action ); + $item->location_update_trigger( $action ); Update the item location on checkin or checkout. =cut -sub update_item_location { +sub location_update_trigger { my ( $self, $action ) = @_; my ( $update_loc_rules, $messages ); diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index fdce202767..7a21db18f5 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -2302,7 +2302,7 @@ subtest 'current_branchtransfers relationship' => sub { $schema->storage->txn_rollback; }; -subtest 'update_item_location() tests' => sub { +subtest 'location_update_trigger() tests' => sub { plan tests => 10; @@ -2320,26 +2320,26 @@ subtest 'update_item_location() tests' => sub { my $item = $builder->build_sample_item( { location => $location, permanent_location => $permanent_location } ); - $item->update_item_location($action); + $item->location_update_trigger($action); is( $item->location, $location, "$pref does not modify value when not enabled" ); t::lib::Mocks::mock_preference( $pref, qq{$location: GEN} ); - $item->update_item_location($action); + $item->location_update_trigger($action); is( $item->location, 'GEN', qq{'location' value set from '$location' to 'GEN' with setting `$location: GEN`} ); t::lib::Mocks::mock_preference( $pref, q{_ALL_: BOO} ); - $item->update_item_location($action); + $item->location_update_trigger($action); is( $item->location, 'BOO', q{`_ALL_` does the job} ); t::lib::Mocks::mock_preference( $pref, qq{$location: _BLANK_} ); $item->location($location)->store(); - $item->update_item_location($action); + $item->location_update_trigger($action); is( $item->location, q{}, q{`_BLANK_` does the job} ); t::lib::Mocks::mock_preference( $pref, qq{GEN: _BLANK_\n_BLANK_: PROC\n$location: _PERM_} ); @@ -2352,7 +2352,7 @@ subtest 'update_item_location() tests' => sub { } )->store; - $item->update_item_location($action); + $item->location_update_trigger($action); is( $item->location, $permanent_location, -- 2.30.2