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

(-)a/Koha/REST/V1/Holds.pm (-1 lines)
Lines 314-320 sub suspend { Link Here
314
            $suspend_end_date = output_pref({
314
            $suspend_end_date = output_pref({
315
                dt         => dt_from_string( $hold->suspend_until ),
315
                dt         => dt_from_string( $hold->suspend_until ),
316
                dateformat => 'rfc3339',
316
                dateformat => 'rfc3339',
317
                dateonly   => 1
318
                }
317
                }
319
            );
318
            );
320
        }
319
        }
(-)a/api/v1/swagger/definitions/hold.json (-1 / +1 lines)
Lines 11-17 Link Here
11
    },
11
    },
12
    "hold_date": {
12
    "hold_date": {
13
      "type": ["string", "null"],
13
      "type": ["string", "null"],
14
      "format": "date",
14
      "format": "date-time",
15
      "description": "The date the hold was placed"
15
      "description": "The date the hold was placed"
16
    },
16
    },
17
    "biblio_id": {
17
    "biblio_id": {
(-)a/t/db_dependent/api/v1/holds.t (-11 / +8 lines)
Lines 157-163 my $post_data = { Link Here
157
    biblio_id => int($biblio_1->biblionumber),
157
    biblio_id => int($biblio_1->biblionumber),
158
    item_id => int($item_1->itemnumber),
158
    item_id => int($item_1->itemnumber),
159
    pickup_library_id => $branchcode,
159
    pickup_library_id => $branchcode,
160
    expiration_date => output_pref({ dt => $expiration_date, dateformat => 'rfc3339', dateonly => 1 }),
160
    expiration_date => output_pref({ dt => $expiration_date, dateformat => 'rfc3339' }),
161
    priority => 2,
161
    priority => 2,
162
};
162
};
163
my $put_data = {
163
my $put_data = {
Lines 273-279 subtest "Test endpoints with permission" => sub { Link Here
273
    $t->get_ok( "//$userid_1:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber )
273
    $t->get_ok( "//$userid_1:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber )
274
      ->status_is(200)
274
      ->status_is(200)
275
      ->json_is('/0/hold_id', $reserve_id)
275
      ->json_is('/0/hold_id', $reserve_id)
276
      ->json_is('/0/expiration_date', output_pref({ dt => $expiration_date, dateformat => 'rfc3339', dateonly => 1 }))
276
      ->json_is('/0/expiration_date', output_pref({ dt => $expiration_date, dateformat => 'rfc3339' }))
277
      ->json_is('/0/pickup_library_id', $branchcode);
277
      ->json_is('/0/pickup_library_id', $branchcode);
278
278
279
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
279
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
Lines 342-349 subtest 'test AllowHoldDateInFuture' => sub { Link Here
342
        biblio_id => int($biblio_1->biblionumber),
342
        biblio_id => int($biblio_1->biblionumber),
343
        item_id => int($item_1->itemnumber),
343
        item_id => int($item_1->itemnumber),
344
        pickup_library_id => $branchcode,
344
        pickup_library_id => $branchcode,
345
        expiration_date => output_pref({ dt => $expiration_date, dateformat => 'rfc3339', dateonly => 1 }),
345
        expiration_date => output_pref({ dt => $expiration_date, dateformat => 'rfc3339' }),
346
        hold_date => output_pref({ dt => $future_hold_date, dateformat => 'rfc3339', dateonly => 1 }),
346
        hold_date => output_pref({ dt => $future_hold_date, dateformat => 'rfc3339' }),
347
        priority => 2,
347
        priority => 2,
348
    };
348
    };
349
349
Lines 357-363 subtest 'test AllowHoldDateInFuture' => sub { Link Here
357
357
358
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
358
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
359
      ->status_is(201)
359
      ->status_is(201)
360
      ->json_is('/hold_date', output_pref({ dt => $future_hold_date, dateformat => 'rfc3339', dateonly => 1 }));
360
      ->json_is('/hold_date', output_pref({ dt => $future_hold_date, dateformat => 'rfc3339' }));
361
};
361
};
362
362
363
subtest 'test AllowHoldPolicyOverride' => sub {
363
subtest 'test AllowHoldPolicyOverride' => sub {
Lines 424-431 subtest 'suspend and resume tests' => sub { Link Here
424
424
425
    my $end_date = output_pref({
425
    my $end_date = output_pref({
426
      dt         => dt_from_string( undef ),
426
      dt         => dt_from_string( undef ),
427
      dateformat => 'rfc3339',
427
      dateformat => 'rfc3339'
428
      dateonly   => 1
429
    });
428
    });
430
429
431
    $t->post_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" => json => { end_date => $end_date } );
430
    $t->post_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" => json => { end_date => $end_date } );
Lines 438-444 subtest 'suspend and resume tests' => sub { Link Here
438
      output_pref({
437
      output_pref({
439
        dt         => dt_from_string( $hold->suspend_until ),
438
        dt         => dt_from_string( $hold->suspend_until ),
440
        dateformat => 'rfc3339',
439
        dateformat => 'rfc3339',
441
        dateonly   => 1
442
      }),
440
      }),
443
      'Hold suspension has correct end date'
441
      'Hold suspension has correct end date'
444
    );
442
    );
Lines 454-464 subtest 'suspend and resume tests' => sub { Link Here
454
            . $hold->id
452
            . $hold->id
455
            . "/suspension" => json => {
453
            . "/suspension" => json => {
456
            end_date =>
454
            end_date =>
457
                output_pref( { dt => $date, dateformat => 'rfc3339', dateonly => 1 } )
455
                output_pref( { dt => $date, dateformat => 'rfc3339' } )
458
            }
456
            }
459
    )->status_is( 201, 'Hold suspension created' )
457
    )->status_is( 201, 'Hold suspension created' )
460
        ->json_is( '/end_date',
458
        ->json_is( '/end_date',
461
        output_pref( { dt => $date, dateformat => 'rfc3339', dateonly => 1 } ) )
459
        output_pref( { dt => $date, dateformat => 'rfc3339' } ) )
462
        ->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' );
460
        ->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' );
463
461
464
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )
462
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )
465
- 

Return to bug 24718