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.

277 lines
8.5 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->{'firstname'} $data->{'surname'}</em></FONT><P>
  42. <p>
  43. <form action=/cgi-bin/koha/jmemberentry.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. <input type=hidden name=bornum value=$data->{'borrowernumber'}>
  52. </form>
  53. </P><br>
  54. <FONT SIZE=2 face="arial, helvetica">$data->{'title'} $data->{'othernames'} $data->{'surname'} ($data->{'firstname'}, $data->{'initials'})<p>
  55. Card Number: $data->{'cardnumber'}<BR>
  56. Postal Address: $data->{'streetaddress'}, $data->{'city'}<BR>
  57. Home Address: $data->{'physstreet'}, $data->{'streetcity'}<BR>
  58. Phone (Home): $data->{'phone'}<BR>
  59. Phone (Daytime): $data->{'phoneday'}<BR>
  60. Fax: $data->{'faxnumber'}<BR>
  61. E-mail: <a href="mailto:$data->{'emailaddress'}">$data->{'emailaddress'}</a><P>
  62. Membership Number: $data->{'borrowernumber'}<BR>
  63. Membership: $data->{'categorycode'}<BR>
  64. Area: $data->{'area'}<BR>
  65. Fee:$30/year, Paid<BR>
  66. Joined: $data->{'dateenrolled'}, Expires: $data->{'expiry'} <BR>
  67. Joining Branch: $data->{'homebranch'}<P>
  68. Ethnicity: $data->{'ethnicity'}, $data->{'ethnotes'}<BR>
  69. DoB: $data->{'dateofbirth'}<BR>
  70. Sex: $data->{'sex'}<P>
  71. Alternative Contact:$data->{'contactname'}<BR>
  72. Phone: $data->{'altphone'}<BR>
  73. Relationship: $data->{'altrelationship'}<BR>
  74. Notes: $data->{'altnotes'}<P>
  75. Guarantees:
  76. printend
  77. ;
  78. my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
  79. for (my $i=0;$i<$count;$i++){
  80. print "<A HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantees->[$i]->{'borrowernumber'}\">$guarantees->[$i]->{'cardnumber'}</a><br>";
  81. }
  82. print <<printend
  83. <P>
  84. General Notes: <A HREF="popbox.html" onclick="messenger(200,250,'Form that lets you add to and delete notes.'); return false">
  85. $data->{'borrowernotes'}</a>
  86. <p align=right>
  87. <form action=/cgi-bin/koha/memberentry.pl method=post>
  88. <input type=hidden name=bornum value=$bornum>
  89. <INPUT TYPE="image" name="submit" VALUE="modify" height=42 WIDTH=93 BORDER=0 src="/images/modify-mem.gif">
  90. <INPUT TYPE="image" name="submit" VALUE="delete" height=42 WIDTH=93 BORDER=0 src="/images/delete-mem.gif">
  91. </p>
  92. </TD>
  93. </TR>
  94. </TABLE>
  95. </FORM>
  96. <img src="/images/holder.gif" width=16 height=800 align=left>
  97. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
  98. <TR VALIGN=TOP>
  99. <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=4><B>FINES & CHARGES</TD></TR>
  100. printend
  101. ;
  102. my %bor;
  103. $bor{'borrowernumber'}=$bornum;
  104. my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
  105. #if ($numaccts > 10){
  106. # $numaccts=10;
  107. #}
  108. for (my$i=0;$i<$numaccts;$i++){
  109. #if ($accts->[$i]{'accounttype'} ne 'Pay'){
  110. my $amount= $accts->[$i]{'amount'} + 0.00;
  111. my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00;
  112. if ($amount2 > 0){
  113. print "<tr VALIGN=TOP >";
  114. my $item=" &nbsp; ";
  115. @temp=split('-',$accts->[$i]{'date'});
  116. $accts->[$i]{'date'}="$temp[2]/$temp[1]/$temp[0]";
  117. if ($accts->[$i]{'accounttype'} ne 'Res'){
  118. #get item data
  119. #$item=
  120. }
  121. print "<td>$accts->[$i]{'date'}</td>";
  122. # print "<TD>$accts->[$i]{'accounttype'}</td>";
  123. print "<TD>$accts->[$i]{'description'} $accts->[$i]{'title'}</td>
  124. <TD>$amount</td><td>$amount2</td>
  125. </tr>";
  126. }
  127. }
  128. print <<printend
  129. <tr VALIGN=TOP >
  130. <TD colspan=3 align=right>
  131. <nobr>
  132. <a href=/cgi-bin/koha/boraccount.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/view-account.gif"></a>
  133. <a href=/cgi-bin/koha/pay.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/pay-fines.gif"></a></nobr>
  134. </td>
  135. </tr>
  136. </table>
  137. <p>
  138. <form action="renewscript.pl" method=post>
  139. <input type=hidden name=bornum value=$bornum>
  140. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
  141. <TR VALIGN=TOP>
  142. <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=6><B>ITEMS CURRENTLY ON ISSUE</b></TD>
  143. </TR>
  144. <TR VALIGN=TOP>
  145. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
  146. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Due</b></TD>
  147. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Itemtype</b></TD>
  148. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
  149. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Renew</b></TD>
  150. </TR>
  151. printend
  152. ;
  153. my ($count,$issue)=borrissues($bornum);
  154. my $today=ParseDate('today');
  155. for (my $i=0;$i<$count;$i++){
  156. print "<tr VALIGN=TOP >
  157. <TD>";
  158. my $datedue=ParseDate($issue->[$i]{'date_due'});
  159. @temp=split('-',$issue->[$i]{'date_due'});
  160. $issue->[$i]{'date_due'}="$temp[2]/$temp[1]/$temp[0]";
  161. if ($datedue < $today){
  162. print "<font color=red>";
  163. }
  164. print "$issue->[$i]{'title'} $issue->[$i]{'barcode'}</td>
  165. <TD>$issue->[$i]{'date_due'}</td>";
  166. #find the charge for an item
  167. my ($charge,$itemtype)=calc_charges(\%env,$issue->[$i]{'itemnumber'},$bornum);
  168. print "<TD>$itemtype</td>";
  169. print "<TD>$charge</td>";
  170. # if ($datedue < $today){
  171. # print "<td>Overdue</td>";
  172. # } else {
  173. # print "<td> &nbsp; </td>";
  174. # }
  175. #check item is not reserved
  176. my ($rescount,$reserves)=FindReserves($issue->[$i]{'biblionumber'},'');
  177. if ($rescount >0){
  178. print "<TD>On Request";
  179. } else {
  180. print "<TD>";
  181. }
  182. print "<input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=y>Y
  183. <input type=radio name=\"renew_item_$issue->[$i]{'itemnumber'}\" value=n>N</td>
  184. </tr>
  185. ";
  186. }
  187. print <<printend
  188. <tr VALIGN=TOP >
  189. <TD colspan=5 align=right>
  190. <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/update-renewals.gif">
  191. </td>
  192. </form>
  193. </tr>
  194. </table>
  195. <P>
  196. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
  197. <TR VALIGN=TOP>
  198. <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=5><B>ITEMS REQUESTED</b></TD>
  199. </TR>
  200. <TR VALIGN=TOP>
  201. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Title</b></TD>
  202. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Requested</b></TD>
  203. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Charge</b></TD>
  204. <td bgcolor="99cc33" background="/images/background-mem.gif"><B>Remove</b></TD>
  205. </TR>
  206. <form action=/cgi-bin/koha/modrequest.pl method=post>
  207. <input type=hidden name=from value=borrower>
  208. printend
  209. ;
  210. my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
  211. for (my $i=0;$i<$rescount;$i++){
  212. @temp=split('-',$reserves->[$i]{'reservedate'});
  213. $reserves->[$i]{'reservedate'}="$temp[2]/$temp[1]/$temp[0]";
  214. print "<tr VALIGN=TOP >
  215. <TD><a href=\"/cgi-bin/koha/request.pl?bib=$reserves->[$i]{'biblionumber'}\">$reserves->[$i]{'title'}</a></td>
  216. <TD>$reserves->[$i]{'reservedate'}</td>
  217. <input type=hidden name=biblio value=$reserves->[$i]{'biblionumber'}>
  218. <input type=hidden name=borrower value=$bornum>
  219. <TD></td>
  220. <TD><select name=\"rank-request\">
  221. <option value=n>No
  222. <option value=del>Yes
  223. </select>
  224. </tr>
  225. ";
  226. }
  227. print <<printend
  228. <tr VALIGN=TOP >
  229. <TD colspan=5 align=right>
  230. <INPUT TYPE="image" name="submit" VALUE="update" height=42 WIDTH=187 BORDER=0 src="/images/cancel-requests.gif"></td>
  231. </tr>
  232. </table>
  233. </form>
  234. <p align=right>
  235. <a href=/cgi-bin/koha/readingrec.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/reading-record.gif"></a>
  236. </p>
  237. printend
  238. ;
  239. print endmenu('member');
  240. print endpage();