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.

267 lines
8.3 KiB

  1. #!/usr/bin/perl
  2. #script to do a borrower enquiery/brin up borrower details etc
  3. #written 20/12/99 by chris@katipo.co.nz
  4. #Displays all the detailas about a borrower
  5. #needs html removed and to use the C4::Output more, but its tricky
  6. #last modified 21/1/2000 by chris@katipo.co.nz
  7. use strict;
  8. use C4::Output;
  9. use CGI;
  10. use C4::Search;
  11. use Date::Manip;
  12. use C4::Reserves2;
  13. use C4::Circulation::Renewals2;
  14. my $input = new CGI;
  15. my $bornum=$input->param('bornum');
  16. my %env;
  17. print $input->header;
  18. #start the page and read in includes
  19. print startpage();
  20. print startmenu('member');
  21. my $data=borrdata('',$bornum);
  22. my @temp=split('-',$data->{'dateenrolled'});
  23. $data->{'dateenrolled'}="$temp[2]/$temp[1]/$temp[0]";
  24. @temp=split('-',$data->{'expiry'});
  25. $data->{'expiry'}="$temp[2]/$temp[1]/$temp[0]";
  26. @temp=split('-',$data->{'dateofbirth'});
  27. $data->{'dateofbirth'}="$temp[2]/$temp[1]/$temp[0]";
  28. if ($data->{'ethnicity'} eq 'maori'){
  29. $data->{'ethnicity'} = 'Maori';
  30. }
  31. if ($data->{'ethnicity'}eq 'european'){
  32. $data->{'ethnicity'} = 'European/Pakeha';
  33. }
  34. if ($data->{'ethnicity'}eq 'pi'){
  35. $data->{'ethnicity'} = 'Pacific Islander';
  36. }
  37. if ($data->{'ethnicity'}eq 'asian'){
  38. $data->{'ethnicity'} = 'Asian';
  39. }
  40. print <<printend
  41. <FONT SIZE=6><em>$data->{'othernames'} $data->{'surname'}</em></FONT><P>
  42. <p>
  43. <form action=/cgi-bin/koha/wmemberentry.pl method=post>
  44. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width=270>
  45. <TR VALIGN=TOP>
  46. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>MEMBERSHIP RECORD</TD></TR>
  47. <tr VALIGN=TOP >
  48. <TD>
  49. <p align=right><INPUT TYPE="image" name="submit" VALUE="add-child" height=42 WIDTH=120 BORDER=0 src="/images/add-child.gif">
  50. <input type=hidden name=type value=Add>
  51. </form>
  52. </P><br>
  53. <FONT SIZE=2 face="arial, helvetica">$data->{'title'} $data->{'othernames'} $data->{'surname'} ($data->{'firstname'}, $data->{'initials'})<p>
  54. Card Number: $data->{'cardnumber'}<BR>
  55. Postal Address: $data->{'streetaddress'}, $data->{'city'}<BR>
  56. Home Address: $data->{'physstreet'}, $data->{'streetcity'}<BR>
  57. Phone (Home): $data->{'phone'}<BR>
  58. Phone (Daytime): $data->{'phoneday'}<BR>
  59. Fax: $data->{'faxnumber'}<BR>
  60. E-mail: <a href="mailto:$data->{'emailaddress'}">$data->{'emailaddress'}</a><P>
  61. Membership Number: $data->{'borrowernumber'}<BR>
  62. Membership: $data->{'categorycode'}<BR>
  63. Area: $data->{'area'}<BR>
  64. Fee:$30/year, Paid<BR>
  65. Joined: $data->{'dateenrolled'}, Expires: $data->{'expiry'} <BR>
  66. Joining Branch: $data->{'homebranch'}<P>
  67. Ethnicity: $data->{'ethnicity'}, $data->{'ethnotes'}<BR>
  68. DoB: $data->{'dateofbirth'}<BR>
  69. Sex: $data->{'sex'}<P>
  70. Alternative Contact:$data->{'contactname'}<BR>
  71. Phone: $data->{'altphone'}<BR>
  72. Relationship: $data->{'altrelationship'}<BR>
  73. Notes: $data->{'altnotes'}<P>
  74. Guarantees: <A HREF=""></a><P>
  75. General Notes: <A HREF="popbox.html" onclick="messenger(200,250,'Form that lets you add to and delete notes.'); return false">
  76. $data->{'borrowernotes'}</a>
  77. <p align=right>
  78. <form action=/cgi-bin/koha/memberentry.pl method=post>
  79. <input type=hidden name=bornum value=$bornum>
  80. <INPUT TYPE="image" name="submit" VALUE="modify" height=42 WIDTH=93 BORDER=0 src="/images/modify-mem.gif">
  81. <INPUT TYPE="image" name="submit" VALUE="delete" height=42 WIDTH=93 BORDER=0 src="/images/delete-mem.gif">
  82. </p>
  83. </TD>
  84. </TR>
  85. </TABLE>
  86. </FORM>
  87. <img src="/images/holder.gif" width=16 height=800 align=left>
  88. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
  89. <TR VALIGN=TOP>
  90. <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=4><B>FINES & CHARGES</TD></TR>
  91. printend
  92. ;
  93. my %bor;
  94. $bor{'borrowernumber'}=$bornum;
  95. my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
  96. #if ($numaccts > 10){
  97. # $numaccts=10;
  98. #}
  99. for (my$i=0;$i<$numaccts;$i++){
  100. #if ($accts->[$i]{'accounttype'} ne 'Pay'){
  101. my $amount= $accts->[$i]{'amount'} + 0.00;
  102. my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00;
  103. if ($amount2 > 0){
  104. print "<tr VALIGN=TOP >";
  105. my $item=" &nbsp; ";
  106. @temp=split('-',$accts->[$i]{'date'});
  107. $accts->[$i]{'date'}="$temp[2]/$temp[1]/$temp[0]";
  108. if ($accts->[$i]{'accounttype'} ne 'Res'){
  109. #get item data
  110. #$item=
  111. }
  112. print "<td>$accts->[$i]{'date'}</td>";
  113. # print "<TD>$accts->[$i]{'accounttype'}</td>";
  114. print "<TD>$accts->[$i]{'description'} $accts->[$i]{'title'}</td>
  115. <TD>$amount</td><td>$amount2</td>
  116. </tr>";
  117. }
  118. }
  119. print <<printend
  120. <tr VALIGN=TOP >
  121. <TD colspan=3 align=right>
  122. <nobr>
  123. <a href=/cgi-bin/koha/boraccount.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/view-account.gif"></a>
  124. <a href=/cgi-bin/koha/pay.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/pay-fines.gif"></a></nobr>
  125. </td>
  126. </tr>
  127. </table>
  128. <p>
  129. <form action="renewscript.pl" method=post>
  130. <input type=hidden name=bornum value=$bornum>
  131. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
  132. <TR VALIGN=TOP>
  133. <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=6><B>ITEMS CURRENTLY ON ISSUE</b></TD>
  134. </TR>
  135. <TR VALIGN=TOP>
  136. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
  137. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Due</b></TD>
  138. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Itemtype</b></TD>
  139. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
  140. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Status</b></TD>
  141. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Renew</b></TD>
  142. </TR>
  143. printend
  144. ;
  145. my ($count,$issue)=borrissues($bornum);
  146. my $today=ParseDate('today');
  147. for (my $i=0;$i<$count;$i++){
  148. print "<tr VALIGN=TOP >
  149. <TD>";
  150. my $datedue=ParseDate($issue->[$i]{'date_due'});
  151. @temp=split('-',$issue->[$i]{'date_due'});
  152. $issue->[$i]{'date_due'}="$temp[2]/$temp[1]/$temp[0]";
  153. if ($datedue < $today){
  154. print "<font color=red>";
  155. }
  156. print "$issue->[$i]{'title'} $issue->[$i]{'barcode'}</td>
  157. <TD>$issue->[$i]{'date_due'}</td>";
  158. #find the charge for an item
  159. my ($charge,$itemtype)=calc_charges(\%env,$issue->[$i]{'itemnumber'},$bornum);
  160. print "<TD>$itemtype</td>";
  161. print "<TD>$charge</td>";
  162. if ($datedue < $today){
  163. print "<td>Overdue</td>";
  164. } else {
  165. print "<td> &nbsp; </td>";
  166. }
  167. #check item is not reserved
  168. my ($rescount,$reserves)=FindReserves($issue->[$i]{'biblionumber'},'');
  169. if ($rescount >0){
  170. print "<TD>On Request";
  171. } else {
  172. print "<TD>";
  173. }
  174. print "<input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=y>Y
  175. <input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=n>N</td>
  176. </tr>
  177. ";
  178. }
  179. print <<printend
  180. <tr VALIGN=TOP >
  181. <TD colspan=5 align=right>
  182. <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/update-renewals.gif">
  183. </td>
  184. </form>
  185. </tr>
  186. </table>
  187. <P>
  188. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
  189. <TR VALIGN=TOP>
  190. <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=5><B>ITEMS REQUESTED</b></TD>
  191. </TR>
  192. <TR VALIGN=TOP>
  193. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
  194. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Requested</b></TD>
  195. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
  196. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Remove</b></TD>
  197. </TR>
  198. <form action=/cgi-bin/koha/modrequest.pl method=post>
  199. <input type=hidden name=from value=borrower>
  200. printend
  201. ;
  202. my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
  203. for (my $i=0;$i<$rescount;$i++){
  204. @temp=split('-',$reserves->[$i]{'reservedate'});
  205. $reserves->[$i]{'reservedate'}="$temp[2]/$temp[1]/$temp[0]";
  206. print "<tr VALIGN=TOP >
  207. <TD><a href=\"/cgi-bin/koha/request.pl?bib=$reserves->[$i]{'biblionumber'}\">$reserves->[$i]{'title'}</a></td>
  208. <TD>$reserves->[$i]{'reservedate'}</td>
  209. <input type=hidden name=biblio value=$reserves->[$i]{'biblionumber'}>
  210. <input type=hidden name=borrower value=$bornum>
  211. <TD></td>
  212. <TD><select name=\"rank-request\">
  213. <option value=n>No
  214. <option value=del>Yes
  215. </select>
  216. </tr>
  217. ";
  218. }
  219. print <<printend
  220. <tr VALIGN=TOP >
  221. <TD colspan=5 align=right>
  222. <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/cancel-requests.gif"></td>
  223. </tr>
  224. </table>
  225. </form>
  226. <p align=right>
  227. <a href=/cgi-bin/koha/readingrec.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/reading-record.gif"></a>
  228. </p>
  229. printend
  230. ;
  231. print endmenu('member');
  232. print endpage();