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

(-)a/Koha/REST/V1/Holds.pm (-1 / +3 lines)
Lines 552-558 sub lowest_priority { Link Here
552
        unless $hold;
552
        unless $hold;
553
553
554
    return try {
554
    return try {
555
        C4::Reserves::ToggleLowestPriority($hold_id);
555
        my $lowestPriority = $c->req->json;
556
        $hold->set( { lowestPriority => $lowestPriority } )->store;
557
        C4::Reserves::_FixPriority( { reserve_id => $hold_id, rank => '999999' } );
556
        $hold->discard_changes;    # refresh
558
        $hold->discard_changes;    # refresh
557
        return $c->render( status => 200, openapi => $hold_id );
559
        return $c->render( status => 200, openapi => $hold_id );
558
    } catch {
560
    } catch {
(-)a/api/v1/swagger/paths/holds.yaml (-2 / +2 lines)
Lines 773-781 Link Here
773
      - name: body
773
      - name: body
774
        in: body
774
        in: body
775
        description: An integer representing the new priority to be set for the hold
775
        description: An integer representing the new priority to be set for the hold
776
        required: false
776
        required: true
777
        schema:
777
        schema:
778
          type: integer
778
          type: boolean
779
    produces:
779
    produces:
780
      - application/json
780
      - application/json
781
    responses:
781
    responses:
(-)a/t/db_dependent/api/v1/holds.t (-5 / +11 lines)
Lines 1500-1506 subtest 'delete() tests' => sub { Link Here
1500
1500
1501
subtest 'PUT /holds/{hold_id}/lowest_priority tests' => sub {
1501
subtest 'PUT /holds/{hold_id}/lowest_priority tests' => sub {
1502
1502
1503
    plan tests => 5;
1503
    plan tests => 8;
1504
1504
1505
    $schema->storage->txn_begin;
1505
    $schema->storage->txn_begin;
1506
1506
Lines 1541-1551 subtest 'PUT /holds/{hold_id}/lowest_priority tests' => sub { Link Here
1541
        )
1541
        )
1542
    );
1542
    );
1543
1543
1544
    $t->put_ok( "//$userid:$password@/api/v1/holds/0" . "/lowest_priority" )->status_is(404);
1544
    $t->put_ok( "//$userid:$password@/api/v1/holds/0" . "/lowest_priority" => json => Mojo::JSON->true )
1545
        ->status_is(404);
1546
1547
    $t->put_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/lowest_priority" => json => Mojo::JSON->true )
1548
        ->status_is(200);
1545
1549
1546
    $t->put_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/lowest_priority" )->status_is(200);
1550
    is( $hold->discard_changes->lowestPriority, 1, 'The lowest priority is set' );
1551
1552
    $t->put_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/lowest_priority" => json => Mojo::JSON->false )
1553
        ->status_is(200);
1547
1554
1548
    is( $hold->discard_changes->lowestPriority, 1, 'Priority set to lowest' );
1555
    is( $hold->discard_changes->lowestPriority, 0, 'The lowest priority removed' );
1549
1556
1550
    $schema->storage->txn_rollback;
1557
    $schema->storage->txn_rollback;
1551
};
1558
};
1552
- 

Return to bug 38253