From b897d55f23e4ec487f7e51de5a2eb508f92a6012 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 5 Sep 2005 19:26:08 +0000 Subject: [PATCH] moving findguarantor sub to Members package --- C4/Members.pm | 32 +++++++++++++++++++++++++++++++- C4/Search.pm | 32 +------------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index a510e4b1c5..586e91b82a 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -49,7 +49,7 @@ C4::Members - Perl Module containing convenience functions for member handling @EXPORT = qw(); @EXPORT = qw( - &getmember &fixup_cardnumber &findguarantees &modmember &newmember &changepassword + &getmember &fixup_cardnumber &findguarantees &findguarantor &modmember &newmember &changepassword ); @@ -276,6 +276,36 @@ sub findguarantees { return($i,\@dat); } +=item findguarantor + + $guarantor = &findguarantor($borrower_no); + $guarantor_cardno = $guarantor->{"cardnumber"}; + $guarantor_surname = $guarantor->{"surname"}; + ... + +C<&findguarantor> takes a borrower number (presumably that of a child +patron), finds the guarantor for C<$borrower_no> (the child's parent), +and returns the record for the guarantor. + +C<&findguarantor> returns a reference-to-hash. Its keys are the fields +from the C database table; + +=cut +#' +sub findguarantor{ + my ($bornum)=@_; + my $dbh = C4::Context->dbh; + my $sth=$dbh->prepare("select guarantor from borrowers where borrowernumber=?"); + $sth->execute($bornum); + my $data=$sth->fetchrow_hashref; + $sth->finish; + $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?"); + $sth->execute($data->{'guarantor'}); + $data=$sth->fetchrow_hashref; + $sth->finish; + return($data); +} + # =item NewBorrowerNumber # # $num = &NewBorrowerNumber(); diff --git a/C4/Search.pm b/C4/Search.pm index 37b302a580..69198edd9c 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -62,40 +62,10 @@ on what is passed to it, it calls the appropriate search function. &itemdata &bibdata &GetItems &borrdata &itemnodata &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues &getboracctrecord &ItemType &itemissues &subject &subtitle -&addauthor &bibitems &barcodes &allissues -&findguarantor &getwebsites &getwebbiblioitems &catalogsearch &itemcount2 +&addauthor &bibitems &barcodes &allissues &getwebsites &getwebbiblioitems &catalogsearch &itemcount2 &isbnsearch &getbranchname &getborrowercategory); # make all your functions, whether exported or not; -=item findguarantor - - $guarantor = &findguarantor($borrower_no); - $guarantor_cardno = $guarantor->{"cardnumber"}; - $guarantor_surname = $guarantor->{"surname"}; - ... - -C<&findguarantor> takes a borrower number (presumably that of a child -patron), finds the guarantor for C<$borrower_no> (the child's parent), -and returns the record for the guarantor. - -C<&findguarantor> returns a reference-to-hash. Its keys are the fields -from the C database table; - -=cut -#' -sub findguarantor{ - my ($bornum)=@_; - my $dbh = C4::Context->dbh; - my $sth=$dbh->prepare("select guarantor from borrowers where borrowernumber=?"); - $sth->execute($bornum); - my $data=$sth->fetchrow_hashref; - $sth->finish; - $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?"); - $sth->execute($data->{'guarantor'}); - $data=$sth->fetchrow_hashref; - $sth->finish; - return($data); -} =item NewBorrowerNumber -- 2.20.1