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