moving findguarantor sub to Members package

This commit is contained in:
tipaul 2005-09-05 19:26:08 +00:00
parent af0ff4419f
commit b897d55f23
2 changed files with 32 additions and 32 deletions

View File

@ -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<borrowers> 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();

View File

@ -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<borrowers> 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