Little fix so that if the item has no author information, empty () dont disply
[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 ($dat->{'author'} ne ''){
50   print mkheadr(3,"$dat->{'title'} ($dat->{'author'}) $temp[4]");
51 } else {
52   print mkheadr(3,"$dat->{'title'} $temp[4]");
53 }
54 print <<printend
55
56 <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left width="220">
57
58 <!-----------------BIBLIO RECORD TABLE--------->
59
60
61 <form action=/cgi-bin/koha/modbib.pl method=post>
62 <input type=hidden name=bibnum value=$bib>
63 <TR VALIGN=TOP>
64
65 <td  bgcolor="$main" 
66 printend
67 ;
68 if ($type ne 'opac'){
69  print "background=\"/images/background-mem.gif\"";
70 }
71 print <<printend
72 ><B>BIBLIO RECORD 
73 printend
74 ;
75 if ($type ne 'opac'){
76   print "$bib";
77 }
78 print <<printend
79 </TD></TR>
80
81
82 <tr VALIGN=TOP  >
83 <TD>
84 printend
85 ;
86 if ($type ne 'opac'){
87   print "<INPUT TYPE=\"image\" name=\"submit\"  VALUE=\"modify\" height=42  WIDTH=93 BORDER=0 src=\"/images/modify-mem.gif\"> 
88   <INPUT TYPE=\"image\" name=\"delete\"  VALUE=\"delete\" height=42  WIDTH=93 BORDER=0 src=\"/images/delete-mem.gif\">";
89 }
90 print <<printend
91 <br>
92 <FONT SIZE=2  face="arial, helvetica">
93 printend
94 ;
95
96
97 if ($type ne 'opac'){
98 print <<printend
99 <b>Subtitle:</b> $dat->{'subtitle'}<br>
100 <b>Author:</b> $dat->{'author'}<br>
101 <b>Additional Author:</b> $additional<br>
102 <b>Series Title:</b> $dat->{'seriestitle'}<br>
103 <b>Subject:</b> $dat->{'subject'}<br>
104 <b>Copyright:</b> $dat->{'copyrightdate'}<br>
105 <b>Notes:</b> $dat->{'notes'}<br>
106 <b>Unititle:</b> $dat->{'unititle'}<br>
107 <b>Analytical Author:</b> <br>
108 <b>Analytical Title:</b> <br>
109 <b>Serial:</b> $dat->{'serial'}<br>
110 <b>Total Number of Items:</b> $count
111 <p>
112 printend
113 ;
114 }
115 else {
116 if ($dat->{'subtitle'} ne ''){
117   print "<b>Subtitle:</b> $dat->{'subtitle'}<br>";
118 }
119 if ($dat->{'author'} ne ''){
120   print "<b>Author:</b> $dat->{'author'}<br>";
121 }
122 #Additional Author: <br>
123 if ($dat->{'seriestitle'} ne ''){
124   print "<b>Seriestitle:</b> $dat->{'seriestitle'}<br>";
125 }
126 if ($dat->{'subject'} ne ''){
127   print "<b>Subject:</b> $dat->{'subject'}<br>";
128 }
129 if ($dat->{'copyrightdate'} ne ''){
130   print "<b>Copyright:</b> $dat->{'copyrightdate'}<br>";
131 }
132 if ($dat->{'notes'} ne ''){
133   print "<b>Notes:</b> $dat->{'notes'}<br>";
134 }
135 if ($dat->{'unititle'} ne ''){
136   print "<b>Unititle:</b> $dat->{'unititle'}<br>";
137 }
138 #Analytical Author: <br>
139 #Analytical Title: <br>
140 if ($dat->{'serial'} ne '0'){
141  print "<b>Serial:</b> Yes<br>";
142 }
143 print "<b>Total Number of Items:</b> $count
144 <p>
145 ";
146
147 }
148 print <<printend
149 </form>
150 </font></TD>
151 </TR>
152
153 </TABLE>
154 <img src="/images/holder.gif" width=16 height=300 align=left>
155
156 printend
157 ;
158
159
160 #print @items;
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 #  print $items[$i],"<br>";
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]",$results[1]);
177   }
178   if ($results[2] eq ''){
179     $results[2]='Available';
180   }
181   if ($colour == 1){
182     if ($type ne 'opac'){
183 #      if ($results[6] eq 'PER'){
184         print mktablerow(7,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9]);
185 #      } else {
186 #            print mktablerow(6,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);
187 #      }
188     } else {
189        $results[6]=ItemType($results[6]);
190 #       if ($results[6] =~ /Periodical/){
191           print mktablerow(6,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[9]);
192 #       } else {
193 #         print mktablerow(5,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7]);
194 #       }       
195     } 
196     $colour=0;                                                                                
197   } else{                                                                                     
198     if ($type ne 'opac'){
199 #      if ($results[6] eq 'PER'){
200       print mktablerow(7,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1],$results[9]);                                          
201 #      }else{
202 #           print mktablerow(6,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);                                          
203 #      }
204     } else {
205       $results[6]=ItemType($results[6]);
206 #       if ($results[6] =~ /Periodical/){
207           print mktablerow(6,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[9]);
208 #       } else {
209 #         print mktablerow(5,'white',$results[6],$results[4],$results[3],$results[2],$results[7]);
210 #       }       
211     }
212     $colour=1;                                                                                
213   }
214    $i++;
215 }
216
217 print mktableft();
218 print "<p>";
219 print mktablehdr();
220 if ($type ne 'opac'){
221 print <<printend
222 <TR VALIGN=TOP>
223 <TD  bgcolor="99cc33" background="/images/background-mem.gif" colspan=2><p><b>HELP</b><br>
224 <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>
225 <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>
226
227    </TR>
228 printend
229 ;
230 }
231 print mktableft();
232 print endcenter();
233 print "<br clear=all>";
234 print endmenu($type);
235 print endpage();