Browse Source

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 <jonathan.druart@bugs.koha-community.org>
21.05.x
Martin Renvoize 3 years ago
committed by Jonathan Druart
parent
commit
102deb8cd9
  1. 6
      Koha/Hold.pm
  2. 2
      Koha/REST/V1/Holds.pm
  3. 4
      t/db_dependent/Koha/Hold.t

6
Koha/Hold.pm

@ -257,7 +257,7 @@ sub is_pickup_location_valid {
$hold->set_pickup_location( $hold->set_pickup_location(
{ {
library_id => $library->id, 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. the passed pickup location is not valid.
Note: It is up to the caller to verify if I<AllowHoldPolicyOverride> is set when setting the Note: It is up to the caller to verify if I<AllowHoldPolicyOverride> is set when setting the
B<override> parameter. B<force> parameter.
=cut =cut
@ -276,7 +276,7 @@ sub set_pickup_location {
unless $params->{library_id}; unless $params->{library_id};
if ( if (
$params->{override} $params->{force}
|| $self->is_pickup_location_valid( || $self->is_pickup_location_valid(
{ library_id => $params->{library_id} } { library_id => $params->{library_id} }
) )

2
Koha/REST/V1/Holds.pm

@ -539,7 +539,7 @@ sub update_pickup_location {
$hold->set_pickup_location( $hold->set_pickup_location(
{ {
library_id => $pickup_library_id, library_id => $pickup_library_id,
override => $can_override force => $can_override
} }
); );

4
t/db_dependent/Koha/Hold.t

@ -125,9 +125,9 @@ subtest 'set_pickup_location() tests' => sub {
$item_hold->discard_changes; $item_hold->discard_changes;
is( $item_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); 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; $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 }); $ret = $item_hold->set_pickup_location({ library_id => $library_2->id });
is( ref($ret), 'Koha::Hold', 'self is returned' ); is( ref($ret), 'Koha::Hold', 'self is returned' );

Loading…
Cancel
Save