fixed a couple of bugs. Note this version of opac-reserve.pl is designed to work...
[koha.git] / opac / opac-moredetail.pl
1 #!/usr/bin/perl
2
3 #script to display detailed information
4 #written 8/11/99
5
6 use strict;
7 #use DBI;
8 use C4::Search;
9 use C4::Koha;
10 use C4::Output;
11 use C4::Acquisitions;
12 use C4::Biblio;
13 use HTML::Template;
14
15 use CGI;
16 my $input = new CGI;
17 print $input->header;
18 #whether it is called from the opac of the intranet
19 my $type=$input->param('type');
20 #setup colours
21 my $main;
22 my $secondary;
23 if ($type eq 'opac'){
24   $main='#99cccc';
25   $secondary='#efe5ef';
26 } else {
27   $main='#cccc99';
28   $secondary='#ffffcc';
29 }
30 print startpage();
31 print startmenu($type);
32 my $blah;
33
34 my $bib=$input->param('bib');
35 my $title=$input->param('title');
36 my $bi=$input->param('bi');
37 my $data=bibitemdata($bi);
38
39 my (@items)=itemissues($bi);
40 my ($order,$ordernum)=getorder($bi,$bib);
41 #print @items;
42 my $count=@items;
43
44 my $i=0;
45 print center();
46
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 print <<printend
57 <br>
58 <a href=/cgi-bin/koha/request.pl?bib=$bib><img src=/images/requests.gif width=120 height=42 border=0 align=right border=0></a>
59 printend
60 ;
61 if ($type eq 'catmain'){
62   print "<FONT SIZE=6><em>Catalogue Maintenance</em></FONT><br>";
63 }
64 print <<printend
65 <FONT SIZE=6><em><a href=/cgi-bin/koha/detail.pl?bib=$bib&type=intra>$data->{'title'} ($data->{'author'})</a></em></FONT><P>
66 <p>
67 <form action=/cgi-bin/koha/modbibitem.pl>
68 <input type=hidden name=bibitem value=$bi>
69 <input type=hidden name=biblio value=$bib>
70 <!-------------------BIBLIO ITEM------------>
71 <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left>
72 <TR VALIGN=TOP>
73 <td  bgcolor="99cc33" background="/images/background-mem.gif" ><B>$data->{'biblioitemnumber'} GROUP - $data->{'description'} </b> </TD>
74 </TR>
75 <tr VALIGN=TOP  >
76 <TD width=210 >
77 <INPUT TYPE="image" name="submit"  VALUE="modify" height=42  WIDTH=93 BORDER=0 src="/images/modify-mem.gif">
78 <INPUT TYPE="image" name="delete"  VALUE="delete" height=42  WIDTH=93 BORDER=0 src="/images/delete-mem.gif">
79 <br>
80 <FONT SIZE=2  face="arial, helvetica">
81 <b>Biblionumber:</b> $bib<br>
82 <b>Item Type:</b> $data->{'itemtype'}<br>
83 <b>Loan Length:</b> $data->{'loanlength'}<br>
84 <b>Rental Charge:</b> $data->{'rentalcharge'}<br>
85 <b>Classification:</b> $data->{'classification'}$dewey$data->{'subclass'}<br>
86 <b>ISBN:</b> $data->{'isbn'}<br>
87 <b>Publisher:</b> $data->{'publishercode'} <br>
88 <b>Place:</b> $data->{'place'}<br>
89 <b>Date:</b> $data->{'publicationyear'}<br>
90 <b>Volume:</b> $data->{'volumeddesc'}<br>
91 <b>Pages:</b> $data->{'pages'}<br>
92 <b>Illus:</b> $data->{'illus'}<br>
93 <b>Size:</b> $data->{'size'}<br>
94 <b>Notes:</b> $data->{'bnotes'}<br>
95 <b>No. of Items:</b> $count
96
97 printend
98 ;
99 if ($type eq 'catmain'){
100   print "<br><a href=/cgi-bin/koha/maint/shiftbib.pl?bi=$data->{'biblioitemnumber'}&bib=$data->{'biblionumber'}>Shift to another biblio</a>";
101
102 }
103 print <<printend
104
105 </font>
106 </TD>
107 </tr>
108 </table>
109 </form>
110 printend
111 ;
112
113 for (my $i=0;$i<$count;$i++){
114 print <<printend
115 <img src="/images/holder.gif" width=16 height=300 align=left>
116 <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left width=220 >
117 <TR VALIGN=TOP>
118 <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>BARCODE $items[$i]->{'barcode'}</b></TD>
119 </TR>
120 <tr VALIGN=TOP  >
121 <TD width=220 >
122 <form action=/cgi-bin/koha/moditem.pl method=post>
123 <input type=hidden name=bibitem value=$bi>
124 <input type=hidden name=item value=$items[$i]->{'itemnumber'}>
125 <input type=hidden name=type value=$type>
126 <INPUT TYPE="image" name="submit"  VALUE="modify" height=42  WIDTH=93 BORDER=0 src="/images/modify-mem.gif">
127 <INPUT TYPE="image" name="delete"  VALUE="delete" height=42  WIDTH=93 BORDER=0 src="/images/delete-mem.gif">
128 <br>
129 printend
130 ;
131 $items[$i]->{'itemlost'}=~ s/0/No/;
132 $items[$i]->{'itemlost'}=~ s/1/Yes/;
133 $items[$i]->{'withdrawn'}=~ s/0/No/;
134 $items[$i]->{'withdrawn'}=~ s/1/Yes/;
135 $items[$i]->{'replacementprice'}+=0.00;
136
137 my $year=substr($items[$i]->{'timestamp0'},0,4);
138 my $mon=substr($items[$i]->{'timestamp0'},4,2);
139 my $day=substr($items[$i]->{'timestamp0'},6,2);
140 $items[$i]->{'timestamp0'}="$day/$mon/$year";
141
142 $items[$i]->{'dateaccessioned'} = slashifyDate($items[$i]->{'dateaccessioned'});
143 $items[$i]->{'datelastseen'} = slashifyDate($items[$i]->{'datelastseen'});
144
145 print <<printend
146 <FONT SIZE=2  face="arial, helvetica">
147 <b>Home Branch:</b> $items[$i]->{'homebranch'}<br>
148 <b>Last seen:</b> $items[$i]->{'datelastseen'}<br>
149 <b>Last borrowed:</b> $items[$i]->{'timestamp0'}<br>
150 printend
151 ;
152 if ($items[$i] eq 'Available'){
153   print "<b>Currently on issue to:</b><br>";
154 } else {
155   print "<b>Currently on issue to:</b> <a href=/cgi-bin/koha/moremember.pl?bornum=$items[$i]->{'borrower0'}>$items[$i]->{'card'}</a><br>";
156 }
157 print <<printend
158 <b>Last Borrower 1:</b> $items[$i]->{'card0'}<br>
159 <b>Last Borrower 2:</b> $items[$i]->{'card1'}<br>
160 <b>Current Branch:</b> $items[$i]->{'holdingbranch'}<br>
161 <b>Replacement Price:</b> $items[$i]->{'replacementprice'}<br>
162 <b>Item lost:</b> $items[$i]->{'itemlost'}<br>
163 <b>Paid for:</b> $items[$i]->{'paidfor'}<br>
164 <b>Notes:</b> $items[$i]->{'itemnotes'}<br>
165 <b>Renewals:</b> $items[$i]->{'renewals'}<br>
166 <b><a href=/cgi-bin/koha/acqui/acquire.pl?recieve=$ordernum&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession</a> Date: $items[$i]->{'dateaccessioned'}<br>
167 printend
168 ;
169 if ($items[$i]->{'wthdrawn'} eq '1'){
170   $items[$i]->{'wthdrawn'}="Yes";
171 } else {
172   $items[$i]->{'wthdrawn'}="No";
173 }
174 print <<printend
175 <b>Cancelled: $items[$i]->{'wthdrawn'}<br>
176 <b>Total Issues:</b> $items[$i]->{'issues'}<br>
177 <b>Group Number:</b> $bi <br>
178 <b>Biblio number:</b> $bib <br>
179
180
181
182 </font>
183 </TD>
184 </tr>
185 </table>
186 </form>
187 printend
188 ;
189 }
190 print <<printend
191 <p>
192 </form>
193 printend
194 ;
195
196
197 print endcenter();
198
199 print endmenu($type);
200 print endpage();