View | Details | Raw Unified | Return to bug 28254
Collapse All | Expand All

(-)a/Koha/Hold.pm (-3 / +3 lines)
Lines 257-263 sub is_pickup_location_valid { Link Here
257
    $hold->set_pickup_location(
257
    $hold->set_pickup_location(
258
        {
258
        {
259
            library_id => $library->id,
259
            library_id => $library->id,
260
          [ override   => 0|1 ]
260
          [ force   => 0|1 ]
261
        }
261
        }
262
    );
262
    );
263
263
Lines 265-271 Updates the hold pickup location. It throws a I<Koha::Exceptions::Hold::InvalidP Link Here
265
the passed pickup location is not valid.
265
the passed pickup location is not valid.
266
266
267
Note: It is up to the caller to verify if I<AllowHoldPolicyOverride> is set when setting the
267
Note: It is up to the caller to verify if I<AllowHoldPolicyOverride> is set when setting the
268
B<override> parameter.
268
B<force> parameter.
269
269
270
=cut
270
=cut
271
271
Lines 276-282 sub set_pickup_location { Link Here
276
        unless $params->{library_id};
276
        unless $params->{library_id};
277
277
278
    if (
278
    if (
279
        $params->{override}
279
        $params->{force}
280
        || $self->is_pickup_location_valid(
280
        || $self->is_pickup_location_valid(
281
            { library_id => $params->{library_id} }
281
            { library_id => $params->{library_id} }
282
        )
282
        )
(-)a/Koha/REST/V1/Holds.pm (-1 / +1 lines)
Lines 539-545 sub update_pickup_location { Link Here
539
        $hold->set_pickup_location(
539
        $hold->set_pickup_location(
540
            {
540
            {
541
                library_id => $pickup_library_id,
541
                library_id => $pickup_library_id,
542
                override   => $can_override
542
                force      => $can_override
543
            }
543
            }
544
        );
544
        );
545
545
(-)a/t/db_dependent/Koha/Hold.t (-3 / +2 lines)
Lines 125-133 subtest 'set_pickup_location() tests' => sub { Link Here
125
    $item_hold->discard_changes;
125
    $item_hold->discard_changes;
126
    is( $item_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' );
126
    is( $item_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' );
127
127
128
    $item_hold->set_pickup_location({ library_id => $library_1->branchcode, override => 1 });
128
    $item_hold->set_pickup_location({ library_id => $library_1->branchcode, force => 1 });
129
    $item_hold->discard_changes;
129
    $item_hold->discard_changes;
130
    is( $item_hold->branchcode, $library_1->branchcode, 'branchcode changed because of \'override\'' );
130
    is( $item_hold->branchcode, $library_1->branchcode, 'branchcode changed because of \'force\'' );
131
131
132
    $ret = $item_hold->set_pickup_location({ library_id => $library_2->id });
132
    $ret = $item_hold->set_pickup_location({ library_id => $library_2->id });
133
    is( ref($ret), 'Koha::Hold', 'self is returned' );
133
    is( ref($ret), 'Koha::Hold', 'self is returned' );
134
- 

Return to bug 28254