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

(-)a/Koha/Hold.pm (-1 / +33 lines)
Lines 400-406 sub _move_to_old { Link Here
400
    return Koha::Old::Hold->new( $hold_infos )->store;
400
    return Koha::Old::Hold->new( $hold_infos )->store;
401
}
401
}
402
402
403
=head3 type
403
=head3 to_api_mapping
404
405
This method returns the mapping for representing a Koha::Hold object
406
on the API.
407
408
=cut
409
410
sub to_api_mapping {
411
    return {
412
        reserve_id       => 'hold_id',
413
        borrowernumber   => 'patron_id',
414
        reservedate      => 'hold_date',
415
        biblionumber     => 'biblio_id',
416
        branchcode       => 'pickup_library_id',
417
        notificationdate => undef,
418
        reminderdate     => undef,
419
        cancellationdate => 'cancelation_date',
420
        reservenotes     => 'notes',
421
        found            => 'status',
422
        itemnumber       => 'item_id',
423
        waitingdate      => 'waiting_date',
424
        expirationdate   => 'expiration_date',
425
        lowestPriority   => 'lowest_priority',
426
        suspend          => 'suspended',
427
        suspend_until    => 'suspended_until',
428
        itemtype         => 'item_type',
429
        item_level_hold  => 'item_level',
430
    };
431
}
432
433
=head2 Internal methods
434
435
=head3 _type
404
436
405
=cut
437
=cut
406
438
(-)a/Koha/REST/V1/Holds.pm (-3 / +8 lines)
Lines 184-190 sub add { Link Here
184
184
185
        my $hold = Koha::Holds->find($hold_id);
185
        my $hold = Koha::Holds->find($hold_id);
186
186
187
        return $c->render( status => 201, openapi => _to_api($hold->TO_JSON) );
187
        return $c->render(
188
            status  => 201,
189
            openapi => $hold->to_api
190
        );
188
    }
191
    }
189
    catch {
192
    catch {
190
        if ( blessed $_ and $_->isa('Koha::Exceptions') ) {
193
        if ( blessed $_ and $_->isa('Koha::Exceptions') ) {
Lines 258-264 sub edit { Link Here
258
    C4::Reserves::ModReserve($params);
261
    C4::Reserves::ModReserve($params);
259
    $hold->discard_changes; # refresh
262
    $hold->discard_changes; # refresh
260
263
261
    return $c->render( status => 200, openapi => _to_api( $hold->TO_JSON ) );
264
    return $c->render(
265
        status  => 200,
266
        openapi => $hold->to_api
267
    );
262
}
268
}
263
269
264
=head3 delete
270
=head3 delete
265
- 

Return to bug 23843