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