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

(-)a/Koha/Item.pm (+57 lines)
Lines 429-434 sub as_marc_field { Link Here
429
    return $field;
429
    return $field;
430
}
430
}
431
431
432
=head3 to_api_mapping
433
434
This method returns the mapping for representing a Koha::Item object
435
on the API.
436
437
=cut
438
439
sub to_api_mapping {
440
    return {
441
        itemnumber               => 'item_id',
442
        biblionumber             => 'biblio_id',
443
        biblioitemnumber         => undef,
444
        barcode                  => 'external_id',
445
        dateaccessioned          => 'acquisition_date',
446
        booksellerid             => 'acquisition_source',
447
        homebranch               => 'home_library_id',
448
        price                    => 'purchase_price',
449
        replacementprice         => 'replacement_price',
450
        replacementpricedate     => 'replacement_price_date',
451
        datelastborrowed         => 'last_checkout_date',
452
        datelastseen             => 'last_seen_date',
453
        stack                    => undef,
454
        notforloan               => 'not_for_loan_status',
455
        damaged                  => 'damaged_status',
456
        damaged_on               => 'damaged_date',
457
        itemlost                 => 'lost_status',
458
        itemlost_on              => 'lost_date',
459
        withdrawn                => 'withdrawn',
460
        withdrawn_on             => 'withdrawn_date',
461
        itemcallnumber           => 'callnumber',
462
        coded_location_qualifier => 'coded_location_qualifier',
463
        issues                   => 'checkouts_count',
464
        renewals                 => 'renewals_count',
465
        reserves                 => 'holds_count',
466
        restricted               => 'restricted_status',
467
        itemnotes                => 'public_notes',
468
        itemnotes_nonpublic      => 'internal_notes',
469
        holdingbranch            => 'holding_library_id',
470
        paidfor                  => undef,
471
        timestamp                => 'timestamp',
472
        location                 => 'location',
473
        permanent_location       => 'permanent_location',
474
        onloan                   => 'checked_out_date',
475
        cn_source                => 'call_number_source',
476
        cn_sort                  => 'call_number_sort',
477
        ccode                    => 'collection_code',
478
        materials                => 'materials_notes',
479
        uri                      => 'uri',
480
        itype                    => 'item_type',
481
        more_subfields_xml       => 'extended_subfields',
482
        enumchron                => 'serial_issue_number',
483
        copynumber               => 'copy_number',
484
        stocknumber              => 'inventory_number',
485
        new_status               => 'new_status'
486
    };
487
}
488
432
=head2 Internal methods
489
=head2 Internal methods
433
490
434
=head3 _type
491
=head3 _type
(-)a/Koha/REST/V1/Items.pm (-6 / +1 lines)
Lines 18-27 package Koha::REST::V1::Items; Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Mojo::Base 'Mojolicious::Controller';
20
use Mojo::Base 'Mojolicious::Controller';
21
use Mojo::JSON;
22
23
use C4::Auth qw( haspermission );
24
use C4::Items qw( GetHiddenItemnumbers );
25
21
26
use Koha::Items;
22
use Koha::Items;
27
23
Lines 33-39 sub get { Link Here
33
    my $item;
29
    my $item;
34
    try {
30
    try {
35
        $item = Koha::Items->find($c->validation->param('item_id'));
31
        $item = Koha::Items->find($c->validation->param('item_id'));
36
        return $c->render( status => 200, openapi => _to_api( $item->TO_JSON ) );
32
        return $c->render( status => 200, openapi => $item->to_api );
37
    }
33
    }
38
    catch {
34
    catch {
39
        unless ( defined $item ) {
35
        unless ( defined $item ) {
40
- 

Return to bug 23843