Kumara - predecessor to Koha
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

242 lines
7.4 KiB

  1. #!/usr/bin/perl
  2. #script to place reserves/requests
  3. #writen 2/1/00 by chris@katipo.oc.nz
  4. use strict;
  5. #use DBI;
  6. use C4::Search;
  7. use CGI;
  8. use C4::Output;
  9. use C4::Reserves2;
  10. use C4::Acquisitions;
  11. my $input = new CGI;
  12. print $input->header;
  13. #setup colours
  14. print startpage();
  15. print startmenu();
  16. my $blah;
  17. my $bib=$input->param('bib');
  18. my $dat=bibdata($bib);
  19. my ($count,$reserves)=FindReserves($bib);
  20. #print $count;
  21. #print $input->dump;
  22. print <<printend
  23. <form action="placerequest.pl" method=post>
  24. <INPUT TYPE="image" name="submit" VALUE="request" height=42 WIDTH=187 BORDER=0 src="/images/place-request.gif" align=right >
  25. <input type=hidden name=biblio value=$bib>
  26. <input type=hidden name=type value=str8>
  27. <input type=hidden name=title value="$dat->{'title'}">
  28. <FONT SIZE=6><em>Requesting: <a href=/cgi-bin/koha/detail.pl?bib=$bib>$dat->{'title'}</a> ($dat->{'author'})</em></FONT><P>
  29. <p>
  30. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left >
  31. <!----------------BIBLIO RESERVE TABLE-------------->
  32. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
  33. <TR VALIGN=TOP>
  34. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Rank</b></TD>
  35. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Member Number</b></TD>
  36. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Notes</b></TD>
  37. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Date</b></TD>
  38. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Pickup</b></TD>
  39. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Request</b></TD>
  40. </TR>
  41. <tr VALIGN=TOP >
  42. <TD><select name=rank-request>
  43. printend
  44. ;
  45. $count++;
  46. my $i;
  47. for ($i=1;$i<$count;$i++){
  48. print "<option value=$i>$i\n";
  49. }
  50. print "<option value=$i selected>$i\n";
  51. my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
  52. $year=$year+1900;
  53. $mon++;
  54. my $date="$mday/$mon/$year";
  55. print <<printend
  56. </select>
  57. </td>
  58. <TD><input type=text size=10 name=member></td>
  59. <TD><input type=text size=20 name=notes></td>
  60. <TD>$date</td>
  61. <TD><select name=pickup>
  62. printend
  63. ;
  64. my ($count2,@branches)=branches;
  65. for (my $i=0;$i<$count2;$i++){
  66. print "<option value=$branches[$i]->{'branchcode'}";
  67. print ">$branches[$i]->{'branchname'}";
  68. }
  69. print <<printend
  70. </select>
  71. </td>
  72. <td><input type=checkbox name=request value=any>Next Available, <br>(or choose from list below)</td>
  73. </tr>
  74. </table>
  75. </p>
  76. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
  77. <TR VALIGN=TOP>
  78. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Request</b></TD>
  79. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Item Type</b></TD>
  80. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Classification</b></TD>
  81. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Volume</b></TD>
  82. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>ISBN</b></TD>
  83. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Copyright</b></TD>
  84. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Pubdate</b></TD>
  85. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Copies</b></TD>
  86. </TR>
  87. printend
  88. ;
  89. my $blah;
  90. my ($count2,@data)=bibitems($bib);
  91. for ($i=0;$i<$count2;$i++){
  92. my @barcodes=barcodes($data[$i]->{'biblioitemnumber'});
  93. if ($data[$i]->{'dewey'} == 0){
  94. $data[$i]->{'dewey'}="";
  95. }
  96. $data[$i]->{'dewey'}=~ s/\.0000$//;
  97. $data[$i]->{'dewey'}=~ s/00$//;
  98. my $class="$data[$i]->{'classification'}$data[$i]->{'dewey'}$data[$i]->{'subclass'}";
  99. print "<tr VALIGN=TOP >
  100. <TD><input type=checkbox name=reqbib value=$data[$i]->{'biblioitemnumber'}>
  101. <input type=hidden name=biblioitem value=$data[$i]->{'biblioitemnumber'}>
  102. </td>
  103. <TD>$data[$i]->{'description'}</td>
  104. <TD>$class</td>
  105. <td>$data[$i]->{'volumeddesc'}</td>
  106. <td>$data[$i]->{'isbn'}</td>
  107. <td>$dat->{'copyrightdate'}</td>
  108. <td>$data[$i]->{'publicationyear'}</td>
  109. <td>@barcodes</td>
  110. </tr>";
  111. }
  112. print <<printend
  113. </table>
  114. </p>
  115. </form>
  116. <p>&nbsp; </p>
  117. <!-----------MODIFY EXISTING REQUESTS----------------->
  118. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
  119. <TR VALIGN=TOP>
  120. <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=7><B>MODIFY EXISTING REQUESTS </b></TD>
  121. </TR>
  122. <form action=modrequest.pl method=post>
  123. <TR VALIGN=TOP>
  124. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Rank</b></TD>
  125. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Member</b></TD>
  126. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Notes</b></TD>
  127. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Date</b></TD>
  128. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Pickup</b></TD>
  129. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Request</b></TD>
  130. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Change To</b></TD>
  131. </TR>
  132. printend
  133. ;
  134. $count--;
  135. for ($i=0;$i<$count;$i++){
  136. print "<input type=hidden name=borrower value=$reserves->[$i]{'borrowernumber'}>";
  137. print "<input type=hidden name=biblio value=$reserves->[$i]{'biblionumber'}>";
  138. #my $bor=$reserves->[$i]{'firstname'}."%20".$reserves->[$i]{'surname'};
  139. #$bor=~ s/ /%20/g;
  140. my $bor=$reserves->[$i]{'borrowernumber'};
  141. my @temp=split('-',$reserves->[$i]{'reservedate'});
  142. $date="$temp[2]/$temp[1]/$temp[0]";
  143. my $type=$reserves->[$i]{'constrainttype'};
  144. #print "test";
  145. if ($type eq 'a'){
  146. $type='Next Available';
  147. } elsif ($type eq 'o'){
  148. # print "test";
  149. my $res=getreservetitle($reserves->[$i]{'biblionumber'},$reserves->[$i]{'borrowernumber'},$reserves->[$i]{'reservedate'},$reserves->[$i]{'timestamp'});
  150. $type="This type only $res->{'volumeddesc'} $res->{'itemtype'}";
  151. # my @data=ItemInfo(\$blah,$reserves->[$i]{'borrowernumber'});
  152. }
  153. print "<tr VALIGN=TOP >
  154. <TD><select name=rank-request>
  155. ";
  156. for (my $i2=1;$i2<=$count;$i2++){
  157. print "<option value=$i2";
  158. if ($reserves->[$i]{'priority'} eq $i2){
  159. print " selected";
  160. }
  161. print">$i2";
  162. }
  163. print "<option value=del>Del";
  164. print "</select>
  165. </td>
  166. <TD><a href=/cgi-bin/koha/moremember.pl?bornum=$bor>$reserves->[$i]{'firstname'} $reserves->[$i]{'surname'}</a></td>
  167. <td>$reserves->[$i]{'reservenotes'}</td>
  168. <TD>$date</td>
  169. <TD><select name=pickup>
  170. ";
  171. my ($count2,@branches)=branches;
  172. for (my $i2=0;$i2<$count2;$i2++){
  173. print "<option value=$branches[$i2]->{'branchcode'}";
  174. if ($reserves->[$i]{'branchcode'} eq $branches[$i2]->{'branchcode'}){
  175. print " Selected";
  176. }
  177. print ">$branches[$i2]->{'branchname'}\n";
  178. }
  179. print "
  180. </select>
  181. </td>
  182. <TD>$type</td>
  183. <TD><select name=itemtype>
  184. <option value=next>Next Available
  185. <option value=change>Change Selection
  186. <option value=nc >No Change
  187. </select>
  188. </td>
  189. </tr>
  190. ";
  191. }
  192. print <<printend
  193. <tr VALIGN=TOP >
  194. <TD colspan=6 align=right>
  195. Delete a request by selecting "del" from the rank list.
  196. <INPUT TYPE="image" name="submit" VALUE="request" height=42 WIDTH=64 BORDER=0 src="/images/ok.gif"></td>
  197. </tr>
  198. </table>
  199. <P>
  200. <br>
  201. </form>
  202. printend
  203. ;
  204. print endmenu();
  205. print endpage();