bug-1565, added close , and search-again links
[koha.git] / catalogue / detail.pl
blob998ab1e24f6ee600db18b7771ded9d8fcf51b7a3
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
8 # version.
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
19 use strict;
20 require Exporter;
21 use CGI;
22 use C4::Auth;
23 use C4::Serials; #uses getsubscriptionfrom biblionumber
24 use C4::Output;
25 use C4::Biblio;
26 use C4::Serials;
28 my $query = new CGI;
29 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
31 template_name => "catalogue/detail.tmpl",
32 query => $query,
33 type => "intranet",
34 authnotrequired => 0,
35 flagsrequired => { catalogue => 1 },
39 my $biblionumber = $query->param('biblionumber');
41 # change back when ive fixed request.pl
42 my @items = &GetItemsInfo( $biblionumber, 'intra' );
43 my $dat = &GetBiblioData($biblionumber);
45 if (!$dat) {
46 print $query->redirect("/cgi-bin/koha/koha-tmpl/errors/404.pl");
49 #coping with subscriptions
50 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
51 my @subscriptions = GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber );
53 my @subs;
54 foreach my $subscription (@subscriptions) {
55 my %cell;
56 $cell{subscriptionid} = $subscription->{subscriptionid};
57 $cell{subscriptionnotes} = $subscription->{notes};
59 #get the three latest serials.
60 $cell{latestserials} =
61 GetLatestSerials( $subscription->{subscriptionid}, 3 );
62 push @subs, \%cell;
65 $dat->{'count'} = @items;
67 my $norequests = 1;
68 foreach my $itm (@items) {
69 $norequests = 0
70 unless ( ( $itm->{'notforloan'} > 0 )
71 || ( $itm->{'itemnotforloan'} > 0 ) );
72 $itm->{ $itm->{'publictype'} } = 1;
75 $template->param( norequests => $norequests );
77 ## get notes and subjects from MARC record
78 my $dbh = C4::Context->dbh;
79 my $marcflavour = C4::Context->preference("marcflavour");
80 my $record = GetMarcBiblio($biblionumber);
81 my $marcnotesarray = GetMarcNotes( $record, $marcflavour );
82 my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
83 my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
85 $template->param(
86 MARCNOTES => $marcnotesarray,
87 MARCSUBJCTS => $marcsubjctsarray,
88 MARCAUTHORS => $marcauthorsarray
91 my @results = ( $dat, );
92 foreach ( keys %{$dat} ) {
93 $template->param( "$_" => $dat->{$_} . "" );
96 $template->param(
97 ITEM_RESULTS => \@items,
98 biblionumber => $biblionumber,
99 subscriptions => \@subs,
100 subscriptionsnumber => $subscriptionsnumber,
101 subscriptiontitle => $dat->{title},
104 output_html_with_http_headers $query, $cookie, $template->output;