Patch from Galen Charlton, removing $Id$ $Log$ and $Revision$ from files
[koha.git] / C4 / Members.pm
index 3dc493a..edd69c5 100644 (file)
@@ -17,7 +17,6 @@ package C4::Members;
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id$
 
 use strict;
 require Exporter;
@@ -31,7 +30,7 @@ use C4::Reserves;
 
 our ($VERSION,@ISA,@EXPORT,@EXPORT_OK);
 
-$VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = 3.00;
 
 =head1 NAME
 
@@ -591,8 +590,6 @@ sub ModMember {
     $data{'dateofbirth'}  = format_date_in_iso( $data{'dateofbirth'} ) if ($data{'dateofbirth'} );
     $data{'dateexpiry'}   = format_date_in_iso( $data{'dateexpiry'} ) if ($data{'dateexpiry'} );
     $data{'dateenrolled'} = format_date_in_iso( $data{'dateenrolled'} ) if ($data{'dateenrolled'} );
-#     warn Data::Dumper::Dumper(%data);
-    #   warn "num user".$data{'borrowernumber'};
     my $qborrower=$dbh->prepare("SHOW columns from borrowers");
     $qborrower->execute;
     my %hashborrowerfields;  
@@ -601,14 +598,13 @@ sub ModMember {
     }  
     my $query;
     my $sth;
-    $data{'userid'} = '' if ( $data{'password'} eq '' );  
     my @parameters;  
     
     # test to know if u must update or not the borrower password
     if ( $data{'password'} eq '****' ) {
         delete $data{'password'};
         foreach (keys %data)
-        {push @parameters,"$_ = ".$dbh->quote($data{$_}) if ($_ ne "flags" and $_ ne "borrowernumber" and $hashborrowerfields{$_}) } ;
+        {push @parameters,"$_ = ".$dbh->quote($data{$_}) if ($_ ne "borrowernumber" and $_ ne "flags"  and $hashborrowerfields{$_}) } ;
         $query = "UPDATE borrowers SET ".join (",",@parameters)
     ." WHERE borrowernumber=$data{'borrowernumber'}";
 #         warn "$query";
@@ -619,7 +615,7 @@ sub ModMember {
         $data{'password'} = md5_base64( $data{'password'} )   if ( $data{'password'} ne '' );
         delete $data{'password'} if ($data{password} eq "");
         foreach (keys %data)
-        {push @parameters,"$_ = ".$dbh->quote($data{$_}) if ($_ ne "flags" and $_ ne "borrowernumber" and $hashborrowerfields{$_})} ;
+        {push @parameters,"$_ = ".$dbh->quote($data{$_}) if ($_ ne "borrowernumber" and $_ ne "flags" and $hashborrowerfields{$_})} ;
         
         $query = "UPDATE borrowers SET ".join (",",@parameters)." WHERE borrowernumber=$data{'borrowernumber'}";
 #         warn "$query";
@@ -754,6 +750,7 @@ sub AddMember {
       . ",debarred="
       . $dbh->quote( $data{'debarred'} )
       . ",ethnicity="
+      . $dbh->quote( $data{'ethnicity'} )
       . ",ethnotes="
       . $dbh->quote( $data{'ethnotes'} );
 
@@ -1106,17 +1103,15 @@ sub GetMemberAccountRecords {
     my @acctlines;
     my $numlines = 0;
     my $strsth      = qq(
-SELECT * 
-FROM accountlines 
-WHERE borrowernumber=?);
+                        SELECT * 
+                        FROM accountlines 
+                        WHERE borrowernumber=?);
     my @bind = ($borrowernumber);
     if ($date && $date ne ''){
-    $strsth.="
-AND date < ? ";
-    push(@bind,$date);
+            $strsth.=" AND date < ? ";
+            push(@bind,$date);
     }
-    $strsth.="
-ORDER BY date desc,timestamp DESC";
+    $strsth.=" ORDER BY date desc,timestamp DESC";
     my $sth= $dbh->prepare( $strsth );
     $sth->execute( @bind );
     my $total = 0;
@@ -1150,16 +1145,15 @@ sub GetBorNotifyAcctRecord {
     my $dbh = C4::Context->dbh;
     my @acctlines;
     my $numlines = 0;
-    my $query    = qq| SELECT * 
-                       FROM accountlines 
-                       WHERE borrowernumber=? 
-                       AND notify_id=? 
-                       AND (accounttype='FU' OR accounttype='N' OR accounttype='M'OR accounttype='A'OR accounttype='F'OR accounttype='L' OR accounttype='IP' OR accounttype='CH' OR accounttype='RE' OR accounttype='RL')
-                       AND amountoutstanding != '0' 
-                       ORDER BY notify_id,accounttype
-               |;
-    my $sth = $dbh->prepare($query);
-
+    my $sth = $dbh->prepare(
+            "SELECT * 
+                FROM accountlines 
+                WHERE borrowernumber=? 
+                    AND notify_id=? 
+                    AND (accounttype='FU' OR accounttype='N' OR accounttype='M'OR accounttype='A'OR accounttype='F'OR accounttype='L' OR accounttype='IP' OR accounttype='CH' OR accounttype='RE' OR accounttype='RL')
+                    AND amountoutstanding != '0' 
+                ORDER BY notify_id,accounttype
+                ");
     $sth->execute( $borrowernumber, $notifyid );
     my $total = 0;
     while ( my $data = $sth->fetchrow_hashref ) {
@@ -1223,11 +1217,16 @@ sub checkuniquemember {
 }
 
 sub checkcardnumber {
-       my ($cardnumber) = @_;
+       my ($cardnumber,$borrowernumber) = @_;
        my $dbh = C4::Context->dbh;
        my $query = "SELECT * FROM borrowers WHERE cardnumber=?";
-       my $sth = $dbh->prepare($query);
-       $sth->execute($cardnumber);
+       $query .= " AND borrowernumber <> ?" if ($borrowernumber);
+  my $sth = $dbh->prepare($query);
+  if ($borrowernumber) {
+   $sth->execute($cardnumber,$borrowernumber);
+  } else { 
+        $sth->execute($cardnumber);
+  } 
        if (my $data= $sth->fetchrow_hashref()){
                return 1;
        }