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.

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