3 # Copyright BibLibre 2012
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
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';