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