[Koha-cvs] koha/C4 Members.pm

Henri-Damien LAURENT laurenthdl at alinto.com
Tue Apr 24 15:57:13 CEST 2007


CVSROOT:	/cvsroot/koha
Module name:	koha
Changes by:	Henri-Damien LAURENT <hdl>	07/04/24 13:57:13

Modified files:
	C4             : Members.pm 

Log message:
	Continuing Code Cleaning.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Members.pm?cvsroot=koha&r1=1.45&r2=1.46

Patches:
Index: Members.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Members.pm,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- Members.pm	23 Apr 2007 15:21:17 -0000	1.45
+++ Members.pm	24 Apr 2007 13:57:13 -0000	1.46
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Members.pm,v 1.45 2007/04/23 15:21:17 tipaul Exp $
+# $Id: Members.pm,v 1.46 2007/04/24 13:57:13 hdl Exp $
 
 use strict;
 require Exporter;
@@ -31,7 +31,7 @@
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
-$VERSION = do { my @v = '$Revision: 1.45 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.46 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -120,7 +120,7 @@
 
 =item Searchborrower
 
-  ($count, $borrowers) = &SearchBorrower($searchstring, $type);
+  ($count, $borrowers) = &SearchBorrower($searchstring, $type,$category_type);
 
 Looks up patrons (borrowers) by name.
 
@@ -128,6 +128,9 @@
 if $type is "simple", search is performed on the first letter of the
 surname only.
 
+$category_type is used to get a specified type of user. 
+(mainly adults when creating a child.)
+
 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.
@@ -560,7 +563,7 @@
 
 =item ModMember
 
-  ($borrowed, $due, $fine) = &ModMember($borrowernumber);
+  &ModMember($borrowernumber);
 
 Modify borrower's data
 
@@ -679,9 +682,10 @@
 
 =item AddMember
 
-  $borrowernumber = &ModMember(%borrower);
+  $borrowernumber = &AddMember(%borrower);
 
 insert new borrower into table
+Returns the borrowernumber
 
 =cut
 
@@ -815,7 +819,6 @@
         return 0;
     }
     else {
-
         #Everything is good so we can update the information.
         $sth =
           $dbh->prepare(
@@ -829,26 +832,6 @@
 }
 
 
-sub UpdateGuarantees {
-    my (%data) = @_;
-    my $dbh = C4::Context->dbh;
-    my ( $count, $guarantees ) = GetGuarantees( $data{'borrowernumber'} );
-    for ( my $i = 0 ; $i < $count ; $i++ ) {
-
-        # 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 $guaquery = qq|UPDATE borrowers 
-			  SET address='$data{'address'}',fax='$data{'fax'}',
- 			      B_city='$data{'B_city'}',mobile='$data{'mobile'}',city='$data{'city'}',phone='$data{'phone'}'
- 			  WHERE borrowernumber='$guarantees->[$i]->{'borrowernumber'}'
-		|;
-        my $sth3 = $dbh->prepare($guaquery);
-        $sth3->execute;
-        $sth3->finish;
-    }
-}
 
 =item fixup_cardnumber
 
@@ -966,6 +949,37 @@
     return ( scalar(@$data), $data );
 }
 
+=head2 UpdateGuarantees
+
+  &UpdateGuarantees($parent_borrno);
+  
+
+C<&UpdateGuarantees> borrower data for an adulte and updates all the guarantees
+with the modified information
+
+=cut
+
+#'
+sub UpdateGuarantees {
+    my (%data) = @_;
+    my $dbh = C4::Context->dbh;
+    my ( $count, $guarantees ) = GetGuarantees( $data{'borrowernumber'} );
+    for ( my $i = 0 ; $i < $count ; $i++ ) {
+
+        # 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 $guaquery = qq|UPDATE borrowers 
+			  SET address='$data{'address'}',fax='$data{'fax'}',
+ 			      B_city='$data{'B_city'}',mobile='$data{'mobile'}',city='$data{'city'}',phone='$data{'phone'}'
+ 			  WHERE borrowernumber='$guarantees->[$i]->{'borrowernumber'}'
+		|;
+        my $sth3 = $dbh->prepare($guaquery);
+        $sth3->execute;
+        $sth3->finish;
+    }
+}
 =head2 GetPendingIssues
 
   ($count, $issues) = &GetPendingIssues($borrowernumber);
@@ -1134,7 +1148,7 @@
 =cut
 
 sub GetBorNotifyAcctRecord {
-    my ( $params, $notifyid ) = @_;
+    my ( $borrowernumber, $notifyid ) = @_;
     my $dbh = C4::Context->dbh;
     my @acctlines;
     my $numlines = 0;
@@ -1148,7 +1162,7 @@
 		|;
     my $sth = $dbh->prepare($query);
 
-    $sth->execute( $params->{'borrowernumber'}, $notifyid );
+    $sth->execute( $borrowernumber, $notifyid );
     my $total = 0;
     while ( my $data = $sth->fetchrow_hashref ) {
         $acctlines[$numlines] = $data;
@@ -1156,7 +1170,7 @@
         $total += $data->{'amountoutstanding'};
     }
     $sth->finish;
-    return ( $numlines, \@acctlines, $total );
+    return ( $total, \@acctlines, $numlines );
 }
 
 =head2 checkuniquemember (OUEST-PROVENCE)





More information about the Koha-cvs mailing list