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