3 # Copyright 2000-2003 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
29 use C4::Output; # contains gettemplate
32 use C4::Dates qw/format_date/;
33 use C4::Circulation; # to use itemissues
37 # FIXME subject is not exported to the template?
38 my $subject=$query->param('subject');
40 # if its a subject we need to use the subject.tmpl
41 my ($template, $loggedinuser, $cookie) = get_template_and_user({
42 template_name => ($subject? 'catalogue/subject.tmpl':
43 'catalogue/moredetail.tmpl'),
47 flagsrequired => {catalogue => 1},
52 my $biblionumber=$query->param('biblionumber');
53 my $title=$query->param('title');
54 # my $bi=$query->param('bi');
55 # $bi = $biblionumber unless $bi;
56 my $data=GetBiblioData($biblionumber);
57 my $dewey = $data->{'dewey'};
59 #coping with subscriptions
60 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
62 # FIXME Dewey is a string, not a number, & we should use a function
64 # if ($dewey eq "000.") { $dewey = "";};
65 # if ($dewey < 10){$dewey='00'.$dewey;}
66 # if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}
71 # $data->{'dewey'}=$dewey;
74 my $fw = GetFrameworkCode($biblionumber);
75 my @items= GetItemsInfo($biblionumber);
77 $data->{'count'}=$count;
79 my $ordernum = GetOrderNumber($biblionumber);
80 my $order = GetOrder($ordernum);
81 my $ccodes= GetKohaAuthorisedValues('items.ccode',$fw);
82 my $itemtypes = GetItemTypes;
84 $data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'description'};
86 foreach my $item (@items){
87 $item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw),$item->{itemlost}) if GetAuthValCode('items.itemlost',$fw);
88 $item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw),$item->{damaged}) if GetAuthValCode('items.damaged',$fw);
89 $item->{'collection'} = $ccodes->{$item->{ccode}};
90 $item->{'itype'} = $itemtypes->{$item->{'itype'}}->{'description'};
91 $item->{'replacementprice'}=sprintf("%.2f", $item->{'replacementprice'});
92 $item->{'datelastborrowed'}= format_date($item->{'datelastborrowed'});
93 $item->{'dateaccessioned'} = format_date($item->{'dateaccessioned'});
94 $item->{'datelastseen'} = format_date($item->{'datelastseen'});
95 $item->{'ordernumber'} = $ordernum;
96 $item->{'booksellerinvoicenumber'} = $order->{'booksellerinvoicenumber'};
97 $item->{'copyvol'} = $item->{'copynumber'};
98 if ($item->{notforloantext} or $item->{itemlost} or $item->{damaged} or $item->{wthdrawn}) {
99 $item->{status_advisory} = 1;
102 if (C4::Context->preference("IndependantBranches")) {
104 my $userenv = C4::Context->userenv();
105 unless (($userenv->{'flags'} == 1) or ($userenv->{'branch'} eq $item->{'homebranch'})) {
109 $item->{'homebranchname'} = GetBranchName($item->{'homebranch'});
110 $item->{'holdingbranchname'} = GetBranchName($item->{'holdingbranch'});
111 if ($item->{'onloan'} eq ''){
114 $item->{'onloan'} = format_date($item->{'onloan'});
118 $template->param(count => $data->{'count'},
119 subscriptionsnumber => $subscriptionsnumber,
120 subscriptiontitle => $data->{title},
122 $template->param(BIBITEM_DATA => \@results);
123 $template->param(ITEM_DATA => \@items);
124 $template->param(moredetailview => 1);
125 $template->param(loggedinuser => $loggedinuser);
126 $template->param(biblionumber => $biblionumber);
128 output_html_with_http_headers $query, $cookie, $template->output;