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 under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with Koha; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
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.tmpl.
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
54 use C4
::Serials
; # uses getsubscriptionfrom biblionumber
56 use C4
::Members
; # GetMember
58 my $query = CGI
->new();
59 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
61 template_name
=> "opac-ISBDdetail.tmpl",
64 authnotrequired
=> ( C4
::Context
->preference("OpacPublic") ?
1 : 0 ),
69 my $biblionumber = $query->param('biblionumber');
71 # get biblionumbers stored in the cart
74 if($query->cookie("bib_list")){
75 my $cart_list = $query->cookie("bib_list");
76 @cart_list = split(/\//, $cart_list);
77 if ( grep {$_ eq $biblionumber} @cart_list) {
78 $template->param( incart
=> 1 );
82 $template->param( 'AllowOnShelfHolds' => C4
::Context
->preference('AllowOnShelfHolds') );
83 $template->param( 'ItemsIssued' => CountItemsIssued
( $biblionumber ) );
85 my $marcflavour = C4
::Context
->preference("marcflavour");
86 my $record = GetMarcBiblio
($biblionumber);
88 print $query->redirect("/cgi-bin/koha/errors/404.pl");
91 # some useful variables for enhanced content;
92 # in each case, we're grabbing the first value we find in
93 # the record and normalizing it
94 my $upc = GetNormalizedUPC
($record,$marcflavour);
95 my $ean = GetNormalizedEAN
($record,$marcflavour);
96 my $oclc = GetNormalizedOCLCNumber
($record,$marcflavour);
97 my $isbn = GetNormalizedISBN
(undef,$record,$marcflavour);
98 my $content_identifier_exists;
99 if ( $isbn or $ean or $oclc or $upc ) {
100 $content_identifier_exists = 1;
103 normalized_upc
=> $upc,
104 normalized_ean
=> $ean,
105 normalized_oclc
=> $oclc,
106 normalized_isbn
=> $isbn,
107 content_identifier_exists
=> $content_identifier_exists,
110 #coping with subscriptions
111 my $subscriptionsnumber = CountSubscriptionFromBiblionumber
($biblionumber);
112 my $dbh = C4
::Context
->dbh;
113 my $dat = TransformMarcToKoha
( $dbh, $record );
115 my @subscriptions = GetSubscriptions
( $dat->{title
}, $dat->{issn
}, undef, $biblionumber );
117 foreach my $subscription (@subscriptions) {
119 my $serials_to_display;
120 $cell{subscriptionid
} = $subscription->{subscriptionid
};
121 $cell{subscriptionnotes
} = $subscription->{notes
};
122 $cell{branchcode
} = $subscription->{branchcode
};
124 #get the three latest serials.
125 $serials_to_display = $subscription->{opacdisplaycount
};
126 $serials_to_display = C4
::Context
->preference('OPACSerialIssueDisplayCount') unless $serials_to_display;
127 $cell{opacdisplaycount
} = $serials_to_display;
128 $cell{latestserials
} =
129 GetLatestSerials
( $subscription->{subscriptionid
}, $serials_to_display );
134 subscriptions
=> \
@subs,
135 subscriptionsnumber
=> $subscriptionsnumber,
139 my $res = GetISBDView
($biblionumber, "opac");
140 my @items = GetItemsInfo
( $biblionumber );
142 my $itemtypes = GetItemTypes
();
143 for my $itm (@items) {
145 if ( (not $itm->{'wthdrawn'} )
146 && (not $itm->{'itemlost'} )
147 && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} )
148 && (not $itemtypes->{$itm->{'itype'}}->{notforloan
} )
149 && ($itm->{'itemnumber'} ) );
152 my $reviews = getreviews
( $biblionumber, 1 );
153 foreach ( @
$reviews ) {
154 my $borrower_number_review = $_->{borrowernumber
};
155 my $borrowerData = GetMember
('borrowernumber' =>$borrower_number_review);
156 # setting some borrower info into this hash
157 $_->{title
} = $borrowerData->{'title'};
158 $_->{surname
} = $borrowerData->{'surname'};
159 $_->{firstname
} = $borrowerData->{'firstname'};
164 RequestOnOpac
=> C4
::Context
->preference("RequestOnOpac"),
165 AllowOnShelfHolds
=> C4
::Context
->preference('AllowOnShelfHolds'),
166 norequests
=> $norequests,
168 biblionumber
=> $biblionumber,
173 my $OpacExportOptions=C4
::Context
->preference("OpacExportOptions");
174 my @export_options = split(/\|/,$OpacExportOptions);
175 $template->{VARS
}->{'export_options'} = \
@export_options;
177 #Search for title in links
178 my $marccontrolnumber = GetMarcControlnumber
($record, $marcflavour);
179 my $marcissns = GetMarcISSN
( $record, $marcflavour );
180 my $issn = $marcissns->[0] || '';
182 if (my $search_for_title = C4
::Context
->preference('OPACSearchForTitleIn')){
183 $dat->{author
} ?
$search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
184 $dat->{title
} =~ s/\/+$//; # remove trailing slash
185 $dat->{title
} =~ s/\s+$//; # remove trailing space
186 $dat->{title
} ?
$search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
187 $isbn ?
$search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
188 $issn ?
$search_for_title =~ s/{ISSN}/$issn/g : $search_for_title =~ s/{ISSN}//g;
189 $marccontrolnumber ?
$search_for_title =~ s/{CONTROLNUMBER}/$marccontrolnumber/g : $search_for_title =~ s/{CONTROLNUMBER}//g;
190 $search_for_title =~ s/{BIBLIONUMBER}/$biblionumber/g;
191 $template->param('OPACSearchForTitleIn' => $search_for_title);
194 output_html_with_http_headers
$query, $cookie, $template->output;