3 # Copyright BibLibre 2012
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
32 my $itemnumber = $cgi->param('itemnumber');
35 my $acq_fw = GetMarcStructure
(1, 'ACQ');
36 my $fw = ($acq_fw) ?
'ACQ' : '';
37 $item = GetItem
($itemnumber);
39 if($item->{homebranch
}) {
40 $item->{homebranchname
} = GetBranchName
($item->{homebranch
});
43 if($item->{holdingbranch
}) {
44 $item->{holdingbranchname
} = GetBranchName
($item->{holdingbranch
});
47 if(my $code = GetAuthValCode
("items.notforloan", $fw)) {
48 $item->{notforloan
} = GetKohaAuthorisedValueLib
($code, $item->{notforloan
});
51 if(my $code = GetAuthValCode
("items.restricted", $fw)) {
52 $item->{restricted
} = GetKohaAuthorisedValueLib
($code, $item->{restricted
});
55 if(my $code = GetAuthValCode
("items.location", $fw)) {
56 $item->{location
} = GetKohaAuthorisedValueLib
($code, $item->{location
});
59 if(my $code = GetAuthValCode
("items.ccode", $fw)) {
60 $item->{collection
} = GetKohaAuthorisedValueLib
($code, $item->{ccode
});
63 if(my $code = GetAuthValCode
("items.materials", $fw)) {
64 $item->{materials
} = GetKohaAuthorisedValueLib
($code, $item->{materials
});
67 my $itemtype = getitemtypeinfo
($item->{itype
});
68 $item->{itemtype
} = $itemtype->{description
};
71 my $json_text = to_json
( $item, { utf8
=> 1 } );
73 output_with_http_headers
$cgi, undef, $json_text, 'json';