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

(-)a/api/v1/swagger/definitions/hold.json (-2 / +2 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": {
Lines 63-69 Link Here
63
    },
63
    },
64
    "expiration_date": {
64
    "expiration_date": {
65
      "type": ["string", "null"],
65
      "type": ["string", "null"],
66
      "format": "date",
66
      "format": "date-time",
67
      "description": "The date the hold expires"
67
      "description": "The date the hold expires"
68
    },
68
    },
69
    "lowest_priority": {
69
    "lowest_priority": {
(-)a/api/v1/swagger/paths/holds.json (-3 / +3 lines)
Lines 23-29 Link Here
23
          "in": "query",
23
          "in": "query",
24
          "description": "Hold",
24
          "description": "Hold",
25
          "type": "string",
25
          "type": "string",
26
          "format": "date"
26
          "format": "date-time"
27
        },
27
        },
28
        {
28
        {
29
          "name": "biblio_id",
29
          "name": "biblio_id",
Lines 202-208 Link Here
202
              "hold_date": {
202
              "hold_date": {
203
                "description": "The date the hold was placed",
203
                "description": "The date the hold was placed",
204
                "type": [ "string", "null" ],
204
                "type": [ "string", "null" ],
205
                "format": "date"
205
                "format": "date-time"
206
              },
206
              },
207
              "item_id": {
207
              "item_id": {
208
                "description": "Internal item identifier",
208
                "description": "Internal item identifier",
Lines 215-221 Link Here
215
              "expiration_date": {
215
              "expiration_date": {
216
                "description": "Hold end date",
216
                "description": "Hold end date",
217
                "type": ["string", "null"],
217
                "type": ["string", "null"],
218
                "format": "date"
218
                "format": "date-time"
219
              },
219
              },
220
              "notes": {
220
              "notes": {
221
                "description": "Notes related to this hold",
221
                "description": "Notes related to this hold",
(-)a/t/db_dependent/api/v1/holds.t (-7 / +8 lines)
Lines 159-165 my $post_data = { Link Here
159
    biblio_id         => $biblio_1->biblionumber,
159
    biblio_id         => $biblio_1->biblionumber,
160
    item_id           => $item_1->itemnumber,
160
    item_id           => $item_1->itemnumber,
161
    pickup_library_id => $branchcode,
161
    pickup_library_id => $branchcode,
162
    expiration_date   => output_pref( { dt => $expiration_date, dateformat => 'rfc3339', dateonly => 1 } ),
162
    expiration_date   => output_pref( { dt => $expiration_date, dateformat => 'rfc3339' } ),
163
};
163
};
164
my $patch_data = {
164
my $patch_data = {
165
    priority        => 2,
165
    priority        => 2,
Lines 254-260 subtest "Test endpoints with permission" => sub { Link Here
254
    $t->get_ok( "//$userid_1:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber )
254
    $t->get_ok( "//$userid_1:$password@/api/v1/holds?patron_id=" . $patron_1->borrowernumber )
255
      ->status_is(200)
255
      ->status_is(200)
256
      ->json_is('/0/hold_id', $reserve_id)
256
      ->json_is('/0/hold_id', $reserve_id)
257
      ->json_is('/0/expiration_date', output_pref({ dt => $expiration_date, dateformat => 'rfc3339', dateonly => 1 }))
257
      ->json_is('/0/expiration_date', output_pref({ dt => $expiration_date, dateformat => 'rfc3339' }))
258
      ->json_is('/0/pickup_library_id', $branchcode);
258
      ->json_is('/0/pickup_library_id', $branchcode);
259
259
260
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
260
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
Lines 322-336 subtest 'test AllowHoldDateInFuture' => sub { Link Here
322
322
323
    $dbh->do('DELETE FROM reserves');
323
    $dbh->do('DELETE FROM reserves');
324
324
325
    my $future_hold_date = DateTime->now->add(days => 10)->truncate( to => 'day' );
325
    my $future_hold_date = DateTime->now->add(days => 10);
326
326
327
    my $post_data = {
327
    my $post_data = {
328
        patron_id         => $patron_1->borrowernumber,
328
        patron_id         => $patron_1->borrowernumber,
329
        biblio_id         => $biblio_1->biblionumber,
329
        biblio_id         => $biblio_1->biblionumber,
330
        item_id           => $item_1->itemnumber,
330
        item_id           => $item_1->itemnumber,
331
        pickup_library_id => $branchcode,
331
        pickup_library_id => $branchcode,
332
        expiration_date   => output_pref( { dt => $expiration_date,  dateformat => 'rfc3339', dateonly => 1 } ),
332
        expiration_date   => output_pref( { dt => $expiration_date,  dateformat => 'rfc3339' } ),
333
        hold_date         => output_pref( { dt => $future_hold_date, dateformat => 'rfc3339', dateonly => 1 } ),
333
        hold_date         => output_pref( { dt => $future_hold_date, dateformat => 'rfc3339' } ),
334
    };
334
    };
335
335
336
    t::lib::Mocks::mock_preference( 'AllowHoldDateInFuture', 0 );
336
    t::lib::Mocks::mock_preference( 'AllowHoldDateInFuture', 0 );
Lines 340-345 subtest 'test AllowHoldDateInFuture' => sub { Link Here
340
      ->json_has('/error');
340
      ->json_has('/error');
341
341
342
    t::lib::Mocks::mock_preference( 'AllowHoldDateInFuture', 1 );
342
    t::lib::Mocks::mock_preference( 'AllowHoldDateInFuture', 1 );
343
    t::lib::Mocks::mock_preference( 'HourBasedHolds', 1 );
344
    t::lib::Mocks::mock_preference( 'dateformat', 'rfc3339' );
343
345
344
    # Make sure pickup location checks doesn't get in the middle
346
    # Make sure pickup location checks doesn't get in the middle
345
    my $mock_biblio = Test::MockModule->new('Koha::Biblio');
347
    my $mock_biblio = Test::MockModule->new('Koha::Biblio');
Lines 349-355 subtest 'test AllowHoldDateInFuture' => sub { Link Here
349
351
350
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
352
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
351
      ->status_is(201)
353
      ->status_is(201)
352
      ->json_is('/hold_date', output_pref({ dt => $future_hold_date, dateformat => 'rfc3339', dateonly => 1 }));
354
      ->json_is('/hold_date', output_pref({ dt => $future_hold_date, dateformat => 'rfc3339' }));
353
};
355
};
354
356
355
$schema->storage->txn_rollback;
357
$schema->storage->txn_rollback;
356
- 

Return to bug 24718