Still Code Cleaning.

Abiding by Name Convention.
Using Members wherever it should be used.
Borrower is only used for borrower Categories.
+ GetBorrowersWhoHaveNeverBorrowed
and lists like that.
This commit is contained in:
hdl 2007-04-24 15:41:27 +00:00
parent 7d8e8b0bf6
commit b642e687d2
14 changed files with 47 additions and 49 deletions

View File

@ -55,15 +55,13 @@ This module contains routines for adding, modifying and deleting members/patrons
#Get data
push @EXPORT, qw(
&SearchBorrower
&SearchMember
&GetMemberDetails
&GetMember
&GetGuarantees
&findguarantor
&GuarantornameSearch
&GetBorrowerIssuesAndFines
&GetMemberIssuesAndFines
&GetPendingIssues
&GetAllIssues
@ -76,20 +74,20 @@ push @EXPORT, qw(
&GetRoadTypes
&GetRoadTypeDetails
&GetBorrowerAcctRecord
&GetMemberAccountRecords
&GetborCatFromCatType
&GetBorrowercategory
&GetBorNotifyAcctRecord
&GetMembeReregistration
&ExtendMemberSubscriptionTo
&GetSortDetails
&GetBorrowersTitles
&GetTitles
&GetBorrowersWhoHaveNotBorrowedSince
&GetBorrowersWhoHaveNeverBorrowed
&GetBorrowersWithIssuesHistoryOlderThan
&GetBorrowersFromSurname
&GetMembersFromSurname
&GetExpiryDate
);
@ -118,9 +116,9 @@ push @EXPORT, qw(
&MoveMemberToDeleted
);
=item Searchborrower
=item SearchMember
($count, $borrowers) = &SearchBorrower($searchstring, $type,$category_type);
($count, $borrowers) = &SearchMember($searchstring, $type,$category_type);
Looks up patrons (borrowers) by name.
@ -135,7 +133,7 @@ C<$searchstring> is a space-separated list of search terms. Each term
must match the beginning a borrower's surname, first name, or other
name.
C<&SearchBorrower> returns a two-element list. C<$borrowers> is a
C<&SearchMember> returns a two-element list. C<$borrowers> is a
reference-to-array; each element is a reference-to-hash, whose keys
are the fields of the C<borrowers> table in the Koha database.
C<$count> is the number of elements in C<$borrowers>.
@ -145,7 +143,7 @@ C<$count> is the number of elements in C<$borrowers>.
#'
#used by member enquiries from the intranet
#called by member.pl
sub SearchBorrower {
sub SearchMember {
my ($searchstring, $orderby, $type,$category_type ) = @_;
my $dbh = C4::Context->dbh;
my $query = "";
@ -322,9 +320,9 @@ sub GetMemberDetails {
return undef;
}
my $borrower = $sth->fetchrow_hashref;
my ($amount) = GetBorrowerAcctRecord( $borrowernumber);
my ($amount) = GetMemberAccountRecords( $borrowernumber);
$borrower->{'amountoutstanding'} = $amount;
my $flags = patronflags( $borrower, $dbh );
my $flags = patronflags( $borrower);
my $accessflagshash;
$sth = $dbh->prepare("select bit,flag from userflags");
@ -355,7 +353,7 @@ sub GetMemberDetails {
NOTE!: If you change this function, be sure to update the POD for
&GetMemberDetails.
$flags = &patronflags($patron, $dbh);
$flags = &patronflags($patron);
$flags->{CHARGES}
{message} Message showing patron's credit or debt
@ -386,7 +384,7 @@ sub patronflags {
my %flags;
my ( $patroninformation) = @_;
my $dbh=C4::Context->dbh;
my ($amount) = GetBorrowerAcctRecord( $patroninformation->{'borrowernumber'});
my ($amount) = GetMemberAccountRecords( $patroninformation->{'borrowernumber'});
if ( $amount > 0 ) {
my %flaginfo;
my $noissuescharge = C4::Context->preference("noissuescharge");
@ -513,14 +511,14 @@ sub GetMember {
}
}
=item GetBorrowerIssuesAndFines
=item GetMemberIssuesAndFines
($borrowed, $due, $fine) = &GetBorrowerIssuesAndFines($borrowernumber);
($borrowed, $due, $fine) = &GetMemberIssuesAndFines($borrowernumber);
Returns aggregate data about items borrowed by the patron with the
given borrowernumber.
C<&GetBorrowerIssuesAndFines> returns a three-element array. C<$borrowed> is the
C<&GetMemberIssuesAndFines> returns a three-element array. C<$borrowed> is the
number of books the patron currently has borrowed. C<$due> is the
number of overdue items the patron currently has borrowed. C<$fine> is
the total fine currently due by the borrower.
@ -528,7 +526,7 @@ the total fine currently due by the borrower.
=cut
#'
sub GetBorrowerIssuesAndFines {
sub GetMemberIssuesAndFines {
my ( $borrowernumber ) = @_;
my $dbh = C4::Context->dbh;
my $query =
@ -1088,13 +1086,13 @@ sub GetAllIssues {
}
=head2 GetBorrowerAcctRecord
=head2 GetMemberAccountRecords
($total, $acctlines, $count) = &GetBorrowerAcctRecord($borrowernumber);
($total, $acctlines, $count) = &GetMemberAccountRecords($borrowernumber);
Looks up accounting data for the patron with the given borrowernumber.
C<&GetBorrowerAcctRecord> returns a three-element array. C<$acctlines> is a
C<&GetMemberAccountRecords> returns a three-element array. C<$acctlines> is a
reference-to-array, where each element is a reference-to-hash; the
keys are the fields of the C<accountlines> table in the Koha database.
C<$count> is the number of elements in C<$acctlines>. C<$total> is the
@ -1103,7 +1101,7 @@ total amount outstanding for all of the account lines.
=cut
#'
sub GetBorrowerAcctRecord {
sub GetMemberAccountRecords {
my ($borrowernumber,$date) = @_;
my $dbh = C4::Context->dbh;
my @acctlines;
@ -1486,11 +1484,11 @@ sub add_member_orgs {
} # sub add_member_orgs
=head2 GetBorrowersFromSurname
=head2 GetMembersFromSurname
=over 4
\@resutlts = GetBorrowersFromSurname($surname)
\@resutlts = GetMembersFromSurname($surname)
this function get the list of borrower names like $surname.
return :
the table of results in @results
@ -1499,7 +1497,7 @@ the table of results in @results
=cut
sub GetBorrowersFromSurname {
sub GetMembersFromSurname {
my ($searchstring) = @_;
my $dbh = C4::Context->dbh;
$searchstring =~ s/\'/\\\'/g;
@ -1716,15 +1714,15 @@ sub GetRoadTypes {
=head2 GetBorrowersTitles (OUEST-PROVENCE)
=head2 GetTitles (OUEST-PROVENCE)
($borrowertitle)= &GetBorrowersTitles();
($borrowertitle)= &GetTitles();
Looks up the different title . Returns array with all borrowers title
=cut
sub GetBorrowersTitles {
sub GetTitles {
my @borrowerTitle = split /,|\|/,C4::Context->preference('BorrowersTitles');
unshift( @borrowerTitle, "" );
return ( \@borrowerTitle);

View File

@ -141,7 +141,7 @@ my $borrowerslist;
my $message;
if ($findborrower) {
my ( $count, $borrowers ) =
SearchBorrower($findborrower, 'cardnumber', 'web' );
SearchMember($findborrower, 'cardnumber', 'web' );
my @borrowers = @$borrowers;
if ( $#borrowers == -1 ) {
$query->param( 'findborrower', '' );
@ -163,7 +163,7 @@ my @lines;
if ($borrowernumber) {
$borrower = GetMemberDetails( $borrowernumber, 0 );
my ( $od, $issue, $fines ) = GetBorrowerIssuesAndFines( $borrowernumber );
my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
# Warningdate is the date that the warning starts appearing
my ( $today_year, $today_month, $today_day ) = Today();
@ -248,7 +248,7 @@ if ($barcode) {
}
# FIXME If the issue is confirmed, we launch another time borrdata2, now display the issue count after issue
my ( $od, $issue, $fines ) = GetBorrowerIssuesAndFines( $borrowernumber );
my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
$template->param(
issuecount => $issue,
);

View File

@ -50,7 +50,7 @@ my $borrowernumber=$input->param('borrowernumber');
my $data=GetMember($borrowernumber,'borrowernumber');
#get account details
my ($numaccts,$accts,$total)=GetBorrowerAcctRecord($borrowernumber);
my ($numaccts,$accts,$total)=GetMemberAccountRecords($borrowernumber);
my $totalcredit;
if($total <= 0){
$totalcredit = 1;

View File

@ -64,15 +64,15 @@ my $background = 0;
if ($member ne ''){
if(length($member) == 1)
{
($count,$results)=SearchBorrower($member,$orderby,"simple",'A');
($count,$results)=SearchMember($member,$orderby,"simple",'A');
}
else
{
($count,$results)=SearchBorrower($member,$orderby,"advanced",'A');
($count,$results)=SearchMember($member,$orderby,"advanced",'A');
}
for (my $i=0; $i < $count; $i++){
#find out stats
my ($od,$issue,$fines)=GetBorrowerIssuesAndFines($results->[$i]{'borrowerid'});
my ($od,$issue,$fines)=GetMemberIssuesAndFines($results->[$i]{'borrowerid'});
my $guarantorinfo=uc($results->[$i]{'surname'})." , ".ucfirst($results->[$i]{'firstname'});
my %row = (
background => $background,

View File

@ -71,11 +71,11 @@ my ($count,$results);
if(length($member) == 1)
{
($count,$results)=SearchBorrower($member,$orderby,"simple");
($count,$results)=SearchMember($member,$orderby,"simple");
}
else
{
($count,$results)=SearchBorrower($member,$orderby,"advanced");
($count,$results)=SearchMember($member,$orderby,"advanced");
}
@ -83,7 +83,7 @@ my @resultsdata;
my $background = 0;
for (my $i=0; $i < $count; $i++){
#find out stats
my ($od,$issue,$fines)=GetBorrowerIssuesAndFines($results->[$i]{'borrowernumber'});
my ($od,$issue,$fines)=GetMemberIssuesAndFines($results->[$i]{'borrowernumber'});
my %row = (
background => $background,

View File

@ -325,7 +325,7 @@ if ($delete){
my $default_borrowertitle;
$default_borrowertitle=$data{'title'} ;
my($borrowertitle)=GetBorrowersTitles();
my($borrowertitle)=GetTitles();
my $borrotitlepopup = CGI::popup_menu(-name=>'title',
-id => 'title',
-values=>$borrowertitle,

View File

@ -192,7 +192,7 @@ $data->{'branchname'} =
( ( GetBranchDetail( $data->{'branchcode'} ) )->{'branchname'} );
my ( $total, $accts, $numaccts) = GetBorrowerAcctRecord( $borrowernumber );
my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
my $lib1 = &GetSortDetails( "Bsort1", $data->{'sort1'} );
my $lib2 = &GetSortDetails( "Bsort2", $data->{'sort2'} );
( $template->param( lib1 => $lib1 ) ) if ($lib1);

View File

@ -89,7 +89,7 @@ if ( $check == 0 ) {
recordpayment( $borrowernumber, $total );
}
my ( $total, $accts, $numaccts) = GetBorrowerAcctRecord( $borrowernumber );
my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
# creation d'une fonction qui va nous retourner le notify_id dans un tableau

View File

@ -315,7 +315,7 @@ my %actions;
$template->param(BOOKDETAILS => \@bookdetails);
my %params;
%params->{'borrowernumber'} = $overdue->{'borrowernumber'};
my ($total, $acctlines, $count) = &GetBorrowerAcctRecord($overdue->{'borrowernumber'});
my ($total, $acctlines, $count) = &GetMemberAccountRecords($overdue->{'borrowernumber'});
$template->param(FINES_TOTAL => $total_fines);
$template->param(OWING => $total);
my $name= "$borrower->{'firstname'} $borrower->{'surname'}";

View File

@ -47,7 +47,7 @@ $bordat[0] = $borr;
$template->param( BORROWER_INFO => \@bordat );
#get account details
my ( $total , $accts, $numaccts) = GetBorrowerAcctRecord( $borrowernumber );
my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
$accts->[$i]{'date'} = format_date( $accts->[$i]{'date'} );

View File

@ -92,7 +92,7 @@ foreach my $issue ( @$issues ) {
$issue->{'reserved'} = 1;
}
my ( $total , $accts, $numaccts) = GetBorrowerAcctRecord( $borrowernumber );
my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
my $charges = 0;
foreach my $ac (@$accts) {
if ( $ac->{'itemnumber'} == $issue->{'itemnumber'} ) {

View File

@ -68,7 +68,7 @@ my $date = sprintf( '%04d-%02d-%02d', Today() );
if ($findborrower) {
my ( $count, $borrowers ) =
SearchBorrower($findborrower, 'cardnumber', 'web' );
SearchMember($findborrower, 'cardnumber', 'web' );
my @borrowers = @$borrowers;

View File

@ -79,7 +79,7 @@ my ($template, $borrowernumber, $cookie)
debug => 1,
});
my ($count,$results)=GetBorrowersFromSurname($searchfield) if $searchfield;
my ($count,$results)=GetMembersFromSurname($searchfield) if $searchfield;
my $toggle="0";
my @loop_data =();
for (my $i=0; $i < $count; $i++){

View File

@ -43,7 +43,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
);
if ($searchstring) {
my ( $count, $members ) = &SearchBorrower( '', $searchstring, "surname" );
my ( $count, $members ) = &SearchMember( '', $searchstring, "surname" );
$template->param(
subscriptionid => $subscriptionid,