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
46 use C4
::Serials
; # CountSubscriptionFromBiblionumber
47 use C4
::Search
; # enabled_staff_search_views
48 use C4
::Acquisition
qw(GetOrdersByBiblionumber);
52 use Koha
::RecordProcessor
;
56 my $dbh = C4
::Context
->dbh;
58 my $biblionumber = $query->param('biblionumber');
59 $biblionumber = HTML
::Entities
::encode
($biblionumber);
62 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
64 template_name
=> "catalogue/ISBDdetail.tt",
68 flagsrequired
=> { catalogue
=> 1 },
72 if ( not defined $biblionumber ) {
73 # biblionumber invalid -> report and exit
74 $template->param( unknownbiblionumber
=> 1,
75 biblionumber
=> $biblionumber
77 output_html_with_http_headers
$query, $cookie, $template->output;
81 my $record = GetMarcBiblio
({
82 biblionumber
=> $biblionumber,
85 if ( not defined $record ) {
86 # biblionumber invalid -> report and exit
87 $template->param( unknownbiblionumber
=> 1,
88 biblionumber
=> $biblionumber
90 output_html_with_http_headers
$query, $cookie, $template->output;
94 my $biblio = Koha
::Biblios
->find( $biblionumber );
95 my $framework = GetFrameworkCode
( $biblionumber );
96 my $record_processor = Koha
::RecordProcessor
->new({
97 filters
=> 'ViewPolicy',
99 interface
=> 'intranet',
100 frameworkcode
=> $framework
103 $record_processor->process($record);
105 my $res = GetISBDView
({
107 'template' => 'intranet',
108 'framework' => $framework,
111 if($query->cookie("holdfor")){
112 my $holdfor_patron = Koha
::Patrons
->find( $query->cookie("holdfor") );
114 holdfor
=> $query->cookie("holdfor"),
115 holdfor_surname
=> $holdfor_patron->surname,
116 holdfor_firstname
=> $holdfor_patron->firstname,
117 holdfor_cardnumber
=> $holdfor_patron->cardnumber,
121 # count of item linked with biblio
122 my $itemcount = $biblio->items->count;
123 $template->param( count
=> $itemcount);
124 my $subscriptionsnumber = CountSubscriptionFromBiblionumber
($biblionumber);
126 if ($subscriptionsnumber) {
127 my $subscriptions = GetSubscriptionsFromBiblionumber
($biblionumber);
128 my $subscriptiontitle = $subscriptions->[0]{'bibliotitle'};
130 subscriptionsnumber
=> $subscriptionsnumber,
131 subscriptiontitle
=> $subscriptiontitle,
137 biblionumber
=> $biblionumber,
139 z3950_search_params
=> C4
::Search
::z3950_search_args
(GetBiblioData
($biblionumber)),
140 ocoins
=> GetCOinSBiblio
($record),
141 C4
::Search
::enabled_staff_search_views
,
142 searchid
=> scalar $query->param('searchid'),
145 my @allorders_using_biblio = GetOrdersByBiblionumber
($biblionumber);
146 my @deletedorders_using_biblio;
147 my @orders_using_biblio;
149 my @baskets_deletedorders;
151 foreach my $myorder (@allorders_using_biblio) {
152 my $basket = $myorder->{'basketno'};
153 if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){
154 push @deletedorders_using_biblio, $myorder;
155 unless (grep(/^$basket$/, @baskets_deletedorders)){
156 push @baskets_deletedorders,$myorder->{'basketno'};
160 push @orders_using_biblio, $myorder;
161 unless (grep(/^$basket$/, @baskets_orders)){
162 push @baskets_orders,$myorder->{'basketno'};
167 my $count_orders_using_biblio = scalar @orders_using_biblio ;
168 $template->param (countorders
=> $count_orders_using_biblio);
170 my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ;
171 $template->param (countdeletedorders
=> $count_deletedorders_using_biblio);
173 my $biblio = Koha
::Biblios
->find( $biblionumber );
174 my $holds = $biblio->holds;
175 $template->param( holdcount
=> $holds->count );
177 output_html_with_http_headers
$query, $cookie, $template->output;