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
26 use C4::Biblio; # to use &GetBiblioItemData &itemissues
28 use C4::Output; # contains gettemplate
31 use C4::Circulation; # to use itemissues
35 # FIXME subject is not exported to the template?
36 my $subject=$query->param('subject');
38 # if its a subject we need to use the subject.tmpl
39 my ($template, $loggedinuser, $cookie) = get_template_and_user({
40 template_name => ($subject? 'catalogue/subject.tmpl':
41 'catalogue/moredetail.tmpl'),
45 flagsrequired => {catalogue => 1},
50 my $biblionumber=$query->param('biblionumber');
51 my $title=$query->param('title');
52 my $bi=$query->param('bi');
54 my $data=GetBiblioItemData($bi);
55 my $dewey = $data->{'dewey'};
56 # FIXME Dewey is a string, not a number, & we should use a function
58 if ($dewey eq "000.") { $dewey = "";};
59 if ($dewey < 10){$dewey='00'.$dewey;}
60 if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}
65 $data->{'dewey'}=$dewey;
69 my $items= GetItemIssues($bi);
71 $data->{'count'}=$count;
73 my $ordernum = GetOrderNumber($biblionumber,$bi);
74 my $order = GetOrder($ordernum);
78 foreach my $item (@$items){
79 $item->{'replacementprice'}=sprintf("%.2f", $item->{'replacementprice'});
80 $item->{'datelastborrowed'}= format_date($item->{'datelastborrowed'});
81 $item->{'dateaccessioned'} = format_date($item->{'dateaccessioned'});
82 $item->{'datelastseen'} = format_date($item->{'datelastseen'});
83 $item->{'ordernumber'} = $ordernum;
84 $item->{'booksellerinvoicenumber'} = $order->{'booksellerinvoicenumber'};
86 if ($item->{'date_due'} eq 'Available'){
89 $item->{'date_due'} = format_date($item->{'date_due'});
91 $item->{'borrowernumber'} = $item->{'borrower'};
92 $item->{'cardnumber'} = $item->{'card'};
96 $template->param(BIBITEM_DATA => \@results);
97 $template->param(ITEM_DATA => \@$items);
98 $template->param(loggedinuser => $loggedinuser);
100 output_html_with_http_headers $query, $cookie, $template->output;