From b642e687d2ccca954945d1044df1089af49956c8 Mon Sep 17 00:00:00 2001 From: hdl Date: Tue, 24 Apr 2007 15:41:27 +0000 Subject: [PATCH] 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. --- C4/Members.pm | 58 ++++++++++++++++++------------------- circ/circulation.pl | 6 ++-- members/boraccount.pl | 2 +- members/guarantor_search.pl | 6 ++-- members/member.pl | 6 ++-- members/memberentry.pl | 2 +- members/moremember.pl | 2 +- members/pay.pl | 2 +- misc/notifys/fines.pl | 2 +- opac/opac-account.pl | 2 +- opac/opac-user.pl | 2 +- reserve/request.pl | 2 +- serials/distributedto.pl | 2 +- serials/member-search.pl | 2 +- 14 files changed, 47 insertions(+), 49 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index d04192933c..4f40b084e0 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -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 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 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); diff --git a/circ/circulation.pl b/circ/circulation.pl index b4a0cebb86..5782ae5e17 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -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, ); diff --git a/members/boraccount.pl b/members/boraccount.pl index d80e28faa1..7c27d80887 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -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; diff --git a/members/guarantor_search.pl b/members/guarantor_search.pl index b737a874ee..62048805ab 100755 --- a/members/guarantor_search.pl +++ b/members/guarantor_search.pl @@ -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, diff --git a/members/member.pl b/members/member.pl index 89163613c2..99e8340d61 100755 --- a/members/member.pl +++ b/members/member.pl @@ -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, diff --git a/members/memberentry.pl b/members/memberentry.pl index ebda6daf74..43f205308a 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -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, diff --git a/members/moremember.pl b/members/moremember.pl index 6d279c5499..3b415c542e 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -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); diff --git a/members/pay.pl b/members/pay.pl index 8e8220b105..a3a2f0a7c8 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -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 diff --git a/misc/notifys/fines.pl b/misc/notifys/fines.pl index 09e76b408b..58f63adb52 100755 --- a/misc/notifys/fines.pl +++ b/misc/notifys/fines.pl @@ -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'}"; diff --git a/opac/opac-account.pl b/opac/opac-account.pl index 8940abf70f..96d9c81713 100755 --- a/opac/opac-account.pl +++ b/opac/opac-account.pl @@ -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'} ); diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 274ca0bfa6..fe9bb4a370 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -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'} ) { diff --git a/reserve/request.pl b/reserve/request.pl index 659d91207d..f4615193e8 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -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; diff --git a/serials/distributedto.pl b/serials/distributedto.pl index 344986eea8..d9550a9124 100755 --- a/serials/distributedto.pl +++ b/serials/distributedto.pl @@ -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++){ diff --git a/serials/member-search.pl b/serials/member-search.pl index 7b17515b4f..e3defffeb7 100755 --- a/serials/member-search.pl +++ b/serials/member-search.pl @@ -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, -- 2.39.5