3 # Copyright 2000-2002 Katipo Communications
4 # parts copyright 2010 BibLibre
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
24 opac-ISBDdetail.pl - script to show a biblio in ISBD format
28 This script needs a biblionumber as parameter
32 The template is in <templates_dir>/catalogue/ISBDdetail.tt.
33 this template must be divided into 11 "tabs".
35 The first 10 tabs present the biblio, the 11th one presents
36 the items attached to the biblio
53 use C4
::Serials
; # uses getsubscriptionfrom biblionumber
55 use C4
::Members
; # GetMember
56 use Koha
::RecordProcessor
;
59 my $query = CGI
->new();
60 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
62 template_name
=> "opac-ISBDdetail.tt",
65 authnotrequired
=> ( C4
::Context
->preference("OpacPublic") ?
1 : 0 ),
70 my $biblionumber = $query->param('biblionumber');
71 $biblionumber = int($biblionumber);
73 # get biblionumbers stored in the cart
74 if(my $cart_list = $query->cookie("bib_list")){
75 my @cart_list = split(/\//, $cart_list);
76 if ( grep {$_ eq $biblionumber} @cart_list) {
77 $template->param( incart
=> 1 );
81 $template->param( 'ItemsIssued' => CountItemsIssued
( $biblionumber ) );
83 my $marcflavour = C4
::Context
->preference("marcflavour");
85 my @items = GetItemsInfo
($biblionumber);
86 if (scalar @items >= 1) {
87 my @hiddenitems = GetHiddenItemnumbers
(@items);
89 if (scalar @hiddenitems == scalar @items ) {
90 print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
95 my $record = GetMarcBiblio
($biblionumber,1);
97 print $query->redirect("/cgi-bin/koha/errors/404.pl");
100 my $framework = GetFrameworkCode
( $biblionumber );
101 my $record_processor = Koha
::RecordProcessor
->new({
102 filters
=> 'ViewPolicy',
105 frameworkcode
=> $framework
108 $record_processor->process($record);
110 # some useful variables for enhanced content;
111 # in each case, we're grabbing the first value we find in
112 # the record and normalizing it
113 my $upc = GetNormalizedUPC
($record,$marcflavour);
114 my $ean = GetNormalizedEAN
($record,$marcflavour);
115 my $oclc = GetNormalizedOCLCNumber
($record,$marcflavour);
116 my $isbn = GetNormalizedISBN
(undef,$record,$marcflavour);
117 my $content_identifier_exists;
118 if ( $isbn or $ean or $oclc or $upc ) {
119 $content_identifier_exists = 1;
122 normalized_upc
=> $upc,
123 normalized_ean
=> $ean,
124 normalized_oclc
=> $oclc,
125 normalized_isbn
=> $isbn,
126 content_identifier_exists
=> $content_identifier_exists,
129 #coping with subscriptions
130 my $subscriptionsnumber = CountSubscriptionFromBiblionumber
($biblionumber);
131 my $dbh = C4
::Context
->dbh;
132 my $dat = TransformMarcToKoha
( $record );
134 my @subscriptions = SearchSubscriptions
({ biblionumber
=> $biblionumber, orderby
=> 'title' });
136 foreach my $subscription (@subscriptions) {
138 my $serials_to_display;
139 $cell{subscriptionid
} = $subscription->{subscriptionid
};
140 $cell{subscriptionnotes
} = $subscription->{notes
};
141 $cell{branchcode
} = $subscription->{branchcode
};
143 #get the three latest serials.
144 $serials_to_display = $subscription->{opacdisplaycount
};
145 $serials_to_display = C4
::Context
->preference('OPACSerialIssueDisplayCount') unless $serials_to_display;
146 $cell{opacdisplaycount
} = $serials_to_display;
147 $cell{latestserials
} =
148 GetLatestSerials
( $subscription->{subscriptionid
}, $serials_to_display );
153 subscriptions
=> \
@subs,
154 subscriptionsnumber
=> $subscriptionsnumber,
158 my $allow_onshelf_holds;
159 my $res = GetISBDView
({
161 'template' => 'opac',
162 'framework' => $framework
165 my $itemtypes = GetItemTypes
();
166 my $borrower = GetMember
( 'borrowernumber' => $loggedinuser );
167 for my $itm (@items) {
170 && !$itm->{'withdrawn'}
171 && !$itm->{'itemlost'}
172 && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'})
173 && !$itemtypes->{$itm->{'itype'}}->{notforloan
}
174 && $itm->{'itemnumber'};
176 $allow_onshelf_holds = C4
::Reserves
::OnShelfHoldsAllowed
($itm, $borrower)
177 unless $allow_onshelf_holds;
181 RequestOnOpac
=> C4
::Context
->preference("RequestOnOpac"),
182 AllowOnShelfHolds
=> $allow_onshelf_holds,
183 norequests
=> $norequests,
185 biblionumber
=> $biblionumber,
188 #Search for title in links
189 my $marccontrolnumber = GetMarcControlnumber
($record, $marcflavour);
190 my $marcissns = GetMarcISSN
( $record, $marcflavour );
191 my $issn = $marcissns->[0] || '';
193 if (my $search_for_title = C4
::Context
->preference('OPACSearchForTitleIn')){
194 $dat->{title
} =~ s/\/+$//; # remove trailing slash
195 $dat->{title
} =~ s/\s+$//; # remove trailing space
196 $search_for_title = parametrized_url
(
199 TITLE
=> $dat->{title
},
200 AUTHOR
=> $dat->{author
},
203 CONTROLNUMBER
=> $marccontrolnumber,
204 BIBLIONUMBER
=> $biblionumber,
207 $template->param('OPACSearchForTitleIn' => $search_for_title);
210 output_html_with_http_headers
$query, $cookie, $template->output;