Bug 28254: (QA follow-up) override -> force
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 30 Apr 2021 13:41:43 +0000 (14:41 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 4 May 2021 12:22:08 +0000 (14:22 +0200)
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 <jonathan.druart@bugs.koha-community.org>
Koha/Hold.pm
Koha/REST/V1/Holds.pm
t/db_dependent/Koha/Hold.t

index 793b498..2bdae26 100644 (file)
@@ -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<Koha::Exceptions::Hold::InvalidP
 the passed pickup location is not valid.
 
 Note: It is up to the caller to verify if I<AllowHoldPolicyOverride> is set when setting the
-B<override> parameter.
+B<force> 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} }
         )
index bea108f..b6545b1 100644 (file)
@@ -539,7 +539,7 @@ sub update_pickup_location {
         $hold->set_pickup_location(
             {
                 library_id => $pickup_library_id,
-                override   => $can_override
+                force      => $can_override
             }
         );
 
index 736b32b..5f6a901 100755 (executable)
@@ -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' );