Initial revision
[koha.git] / detail.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
12 my $input = new CGI;
13 print $input->header;
14 #whether it is called from the opac of the intranet
15 my $type=$input->param('type');
16 if ($type eq ''){
17   $type='intra';
18 }
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 #print $type;
32 my $blah;
33 my $bib=$input->param('bib');
34 my $title=$input->param('title');
35 if ($type ne 'opac'){
36   print "<a href=request.pl?bib=$bib><img height=42  WIDTH=120 BORDER=0 src=\"/images/requests.gif\" align=right border=0></a>";
37 }
38
39
40 my @items=ItemInfo(\$blah,$bib,$type);
41 my $dat=bibdata($bib);
42 my $count=@items;
43 my ($count3,$addauthor)=addauthor($bib);
44 my $additional=$addauthor->[0]->{'author'};                                                             
45 for (my $i=1;$i<$count3;$i++){                                                                          
46   $additional=$additional."|".$addauthor->[$i]->{'author'};                                             
47 }  
48 my @temp=split('\t',$items[0]);
49 print mkheadr(3,"$dat->{'title'} ($dat->{'author'}) $temp[4]");
50 print <<printend
51
52 <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left width="220">
53
54 <!-----------------BIBLIO RECORD TABLE--------->
55
56
57 <form action=/cgi-bin/koha/modbib.pl method=post>
58 <input type=hidden name=bibnum value=$bib>
59 <TR VALIGN=TOP>
60
61 <td  bgcolor="$main" 
62 printend
63 ;
64 if ($type ne 'opac'){
65  print "background=\"/images/background-mem.gif\"";
66 }
67 print <<printend
68 ><B>BIBLIO RECORD 
69 printend
70 ;
71 if ($type ne 'opac'){
72   print "$bib";
73 }
74 print <<printend
75 </TD></TR>
76
77
78 <tr VALIGN=TOP  >
79 <TD>
80 printend
81 ;
82 if ($type ne 'opac'){
83   print "<INPUT TYPE=\"image\" name=\"submit\"  VALUE=\"modify\" height=42  WIDTH=93 BORDER=0 src=\"/images/modify-mem.gif\"> 
84   <INPUT TYPE=\"image\" name=\"delete\"  VALUE=\"delete\" height=42  WIDTH=93 BORDER=0 src=\"/images/delete-mem.gif\">";
85 }
86 print <<printend
87 <br>
88 <FONT SIZE=2  face="arial, helvetica">
89 printend
90 ;
91
92
93 if ($type ne 'opac'){
94 print <<printend
95 <b>Subtitle:</b> $dat->{'subtitle'}<br>
96 <b>Author:</b> $dat->{'author'}<br>
97 <b>Additional Author:</b> $additional<br>
98 <b>Series Title:</b> $dat->{'seriestitle'}<br>
99 <b>Subject:</b> $dat->{'subject'}<br>
100 <b>Copyright:</b> $dat->{'copyrightdate'}<br>
101 <b>Notes:</b> $dat->{'notes'}<br>
102 <b>Unititle:</b> $dat->{'unititle'}<br>
103 <b>Analytical Author:</b> <br>
104 <b>Analytical Title:</b> <br>
105 <b>Serial:</b> $dat->{'serial'}<br>
106 <b>Total Number of Items:</b> $count
107 <p>
108 printend
109 ;
110 }
111 else {
112 if ($dat->{'subtitle'} ne ''){
113   print "<b>Subtitle:</b> $dat->{'subtitle'}<br>";
114 }
115 if ($dat->{'author'} ne ''){
116   print "<b>Author:</b> $dat->{'author'}<br>";
117 }
118 #Additional Author: <br>
119 if ($dat->{'seriestitle'} ne ''){
120   print "<b>Seriestitle:</b> $dat->{'seriestitle'}<br>";
121 }
122 if ($dat->{'subject'} ne ''){
123   print "<b>Subject:</b> $dat->{'subject'}<br>";
124 }
125 if ($dat->{'copyrightdate'} ne ''){
126   print "<b>Copyright:</b> $dat->{'copyrightdate'}<br>";
127 }
128 if ($dat->{'notes'} ne ''){
129   print "<b>Notes:</b> $dat->{'notes'}<br>";
130 }
131 if ($dat->{'unititle'} ne ''){
132   print "<b>Unititle:</b> $dat->{'unititle'}<br>";
133 }
134 #Analytical Author: <br>
135 #Analytical Title: <br>
136 if ($dat->{'serial'} ne '0'){
137  print "<b>Serial:</b> Yes<br>";
138 }
139 print "<b>Total Number of Items:</b> $count
140 <p>
141 ";
142
143 }
144 print <<printend
145 </form>
146 </font></TD>
147 </TR>
148
149 </TABLE>
150 <img src="/images/holder.gif" width=16 height=300 align=left>
151
152 printend
153 ;
154
155
156 #print @items;
157
158 my $i=0;
159 print center();
160 print mktablehdr;
161 if ($type eq 'opac'){
162
163   print mktablerow(6,$main,'Item Type','Class','Branch','Date Due','Last Seen'); 
164 } else {
165   print mktablerow(6,$main,'Itemtype','Class','Location','Date Due','Last Seen','Barcode',"/images/background-mem.gif"); 
166 }
167 my $colour=1;
168 while ($i < $count){
169 #  print $items[$i],"<br>";
170   my @results=split('\t',$items[$i]);
171   if ($type ne 'opac'){
172     $results[1]=mklink("/cgi-bin/koha/moredetail.pl?item=$results[5]&bib=$bib&bi=$results[8]",$results[1]);
173   }
174   if ($results[2] eq ''){
175     $results[2]='Available';
176   }
177   if ($colour == 1){
178     if ($type ne 'opac'){
179 #      if ($results[6] eq 'PER'){
180         print mktablerow(7,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9]);
181 #      } else {
182 #            print mktablerow(6,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);
183 #      }
184     } else {
185        $results[6]=ItemType($results[6]);
186 #       if ($results[6] =~ /Periodical/){
187           print mktablerow(6,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[9]);
188 #       } else {
189 #         print mktablerow(5,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7]);
190 #       }       
191     } 
192     $colour=0;                                                                                
193   } else{                                                                                     
194     if ($type ne 'opac'){
195 #      if ($results[6] eq 'PER'){
196       print mktablerow(7,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9]);                                          
197 #      }else{
198 #           print mktablerow(6,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);                                          
199 #      }
200     } else {
201       $results[6]=ItemType($results[6]);
202 #       if ($results[6] =~ /Periodical/){
203           print mktablerow(6,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[9]);
204 #       } else {
205 #         print mktablerow(5,'white',$results[6],$results[4],$results[3],$results[2],$results[7]);
206 #       }       
207     }
208     $colour=1;                                                                                
209   }
210    $i++;
211 }
212
213 print mktableft();
214 print "<p>";
215 print mktablehdr();
216 if ($type ne 'opac'){
217 print <<printend
218 <TR VALIGN=TOP>
219 <TD  bgcolor="99cc33" background="/images/background-mem.gif" colspan=2><p><b>HELP</b><br>
220 <b>Update Biblio for all Items:</b> Click on the <b>Modify</b> button [left] to amend the biblio.  Any changes you make will update the record for <b>all</b> the items listed above. <p>
221 <b>Updating the Biblio for only ONE or SOME Items:</b> If some of the items listed above need a different biblio, or are on the wrong biblio, you must use the <a href="acquisitions/">acquisitions</a> process to fix this. You will need to "re-order" the items, and delete them from this biblio.<p>
222
223    </TR>
224 printend
225 ;
226 }
227 print mktableft();
228 print endcenter();
229 print "<br clear=all>";
230 print endmenu($type);
231 print endpage();