3 # Copyright 2000-2002 Katipo Communications
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>.
22 ISBDdetail.pl : script to show a biblio in ISBD format
30 This script needs a biblionumber as parameter
39 use C4::Auth qw( get_template_and_user );
41 use C4::Output qw( output_html_with_http_headers );
43 use C4::Biblio qw( GetBiblioData GetFrameworkCode GetISBDView GetMarcBiblio );
44 use C4::Serials qw( CountSubscriptionFromBiblionumber GetSubscription GetSubscriptionsFromBiblionumber );
45 use C4::Search qw( z3950_search_args enabled_staff_search_views );
49 use Koha::RecordProcessor;
50 use Koha::Virtualshelves;
54 my $dbh = C4::Context->dbh;
56 my $biblionumber = $query->param('biblionumber');
57 $biblionumber = HTML::Entities::encode($biblionumber);
60 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
62 template_name => "catalogue/ISBDdetail.tt",
65 flagsrequired => { catalogue => 1 },
69 if ( not defined $biblionumber ) {
70 # biblionumber invalid -> report and exit
71 $template->param( unknownbiblionumber => 1,
72 biblionumber => $biblionumber
74 output_html_with_http_headers $query, $cookie, $template->output;
78 my $record = GetMarcBiblio({
79 biblionumber => $biblionumber,
82 if ( not defined $record ) {
83 # biblionumber invalid -> report and exit
84 $template->param( unknownbiblionumber => 1,
85 biblionumber => $biblionumber
87 output_html_with_http_headers $query, $cookie, $template->output;
91 my $biblio = Koha::Biblios->find( $biblionumber );
92 my $framework = GetFrameworkCode( $biblionumber );
93 my $record_processor = Koha::RecordProcessor->new({
94 filters => 'ViewPolicy',
96 interface => 'intranet',
97 frameworkcode => $framework
100 $record_processor->process($record);
102 my $res = GetISBDView({
104 'template' => 'intranet',
105 'framework' => $framework,
108 if($query->cookie("holdfor")){
109 my $holdfor_patron = Koha::Patrons->find( $query->cookie("holdfor") );
111 holdfor => $query->cookie("holdfor"),
112 holdfor_surname => $holdfor_patron->surname,
113 holdfor_firstname => $holdfor_patron->firstname,
114 holdfor_cardnumber => $holdfor_patron->cardnumber,
118 if( $query->cookie("searchToOrder") ){
119 my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") );
121 searchtoorder_basketno => $basketno,
122 searchtoorder_vendorid => $vendorid
126 # count of item linked with biblio
127 my $itemcount = $biblio->items->count;
128 $template->param( count => $itemcount);
129 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
131 if ($subscriptionsnumber) {
132 my $subscriptions = GetSubscriptionsFromBiblionumber($biblionumber);
133 my $subscriptiontitle = $subscriptions->[0]{'bibliotitle'};
135 subscriptionsnumber => $subscriptionsnumber,
136 subscriptiontitle => $subscriptiontitle,
140 # get biblionumbers stored in the cart
143 if($query->cookie("intranet_bib_list")){
144 my $cart_list = $query->cookie("intranet_bib_list");
145 @cart_list = split(/\//, $cart_list);
146 if ( grep {$_ eq $biblionumber} @cart_list) {
147 $template->param( incart => 1 );
151 my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
153 borrowernumber => $loggedinuser,
158 my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
160 borrowernumber => $loggedinuser,
168 add_to_some_private_shelves => $some_private_shelves,
169 add_to_some_public_shelves => $some_public_shelves,
174 biblionumber => $biblionumber,
176 z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
177 ocoins => $biblio->get_coins,
178 C4::Search::enabled_staff_search_views,
179 searchid => scalar $query->param('searchid'),
183 my $holds = $biblio->holds;
184 $template->param( holdcount => $holds->count );
186 output_html_with_http_headers $query, $cookie, $template->output;