Continuing work on Z39.50 search tool. Daemon now forks up to 12 processes
[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 if ($type eq 'catmain'){
50   print mkheadr(3,"Catalogue Maintenance");
51 }
52 if ($dat->{'author'} ne ''){
53   print mkheadr(3,"$dat->{'title'} ($dat->{'author'}) $temp[4]");
54 } else {
55   print mkheadr(3,"$dat->{'title'} $temp[4]");
56 }
57 print <<printend
58
59 <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left width="220">
60
61 <!-----------------BIBLIO RECORD TABLE--------->
62
63
64 <form action=/cgi-bin/koha/modbib.pl method=post>
65 <input type=hidden name=bibnum value=$bib>
66 <TR VALIGN=TOP>
67
68 <td  bgcolor="$main" 
69 printend
70 ;
71 if ($type ne 'opac'){
72  print "background=\"/images/background-mem.gif\"";
73 }
74 print <<printend
75 ><B>BIBLIO RECORD 
76 printend
77 ;
78 if ($type ne 'opac'){
79   print "$bib";
80 }
81 print <<printend
82 </TD></TR>
83
84
85 <tr VALIGN=TOP  >
86 <TD>
87 printend
88 ;
89 if ($type ne 'opac'){
90   print "<INPUT TYPE=\"image\" name=\"submit\"  VALUE=\"modify\" height=42  WIDTH=93 BORDER=0 src=\"/images/modify-mem.gif\"> 
91   <INPUT TYPE=\"image\" name=\"delete\"  VALUE=\"delete\" height=42  WIDTH=93 BORDER=0 src=\"/images/delete-mem.gif\">";
92 }
93 print <<printend
94 <br>
95 <FONT SIZE=2  face="arial, helvetica">
96 printend
97 ;
98
99
100 if ($type ne 'opac'){
101 print <<printend
102 <b>Subtitle:</b> $dat->{'subtitle'}<br>
103 <b>Author:</b> $dat->{'author'}<br>
104 <b>Additional Author:</b> $additional<br>
105 <b>Series Title:</b> $dat->{'seriestitle'}<br>
106 <b>Subject:</b> $dat->{'subject'}<br>
107 <b>Copyright:</b> $dat->{'copyrightdate'}<br>
108 <b>Notes:</b> $dat->{'notes'}<br>
109 <b>Unititle:</b> $dat->{'unititle'}<br>
110 <b>Analytical Author:</b> <br>
111 <b>Analytical Title:</b> <br>
112 <b>Serial:</b> $dat->{'serial'}<br>
113 <b>Total Number of Items:</b> $count
114 <p>
115 printend
116 ;
117 }
118 else {
119 if ($dat->{'subtitle'} ne ''){
120   print "<b>Subtitle:</b> $dat->{'subtitle'}<br>";
121 }
122 if ($dat->{'author'} ne ''){
123   print "<b>Author:</b> $dat->{'author'}<br>";
124 }
125 #Additional Author: <br>
126 if ($dat->{'seriestitle'} ne ''){
127   print "<b>Seriestitle:</b> $dat->{'seriestitle'}<br>";
128 }
129 if ($dat->{'subject'} ne ''){
130   print "<b>Subject:</b> $dat->{'subject'}<br>";
131 }
132 if ($dat->{'copyrightdate'} ne ''){
133   print "<b>Copyright:</b> $dat->{'copyrightdate'}<br>";
134 }
135 if ($dat->{'notes'} ne ''){
136   print "<b>Notes:</b> $dat->{'notes'}<br>";
137 }
138 if ($dat->{'unititle'} ne ''){
139   print "<b>Unititle:</b> $dat->{'unititle'}<br>";
140 }
141 #Analytical Author: <br>
142 #Analytical Title: <br>
143 if ($dat->{'serial'} ne '0'){
144  print "<b>Serial:</b> Yes<br>";
145 }
146 print "<b>Total Number of Items:</b> $count
147 <p>
148 ";
149
150 }
151 print <<printend
152 </form>
153 </font></TD>
154 </TR>
155
156 </TABLE>
157 <img src="/images/holder.gif" width=16 height=300 align=left>
158
159 printend
160 ;
161
162
163 #print @items;
164
165 my $i=0;
166 print center();
167 print mktablehdr;
168 if ($type eq 'opac'){
169
170   print mktablerow(6,$main,'Item Type','Class','Branch','Date Due','Last Seen'); 
171 } else {
172   print mktablerow(6,$main,'Itemtype','Class','Location','Date Due','Last Seen','Barcode',"/images/background-mem.gif"); 
173 }
174 my $colour=1;
175 while ($i < $count){
176 #  print $items[$i],"<br>";
177   my @results=split('\t',$items[$i]);
178   if ($type ne 'opac'){
179     $results[1]=mklink("/cgi-bin/koha/moredetail.pl?item=$results[5]&bib=$bib&bi=$results[8]&type=$type",$results[1]);
180   }
181   if ($results[2] eq ''){
182     $results[2]='Available';
183   }
184   if ($type eq 'catmain'){
185     $results[10]=mklink("/cgi-bin/koha/maint/catmaintain.pl?type=fixitemtype&bi=$results[8]&item=$results[6]","Fix Itemtype");
186   }
187   if ($colour == 1){
188     if ($type ne 'opac'){
189       if ($type eq 'catmain'){
190         print mktablerow(8,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9],$results[10]);
191       } else {
192         print mktablerow(7,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9]);
193       }
194     } else {
195       $results[6]=ItemType($results[6]);
196       print mktablerow(6,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[9]);
197     } 
198     $colour=0;                                                                                
199   } else{                                                                                     
200     if ($type ne 'opac'){
201       if ($type eq 'catmain'){
202         print mktablerow(8,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9],$results[10]);
203       } else {
204         print mktablerow(7,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9]);
205       }
206     } else {
207       $results[6]=ItemType($results[6]);
208       print mktablerow(6,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[9]);
209     }
210     $colour=1;                                                                                
211   }
212    $i++;
213 }
214
215 print mktableft();
216 print "<p>";
217 print mktablehdr();
218 if ($type ne 'opac'){
219 print <<printend
220 <TR VALIGN=TOP>
221 <TD  bgcolor="99cc33" background="/images/background-mem.gif" colspan=2><p><b>HELP</b><br>
222 <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>
223 <b>Updating the Biblio for only ONE or SOME Items:</b> 
224 printend
225 ;
226 if ($type eq 'catmain'){
227 print <<printend
228 If some of the items listed above need a different biblio, 
229 you need to click on the wrong item, then shift the group it belongs to, to the correct biblio.
230 You will need to know the correct biblio number
231 <p>
232
233    </TR>
234 printend
235 ;
236 } else {
237 print <<printend
238 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.
239 <p>
240
241    </TR>
242 printend
243 ;
244 }
245 }
246 print mktableft();
247 print endcenter();
248 print "<br clear=all>";
249 print endmenu($type);
250 print endpage();