From 102deb8cd9619e0ca9eb3e7820b742c6bad2c446 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 30 Apr 2021 14:41:43 +0100 Subject: [PATCH] Bug 28254: (QA follow-up) override -> force After some discussion we decided that the parameter should be called 'force' for pushign through an action against policy. (as per the Transfers work). We decided to stick to 'override' at the API level however as it highlights the 'human interaction' element of the call. Signed-off-by: Jonathan Druart --- Koha/Hold.pm | 6 +++--- Koha/REST/V1/Holds.pm | 2 +- t/db_dependent/Koha/Hold.t | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Koha/Hold.pm b/Koha/Hold.pm index 793b4983bc..2bdae269ec 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -257,7 +257,7 @@ sub is_pickup_location_valid { $hold->set_pickup_location( { library_id => $library->id, - [ override => 0|1 ] + [ force => 0|1 ] } ); @@ -265,7 +265,7 @@ Updates the hold pickup location. It throws a I is set when setting the -B parameter. +B parameter. =cut @@ -276,7 +276,7 @@ sub set_pickup_location { unless $params->{library_id}; if ( - $params->{override} + $params->{force} || $self->is_pickup_location_valid( { library_id => $params->{library_id} } ) diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm index bea108f5d0..b6545b1997 100644 --- a/Koha/REST/V1/Holds.pm +++ b/Koha/REST/V1/Holds.pm @@ -539,7 +539,7 @@ sub update_pickup_location { $hold->set_pickup_location( { library_id => $pickup_library_id, - override => $can_override + force => $can_override } ); diff --git a/t/db_dependent/Koha/Hold.t b/t/db_dependent/Koha/Hold.t index 736b32b305..5f6a9016c8 100755 --- a/t/db_dependent/Koha/Hold.t +++ b/t/db_dependent/Koha/Hold.t @@ -125,9 +125,9 @@ subtest 'set_pickup_location() tests' => sub { $item_hold->discard_changes; is( $item_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); - $item_hold->set_pickup_location({ library_id => $library_1->branchcode, override => 1 }); + $item_hold->set_pickup_location({ library_id => $library_1->branchcode, force => 1 }); $item_hold->discard_changes; - is( $item_hold->branchcode, $library_1->branchcode, 'branchcode changed because of \'override\'' ); + is( $item_hold->branchcode, $library_1->branchcode, 'branchcode changed because of \'force\'' ); $ret = $item_hold->set_pickup_location({ library_id => $library_2->id }); is( ref($ret), 'Koha::Hold', 'self is returned' ); -- 2.39.5