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