| 
      
            Lines 1374-1380
          subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1374 | 
                ->status_is(200)  | 
          1374 | 
                ->status_is(200)  | 
        
        
          | 1375 | 
                ->json_is({ pickup_library_id => $library_2->branchcode }); | 
          1375 | 
                ->json_is({ pickup_library_id => $library_2->branchcode }); | 
        
        
          | 1376 | 
           | 
          1376 | 
           | 
        
          
            
              | 1377 | 
                  is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' );  | 
              1377 | 
                  is( $hold->discard_changes->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' );  | 
            
        
          | 1378 | 
           | 
          1378 | 
           | 
        
        
          | 1379 | 
              $t->put_ok( "//$userid:$password@/api/v1/holds/"  | 
          1379 | 
              $t->put_ok( "//$userid:$password@/api/v1/holds/"  | 
        
        
          | 1380 | 
                    . $hold->id  | 
          1380 | 
                    . $hold->id  | 
        
  
    | 
      
            Lines 1382-1388
          subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1382 | 
                ->status_is(400)  | 
          1382 | 
                ->status_is(400)  | 
        
        
          | 1383 | 
                ->json_is({ error => '[The supplied pickup location is not valid]' }); | 
          1383 | 
                ->json_is({ error => '[The supplied pickup location is not valid]' }); | 
        
        
          | 1384 | 
           | 
          1384 | 
           | 
        
          
            
              | 1385 | 
                  is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library unchanged' );  | 
              1385 | 
                  is( $hold->discard_changes->branchcode, $library_2->branchcode, 'pickup library unchanged' );  | 
            
        
          | 1386 | 
           | 
          1386 | 
           | 
        
        
          | 1387 | 
              # item-level hold  | 
          1387 | 
              # item-level hold  | 
        
        
          | 1388 | 
              $hold = Koha::Holds->find(  | 
          1388 | 
              $hold = Koha::Holds->find(  | 
        
  
    | 
      
            Lines 1404-1410
          subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1404 | 
                ->status_is(400)  | 
          1404 | 
                ->status_is(400)  | 
        
        
          | 1405 | 
                ->json_is({ error => '[The supplied pickup location is not valid]' }); | 
          1405 | 
                ->json_is({ error => '[The supplied pickup location is not valid]' }); | 
        
        
          | 1406 | 
           | 
          1406 | 
           | 
        
          
            
              | 1407 | 
                  is( $hold->discard_changes->branchcode->branchcode, $library_1->branchcode, 'pickup library unchanged' );  | 
              1407 | 
                  is( $hold->discard_changes->branchcode, $library_1->branchcode, 'pickup library unchanged' );  | 
            
        
          | 1408 | 
           | 
          1408 | 
           | 
        
        
          | 1409 | 
              t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 );  | 
          1409 | 
              t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 );  | 
        
        
          | 1410 | 
           | 
          1410 | 
           | 
        
  
    | 
      
            Lines 1417-1423
          subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1417 | 
                ->status_is(200)  | 
          1417 | 
                ->status_is(200)  | 
        
        
          | 1418 | 
                ->json_is({ pickup_library_id => $library_2->branchcode }); | 
          1418 | 
                ->json_is({ pickup_library_id => $library_2->branchcode }); | 
        
        
          | 1419 | 
           | 
          1419 | 
           | 
        
          
            
              | 1420 | 
                  is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library changed' );  | 
              1420 | 
                  is( $hold->discard_changes->branchcode, $library_2->branchcode, 'pickup library changed' );  | 
            
        
          | 1421 | 
           | 
          1421 | 
           | 
        
        
          | 1422 | 
              t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 0 );  | 
          1422 | 
              t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 0 );  | 
        
        
          | 1423 | 
           | 
          1423 | 
           | 
        
  
    | 
      
            Lines 1427-1433
          subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1427 | 
                ->status_is(200)  | 
          1427 | 
                ->status_is(200)  | 
        
        
          | 1428 | 
                ->json_is({ pickup_library_id => $library_2->branchcode }); | 
          1428 | 
                ->json_is({ pickup_library_id => $library_2->branchcode }); | 
        
        
          | 1429 | 
           | 
          1429 | 
           | 
        
          
            
              | 1430 | 
                  is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' );  | 
              1430 | 
                  is( $hold->discard_changes->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' );  | 
            
        
          | 1431 | 
           | 
          1431 | 
           | 
        
        
          | 1432 | 
              $t->put_ok( "//$userid:$password@/api/v1/holds/"  | 
          1432 | 
              $t->put_ok( "//$userid:$password@/api/v1/holds/"  | 
        
        
          | 1433 | 
                    . $hold->id  | 
          1433 | 
                    . $hold->id  | 
        
  
    | 
      
            Lines 1435-1441
          subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1435 | 
                ->status_is(400)  | 
          1435 | 
                ->status_is(400)  | 
        
        
          | 1436 | 
                ->json_is({ error => '[The supplied pickup location is not valid]' }); | 
          1436 | 
                ->json_is({ error => '[The supplied pickup location is not valid]' }); | 
        
        
          | 1437 | 
           | 
          1437 | 
           | 
        
          
            
              | 1438 | 
                  is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'invalid pickup library not used' );  | 
              1438 | 
                  is( $hold->discard_changes->branchcode, $library_2->branchcode, 'invalid pickup library not used' );  | 
            
        
          | 1439 | 
           | 
          1439 | 
           | 
        
        
          | 1440 | 
              $t->put_ok( "//$userid:$password@/api/v1/holds/"  | 
          1440 | 
              $t->put_ok( "//$userid:$password@/api/v1/holds/"  | 
        
        
          | 1441 | 
                    . $hold->id  | 
          1441 | 
                    . $hold->id  | 
        
  
    | 
      
            Lines 1445-1451
          subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 1445 | 
                ->status_is(400)  | 
          1445 | 
                ->status_is(400)  | 
        
        
          | 1446 | 
                ->json_is({ error => '[The supplied pickup location is not valid]' }); | 
          1446 | 
                ->json_is({ error => '[The supplied pickup location is not valid]' }); | 
        
        
          | 1447 | 
           | 
          1447 | 
           | 
        
          
            
              | 1448 | 
                  is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'invalid pickup library not used, even if x-koha-override is passed' );  | 
              1448 | 
                  is( $hold->discard_changes->branchcode, $library_2->branchcode, 'invalid pickup library not used, even if x-koha-override is passed' );  | 
            
        
          | 1449 | 
           | 
          1449 | 
           | 
        
        
          | 1450 | 
              my $waiting_hold       = $builder->build_object( { class => 'Koha::Holds', value => { found => 'W' } } ); | 
          1450 | 
              my $waiting_hold       = $builder->build_object( { class => 'Koha::Holds', value => { found => 'W' } } ); | 
        
        
          | 1451 | 
              my $in_processing_hold = $builder->build_object( { class => 'Koha::Holds', value => { found => 'P' } } ); | 
          1451 | 
              my $in_processing_hold = $builder->build_object( { class => 'Koha::Holds', value => { found => 'P' } } ); | 
        
            
              | 1452 | 
              -   | 
               | 
               |