#!/usr/bin/perl # script to do a borrower enquiry/bring up borrower details etc # Displays all the details about a borrower # written 20/12/99 by chris@katipo.co.nz # last modified 21/1/2000 by chris@katipo.co.nz # modified 31/1/2001 by chris@katipo.co.nz # to not allow items on request to be renewed # # needs html removed and to use the C4::Output more, but its tricky # use strict; use C4::Output; use CGI; use C4::Search; use Date::Manip; use C4::Reserves2; use C4::Circulation::Renewals2; use C4::Circulation::Circ2; use C4::Koha; my $input = new CGI; my $bornum=$input->param('bornum'); print $input->header; #start the page and read in includes print startpage(); print startmenu('member'); my $data=borrdata('',$bornum); $data->{'dateenrolled'} = slashifyDate($data->{'dateenrolled'}); $data->{'expiry'} = slashifyDate($data->{'expiry'}); $data->{'dateofbirth'} = slashifyDate($data->{'dateofbirth'}); $data->{'ethnicity'} = fixEthnicity($data->{'ethnicity'}); print <$data->{'firstname'} $data->{'surname'}

MEMBERSHIP RECORD

{'borrowernumber'}>


$data->{'title'} $data->{'othernames'} $data->{'surname'} ($data->{'firstname'}, $data->{'initials'})

Card Number: $data->{'cardnumber'}
printend ; if ($data->{'categorycode'} eq 'C'){ my $data2=borrdata('',$data->{'guarantor'}); $data->{'streetaddress'}=$data2->{'streetaddress'}; $data->{'city'}=$data2->{'city'}; $data->{'physstreet'}=$data2->{'phystreet'}; $data->{'streetcity'}=$data2->{'streetcity'}; $data->{'phone'}=$data2->{'phone'}; $data->{'phoneday'}=$data2->{'phoneday'}; } print <{'streetaddress'}, $data->{'city'}
Home Address: $data->{'physstreet'}, $data->{'streetcity'}
Phone (Home): $data->{'phone'}
Phone (Daytime): $data->{'phoneday'}
Fax: $data->{'faxnumber'}
E-mail: $data->{'emailaddress'}
Textmessaging:$data->{'textmessaging'}

Membership Number: $data->{'borrowernumber'}
Membership: $data->{'categorycode'}
Area: $data->{'area'}
Fee:$30/year, Paid
Joined: $data->{'dateenrolled'}, Expires: $data->{'expiry'}
Joining Branch: $data->{'homebranch'}

Ethnicity: $data->{'ethnicity'}, $data->{'ethnotes'}
DoB: $data->{'dateofbirth'}
Sex: $data->{'sex'}

Alternative Contact:$data->{'contactname'}
Phone: $data->{'altphone'}
Relationship: $data->{'altrelationship'}
Notes: $data->{'altnotes'}

printend ; if ($data->{'categorycode'} ne 'C'){ print " Guarantees:"; # FIXME # It looks like the $i is only being returned to handle walking through # the array, which is probably better done as a foreach loop. # my ($count,$guarantees)=findguarantees($data->{'borrowernumber'}); for (my $i=0;$i<$count;$i++){ print "[$i]->{'borrowernumber'}\">$guarantees->[$i]->{'cardnumber'}
"; } } else { print "Guarantor:"; my ($guarantor)=findguarantor($data->{'borrowernumber'}); if ($guarantor->{'borrowernumber'} == 0){ print "no guarantor
"; } else { print "{'borrowernumber'}\">$guarantor->{'cardnumber'}
"; } } print < General Notes: $data->{'borrowernotes'}

printend ; my %bor; $bor{'borrowernumber'}=$bornum; # FIXME # it looks like $numaccts is a temp variable and that the # for (my $i;$i<$numaccts;$i+++) # can be turned into a foreach loop instead # my ($numaccts,$accts,$total)=getboracctrecord('',\%bor); #if ($numaccts > 10){ # $numaccts=10; #} for (my$i=0;$i<$numaccts;$i++){ #if ($accts->[$i]{'accounttype'} ne 'Pay'){ my $amount= $accts->[$i]{'amount'} + 0.00; my $amount2= $accts->[$i]{'amountoutstanding'} + 0.00; if ($amount2 != 0){ print ""; my $item="   "; $accts->[$i]{'date'} = slashifyDate($accts->[$i]{'date'}); if ($accts->[$i]{'accounttype'} ne 'Res'){ #get item data #$item= } print ""; # print ""; print ""; } } print <
FINES & CHARGES
$accts->[$i]{'date'}$accts->[$i]{'accounttype'}"; # FIXME # why set this variable if it's not going to be used? # my $env; if ($accts->[$i]{'accounttype'} ne 'Res'){ my $iteminfo=C4::Circulation::Circ2::getiteminformation($env,$accts->[$i]->{'itemnumber'},''); print "[$i]->{'itemnumber'}&bib=$iteminfo->{'biblionumber'}&bi=$iteminfo->{'biblioitemnumber'}>$accts->[$i]->{'description'} $accts->[$i]{'title'}"; } print " $amount$amount2

printend ; my ($count,$issue)=borrissues($bornum); my $today=ParseDate('today'); for (my $i=0;$i<$count;$i++){ print ""; #find the charge for an item my ($charge,$itemtype)=calc_charges(\%env,$issue->[$i]{'itemnumber'},$bornum); print ""; print ""; # if ($datedue < $today){ # print ""; # } else { # print ""; # } #check item is not reserved my ($rescount,$reserves)=Findgroupreserve($issue->[$i]{'biblioitemnumber'},$issue->[$i]{'biblionumber'}); if ($rescount >0){ print ""; # } elsif ($issue->[$i]->{'renewals'} > 0) { # print ""; } else { print " "; } } print <
ITEMS CURRENTLY ON ISSUE
Title Due Itemtype Charge Renew
"; my $datedue=ParseDate($issue->[$i]{'date_due'}); $issue->[$i]{'date_due'} = slashifyDate($issue->[$i]{'date_due'}); if ($datedue < $today){ print ""; } print "$issue->[$i]{'title'} [$i]->{'itemnumber'}&bib=$issue->[$i]->{'biblionumber'}&bi=$issue->[$i]->{'biblioitemnumber'}> $issue->[$i]{'barcode'} $issue->[$i]{'date_due'}$itemtype$chargeOverdue   [$i]{'biblionumber'}>On Request - no renewals
Previously Renewed - no renewals
"; print "[$i]{'itemnumber'}\" value=y>Y [$i]{'itemnumber'}\" value=n>N

printend ; my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2 # FIXME # does it make sense to turn this into a foreach my $i (0..$rescount) # kind of loop? # for (my $i=0;$i<$rescount;$i++){ $reserves->[$i]{'reservedate'} = slashifyDate($reserves->[$i]{'reservedate'}); print "[$i]{'biblionumber'}> "; } print <
ITEMS REQUESTED
Title Requested Charge Remove
[$i]{'biblionumber'}\">$reserves->[$i]{'btitle'} $reserves->[$i]{'reservedate'}

printend ; print endmenu('member'); print endpage();