Removing Catalogue.pm because it doesn't compile cleanly yet
[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 C4::Search;
8 use CGI;
9 use C4::Output;
10
11 my $input = new CGI;
12 my $type  = $input->param('type');
13 my $bib   = $input->param('bib');
14 my @items = &ItemInfo(undef, $bib, $type);
15 my @temp  = split('\t', $items[0]);
16 my $count = @items;
17 my $dat   = &bibdata($bib);
18 my ($websitecount, @websites)             = &getwebsites($bib);
19 my ($authorcount, $addauthor)             = &addauthor($bib);
20 my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($bib);
21 my $additional = $addauthor->[0]->{'author'};
22 my $main;
23 my $secondary;
24 my $colour;
25
26
27 if ($type eq '') {
28     $type = 'opac';
29 } # if
30
31 # setup colours
32 if ($type eq 'opac') {
33     $main      = '#99cccc';
34     $secondary = '#efe5ef';
35 } else {
36     $main      = '#cccc99';
37     $secondary = '#ffffcc';
38 } # else
39 $colour = $secondary;
40
41 for (my $i = 1; $i < $authorcount; $i++) {
42     $additional .= "|" . $addauthor->[$i]->{'author'};
43 } # for
44
45 print $input->header;
46 print startpage();
47 print startmenu($type);
48
49 if ($type ne 'opac'){
50     print << "EOF";
51 <a href=request.pl?bib=$bib><img height=42  WIDTH=120 BORDER="0" src=\"/images/requests.gif\" align="right" border="0"></a>
52 EOF
53 } # if
54
55 if ($type eq 'catmain'){
56   print mkheadr(3,"Catalogue Maintenance");
57 } # if
58
59 if ($dat->{'author'} ne ''){
60   print mkheadr(3,"$dat->{'title'} ($dat->{'author'}) $temp[4]");
61 } else {
62   print mkheadr(3,"$dat->{'title'} $temp[4]");
63 } # if
64
65 print << "EOF";
66 <table cellspacing="0" callpadding="5" border="1" align="left" width="220">
67 <!-----------------BIBLIO RECORD TABLE--------->
68 <tr valign="top">
69 EOF
70
71 if ($type ne 'opac') {
72     print << "EOF";
73 <td bgcolor="$main" background="/images/background-mem.gif">
74 EOF
75 } else {
76     print << "EOF";
77 <td bgcolor="$main">
78 EOF
79 } # else
80
81 print << "EOF";
82 <b>BIBLIO RECORD</b>
83 EOF
84
85 if ($type ne 'opac') {
86   print "$bib";
87 }
88
89 print << "EOF";
90 </td>
91 </tr>
92 <tr valign="top">
93 <td>
94 EOF
95
96 if ($type ne 'opac') {
97   print << "EOF";
98 <form action="/cgi-bin/koha/modbib.pl" method="post">
99 <input type="hidden" name="bibnum" value="$bib">
100 <input type="image" name="submit" value="modify" height="42" width="93" border="0" src="/images/modify-mem.gif"> 
101 <input type="image" name="delete" value="delete" height="42" width="93" border="0" src="/images/delete-mem.gif">
102 </form>
103 EOF
104 } # if
105
106 print << "EOF";
107 <br>
108 <FONT SIZE=2  face="arial, helvetica">
109 EOF
110
111
112 if ($type ne 'opac') {
113     print << "EOF";
114 <b>Subtitle:</b> $dat->{'subtitle'}<br>
115 <b>Author:</b> $dat->{'author'}<br>
116 <b>Additional Author:</b> $additional<br>
117 <b>Series Title:</b> $dat->{'seriestitle'}<br>
118 <b>Subject:</b> $dat->{'subject'}<br>
119 <b>Copyright:</b> $dat->{'copyrightdate'}<br>
120 <b>Notes:</b> $dat->{'notes'}<br>
121 <b>Unititle:</b> $dat->{'unititle'}<br>
122 <b>Analytical Author:</b> <br>
123 <b>Analytical Title:</b> <br>
124 <b>Serial:</b> $dat->{'serial'}<br>
125 <b>Total Number of Items:</b> $count
126 <p>
127 EOF
128
129 } else {
130     if ($dat->{'subtitle'} ne ''){
131         print "<b>Subtitle:</b> $dat->{'subtitle'}<br>";
132     } # if
133     if ($dat->{'author'} ne ''){
134         print "<b>Author:</b> $dat->{'author'}<br>";
135     } # if
136
137 # Additional Author: <br>
138     if ($dat->{'seriestitle'} ne '') {
139         print "<b>Seriestitle:</b> $dat->{'seriestitle'}<br>";
140     } # if
141     if ($dat->{'subject'} ne '') {
142         print "<b>Subject:</b> $dat->{'subject'}<br>";
143     } # if
144     if ($dat->{'copyrightdate'} ne '') {
145         print "<b>Copyright:</b> $dat->{'copyrightdate'}<br>";
146     } # if
147     if ($dat->{'notes'} ne '') {
148         print "<b>Notes:</b> $dat->{'notes'}<br>";
149     } # if
150     if ($dat->{'unititle'} ne '') {
151         print "<b>Unititle:</b> $dat->{'unititle'}<br>";
152     } # if
153
154 # Analytical Author: <br>
155 # Analytical Title: <br>
156     if ($dat->{'serial'} ne '0') {
157         print "<b>Serial:</b> Yes<br>";
158     } # if
159
160     print << "EOF";
161 <b>Total Number of Items:</b> $count
162 <p>
163 EOF
164
165 } # if
166
167 print << "EOF";
168 </font></td>
169 </tr>
170 </table>
171
172 <img src="/images/holder.gif" width="16" height="300" align="left">
173 EOF
174
175 print center();
176 print mktablehdr;
177
178 if ($type eq 'opac') {
179     print mktablerow(6,$main,'Item Type','Class','Branch','Date Due','Last Seen');
180 } else {
181     print mktablerow(7,$main,'Itemtype','Class','Location','Date Due','Last Seen','Barcode',"","/images/background-mem.gif");
182 } # else
183
184 $colour = 'white';
185 for (my $i = 0; $i < $count; $i ++) {
186
187     my @results = split('\t', $items[$i]);
188
189     if ($type ne 'opac') {
190         $results[1] = mklink("/cgi-bin/koha/moredetail.pl?item=$results[5]&bib=$bib&bi=$results[8]&type=$type",$results[1]);
191     } # if
192
193     if ($results[2] eq '') {
194         $results[2] = 'Available';
195     } # if
196
197     if ($type eq 'catmain'){
198         $results[10] = mklink("/cgi-bin/koha/maint/catmaintain.pl?type=fixitemtype&bi=$results[8]&item=$results[6]","Fix Itemtype");
199     } # if
200
201     if ($type ne 'opac'){
202         if ($type eq 'catmain'){
203             print mktablerow(8,$colour,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9],$results[10]);
204         } else {
205             print mktablerow(7,$colour,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9]);
206         } # else
207     } else {
208         $results[6] = ItemType($results[6]);
209         print mktablerow(6,$colour,$results[6],$results[4],$results[3],$results[2],$results[7],$results[9]);
210     } # else
211     
212     if ($colour eq $secondary) {
213         $colour = 'white';
214     } else {
215         $colour = $secondary;
216     } # else
217
218 } # for
219
220
221 for (my $i = 0; $i < $webbiblioitemcount; $i++) {
222     if ($type eq 'opac') {
223         $webbiblioitems[$i]->{'url'} =~ s/^http:\/\///;
224         print mktablerow(6, $colour, 'Website', 'WEB', 'Online', 'Available', "http://$webbiblioitems[$i]->{'url'}");
225     } else {
226         $webbiblioitems[$i]->{'url'} =~ s/^http:\/\///;
227         print mktablerow(7, $colour, 'WEB', '', 'Online', 'Available', "", "<a href='moredetail.pl?bib=$bib&bi=$webbiblioitems[$i]->{'biblioitemnumber'}&type=$type'>http://$webbiblioitems[$i]->{'url'}</a>");
228     } # else
229 } # for
230
231
232 print mktableft();
233 print "<p>";
234 print mktablehdr();
235
236 if ($type ne 'opac') {
237     print << "EOF";
238 <tr valign="top">
239 <td bgcolor="99cc33" background="/images/background-mem.gif" colspan="2"><p><b>HELP</b><br>
240 <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>
241 <b>Updating the Biblio for only ONE or SOME Items:</b> 
242 EOF
243
244     if ($type eq 'catmain') {
245         print << "EOF";
246 If some of the items listed above need a different biblio, 
247 you need to click on the wrong item, then shift the group it belongs to, to the correct biblio.
248 You will need to know the correct biblio number
249 <p />
250 </tr>
251 EOF
252
253     } else {
254         print << "EOF";
255 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.
256 <p />
257 </tr>
258 EOF
259
260     } # else
261 } # if
262
263 print mktableft();
264 print endcenter();
265 print << "EOF";
266 <br clear=all>
267 <p />
268 EOF
269
270 if ($type ne 'opac') {
271     print << "EOF";
272 <table border="1" cellspacing="0" cellpadding="5" width="90%">
273 <tr valign="top">
274 <td bgcolor="$main" background="/images/background-mem.gif"><b>Abstract</b></td>
275 </tr>
276 <tr valign="top">
277 <td>$dat->{'abstract'}</td>
278 </tr>
279 </table>
280 <p />
281 <table border="1" cellspacing="0" cellpadding="5" width="90%">
282 <tr valign="top">
283 <td bgcolor="$main" background="/images/background-mem.gif"><b>Links to Associated Websites<b></td>
284 </tr>
285 EOF
286
287     for (my $i = 0; $i < $websitecount; $i++) {
288         $websites[$i]->{'url'} =~ s/^http:\/\///;
289         print << "EOF";
290 <tr>
291 <td><b>Title:</b> $websites[$i]->{'title'}<br>
292 <b>Description:</b> $websites[$i]->{'description'}<br>
293 <b>URL:</b> http://$websites[$i]->{'url'}<br>
294 </td>
295 </tr>
296 EOF
297     } # for
298
299     print << "EOF";
300 </table>
301 EOF
302 } else {
303     if ($dat->{'abstract'} ne '') {
304         print << "EOF";
305 <table border="1" cellspacing="0" cellpadding="5" width="90%">
306 <tr valign="top">
307 <td bgcolor="$main"><b>Abstract</b></td>
308 </tr>
309 <tr valign="top">
310 <td>$dat->{'abstract'}</td>
311 </tr>
312 </table>
313 <p />
314 EOF
315     } # if
316     if ($websitecount) {
317         print << "EOF";
318 <table border="1" cellspacing="0" cellpadding="5" width="90%">
319 <tr valign="top">
320 <td bgcolor="$main" background="/images/background-mem.gif"><b>Link to Associated Websites</b></td>
321 </tr>
322 EOF
323
324         for (my $i = 0; $i < $websitecount; $i++) {
325             $websites[$i]->{'url'} =~ s/^http:\/\///;
326             print << "EOF";
327 <tr>
328 <td><b>Title:</b> $websites[$i]->{'title'}<br>
329 <b>Description:</b> $websites[$i]->{'description'}<br>
330 <b>URL:</b> http://$websites[$i]->{'url'}<br>
331 </td>
332 </tr>
333 EOF
334         } # for
335         
336         print << "EOF";
337 </table>
338 EOF
339     } # if
340 } # else
341
342 print endmenu($type);
343 print endpage();