Replaced expressions of the form "$x = $x <op> $y" with "$x <op>= $y".
[koha.git] / moredetail.pl
1 #!/usr/bin/perl
2
3 # $Id$
4
5 # Copyright 2000-2002 Katipo Communications
6 #
7 # This file is part of Koha.
8 #
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
12 # version.
13 #
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA  02111-1307 USA
21
22 use HTML::Template;
23 use strict;
24 require Exporter;
25 use C4::Koha;
26 use CGI;
27 use C4::Search;
28 use C4::Acquisitions;
29 use C4::Output; # contains gettemplate
30
31 my $query=new CGI;
32
33 my $includes = C4::Context->config('includes') ||
34         "/usr/local/www/hdl/htdocs/includes";
35 my $startfrom=$query->param('startfrom') || 0;
36
37
38 my $template = gettemplate("catalogue/moredetail.tmpl");
39
40 # get variables
41
42 my $biblionumber=$query->param('bib');
43 my $title=$query->param('title');
44 my $bi=$query->param('bi');
45
46 my $data=bibitemdata($bi);
47 my $dewey = $data->{'dewey'};
48 $dewey =~ s/0+$//;
49 if ($dewey eq "000.") { $dewey = "";};
50 if ($dewey < 10){$dewey='00'.$dewey;}
51 if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}
52 if ($dewey <= 0){
53       $dewey='';
54 }
55 $dewey=~ s/\.$//;
56 $data->{'dewey'}=$dewey;
57
58 my @results;
59
60 my (@items)=itemissues($bi);
61 my $count=@items;
62 $data->{'count'}=$count;
63 my ($order,$ordernum)=getorder($bi,$biblionumber);
64
65
66 my $env;
67 $env->{itemcount}=1;
68
69 $results[0]=$data;
70
71 foreach my $item (@items){
72     $item->{'itemlost'}=~ s/0/No/;
73     $item->{'itemlost'}=~ s/1/Yes/;
74     $item->{'withdrawn'}=~ s/0/No/;
75     $item->{'withdrawn'}=~ s/1/Yes/;
76     $item->{'replacementprice'}+=0.00;
77     my $year=substr($item->{'timestamp0'},0,4);
78     my $mon=substr($item->{'timestamp0'},4,2);
79     my $day=substr($item->{'timestamp0'},6,2);
80     $item->{'timestamp0'}="$day/$mon/$year";
81     $item->{'dateaccessioned'} = slashifyDate($item->{'dateaccessioned'});
82     $item->{'datelastseen'} = slashifyDate($item->{'datelastseen'});
83     $item->{'ordernumber'} = $ordernum;
84     $item->{'booksellerinvoicenumber'} = $order->{'booksellerinvoicenumber'};
85
86     # FIXME - This should be "==", not "=", right?
87     if ($item->{'date_due'} = 'Available'){
88         $item->{'issue'}="<b>Available</b><br>";
89     } else {
90         $item->{'issue'}="<b>Currently on issue to:</b> <a href=/cgi-bin/koha/moremember.pl?bornum=$item->{'borrower0'}>$item->{'card'}</a><br>";
91     }
92 }
93
94 $template->param(includesdir => $includes);
95 $template->param(BIBITEM_DATA => \@results);
96 $template->param(ITEM_DATA => \@items);
97 print "Content-Type: text/html\n\n", $template->output;
98