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