[Koha-cvs] koha/C4 Members.pm

Bruno Toumi btoumi at ouestprovence.fr
Fri Jun 2 17:48:10 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch: 	
Changes by:	Bruno Toumi <btoumi at savannah.gnu.org>	06/06/02 15:48:10

Modified files:
	C4             : Members.pm 

Log message:
	modifiy sql syntax for modmember and newmember
	add right field in sql syntax
	move get_age function from memberentry.pl

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Members.pm.diff?tr1=1.20&tr2=1.21&r1=text&r2=text

Patches:
Index: koha/C4/Members.pm
diff -u koha/C4/Members.pm:1.20 koha/C4/Members.pm:1.21
--- koha/C4/Members.pm:1.20	Fri Jun  2 14:51:43 2006
+++ koha/C4/Members.pm	Fri Jun  2 15:48:10 2006
@@ -19,7 +19,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.20 2006/06/02 14:51:43 btoumi Exp $
+# $Id: Members.pm,v 1.21 2006/06/02 15:48:10 btoumi Exp $
 
 use strict;
 require Exporter;
@@ -31,7 +31,7 @@
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
-$VERSION = do { my @v = '$Revision: 1.20 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.21 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -307,6 +307,7 @@
 	$data{'dateenrolled'}=format_date_in_iso($data{'dateenrolled'});
 	warn "la date:".$data{dateenrolled};
 	my $query;
+	my $sth;
 	$data{'userid'}='' if ($data{'password'}eq '');
 	# test to know if u must update or not the borrower password
 	if ($data{'password'} eq '****'){
@@ -318,27 +319,10 @@
 		B_streettype = ?,B_address = ?,B_city = ?,B_zipcode = ?,B_email = ?,B_phone = ?,dateofbirth = ?,branchcode = ?,
 		categorycode = ?,dateenrolled = ?,dateexpiry = ?,gonenoaddress = ?,lost = ?,debarred = ?,contactname = ?,
 		contactfirstname = ?,contacttitle = ?,guarantorid = ?,borrowernotes = ?,relationship =  ?,ethnicity = ?,
-		ethnotes = ?,sex = ?,password = ?,flags = ?,userid = ?,opacnote = ?,contactnote = ?,sort1 = ?,sort2 = ? 
-		WHERE borrowernumber=$data{'borrowernumber'}";
-	}
-	else{
-		
-		($data{'password'}=md5_base64($data{'password'})) if ($data{'password'} ne '');
-		$query="UPDATE borrowers SET 
-		cardnumber  = ?,surname = ?,firstname = ?,title = ?,othernames = ?,initials = ?,
-		streetnumber = ?,streettype = ?,address = ?,address2 = ?,city = ?,zipcode = ?,
-		email = ?,phone = ?,mobile = ?,fax = ?,emailpro = ?,phonepro = ?,B_streetnumber = ?,
-		B_streettype = ?,B_address = ?,B_city = ?,B_zipcode = ?,B_email = ?,B_phone = ?,dateofbirth = ?,branchcode = ?,
-		categorycode = ?,dateenrolled = ?,dateexpiry = ?,gonenoaddress = ?,lost = ?,debarred = ?,contactname = ?,
-		contactfirstname = ?,contacttitle = ?,guarantorid = ?,borrowernotes = ?,relationship =  ?,ethnicity = ?,
-		ethnotes = ?,sex = ?,password = ?,flags = ?,userid = ?,opacnote = ?,contactnote = ?,sort1 = ?,sort2 = ? 
+		ethnotes = ?,sex = ?,flags = ?,userid = ?,opacnote = ?,contactnote = ?,sort1 = ?,sort2 = ? 
 		WHERE borrowernumber=$data{'borrowernumber'}";
-	
-	}
-	my $sth=$dbh->prepare($query);
-
-	if ($data{'password'} eq '****'){
-		$sth->execute(
+	$sth=$dbh->prepare($query);
+	$sth->execute(
 		$data{'cardnumber'},$data{'surname'},
 		$data{'firstname'},$data{'title'},
 		$data{'othernames'},$data{'initials'},
@@ -359,14 +343,25 @@
 		$data{'contacttitle'},$data{'guarantorid'},
 		$data{'borrowernotes'},$data{'relationship'},
 		$data{'ethnicity'},$data{'ethnotes'},
-		$data{'sex'},$data{'password'},
+		$data{'sex'},
 		$data{'flags'},$data{'userid'},
 		$data{'opacnote'},$data{'contactnote'},
-		$data{'sort1'},$data{'sort2'}
-		);
-	
-	}else{
-		$sth->execute(
+		$data{'sort1'},$data{'sort2'});
+	}
+	else{
+		
+		($data{'password'}=md5_base64($data{'password'})) if ($data{'password'} ne '');
+		$query="UPDATE borrowers SET 
+		cardnumber  = ?,surname = ?,firstname = ?,title = ?,othernames = ?,initials = ?,
+		streetnumber = ?,streettype = ?,address = ?,address2 = ?,city = ?,zipcode = ?,
+		email = ?,phone = ?,mobile = ?,fax = ?,emailpro = ?,phonepro = ?,B_streetnumber = ?,
+		B_streettype = ?,B_address = ?,B_city = ?,B_zipcode = ?,B_email = ?,B_phone = ?,dateofbirth = ?,branchcode = ?,
+		categorycode = ?,dateenrolled = ?,dateexpiry = ?,gonenoaddress = ?,lost = ?,debarred = ?,contactname = ?,
+		contactfirstname = ?,contacttitle = ?,guarantorid = ?,borrowernotes = ?,relationship =  ?,ethnicity = ?,
+		ethnotes = ?,sex = ?,password = ?,flags = ?,userid = ?,opacnote = ?,contactnote = ?,sort1 = ?,sort2 = ? 
+		WHERE borrowernumber=$data{'borrowernumber'}";
+	$sth=$dbh->prepare($query);
+	$sth->execute(
 		$data{'cardnumber'},$data{'surname'},
 		$data{'firstname'},$data{'title'},
 		$data{'othernames'},$data{'initials'},
@@ -393,8 +388,6 @@
 		$data{'sort1'},$data{'sort2'}
 		);
 	}
-
-	$sth->execute;
 	$sth->finish;
 	# ok if its an adult (type) it may have borrowers that depend on it as a guarantor
 	# so when we update information for an adult we should check for guarantees and update the relevant part





More information about the Koha-cvs mailing list