[Koha-cvs] koha C4/Input.pm members/memberentry.pl [dev_week]

Kyle Hall kyle.m.hall at gmail.com
Tue May 15 17:24:58 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Kyle Hall <kylemhall>	07/05/15 15:24:58

Modified files:
	C4             : Input.pm 
	members        : memberentry.pl 

Log message:
	When updating an existing member, if one entered a currently used cardnumber,
	the system would not update the cardnumber, but did not give an error either.
	Updated Input.pm and memberentry.pl so the system will give an error
	if a duplicate cardnumber is used when updating a memeber.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Input.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.16.4.2&r2=1.16.4.2.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/members/memberentry.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.5.2.13.2.2&r2=1.5.2.13.2.3

Patches:
Index: C4/Input.pm
===================================================================
RCS file: /sources/koha/koha/C4/Input.pm,v
retrieving revision 1.16.4.2
retrieving revision 1.16.4.2.2.1
diff -u -b -r1.16.4.2 -r1.16.4.2.2.1
--- C4/Input.pm	5 Apr 2006 09:30:30 -0000	1.16.4.2
+++ C4/Input.pm	15 May 2007 15:24:57 -0000	1.16.4.2.2.1
@@ -81,7 +81,7 @@
 #'
 sub checkdigit {
 
-	my ($env,$infl, $nounique) =  @_;
+	my ($env,$infl, $nounique,$borrowernumber) =  @_;
 	$infl = uc $infl;
 
 
@@ -91,7 +91,7 @@
 	#different from the one where the checkdigit on the number is
 	#not correct
 
-	unless ( $nounique )
+	if ( ! $nounique ) ## We are creating a new borrower
 	{
 		my $dbh=C4::Context->dbh;
 		my $query=qq{SELECT * FROM borrowers WHERE cardnumber=?};
@@ -102,6 +102,24 @@
 		{
 			return 0;
 		}
+	} else {## We are updating a borrower, allow either same cardnumber, or new unique cardnumber
+	
+		my $dbh=C4::Context->dbh;
+		my $query=qq{SELECT * FROM borrowers WHERE borrowernumber=? AND cardnumber=?};
+		my $sth=$dbh->prepare($query);
+		$sth->execute($borrowernumber, $infl);
+		my %results = $sth->fetchrow_hashref();
+		if ( $sth->rows == 0 )
+		{
+			my $query=qq{SELECT * FROM borrowers WHERE cardnumber=?};
+			my $sth=$dbh->prepare($query);
+			$sth->execute($infl);
+			my %results = $sth->fetchrow_hashref();
+			if ( $sth->rows != 0 )
+			{
+				return 0;
+			}
+		}	
 	}
 	if (C4::Context->preference("checkdigit") eq "none") {
 		return 1;

Index: members/memberentry.pl
===================================================================
RCS file: /sources/koha/koha/members/memberentry.pl,v
retrieving revision 1.5.2.13.2.2
retrieving revision 1.5.2.13.2.3
diff -u -b -r1.5.2.13.2.2 -r1.5.2.13.2.3
--- members/memberentry.pl	3 May 2007 13:11:08 -0000	1.5.2.13.2.2
+++ members/memberentry.pl	15 May 2007 15:24:57 -0000	1.5.2.13.2.3
@@ -2,7 +2,7 @@
 # NOTE: This file uses standard 8-space tabs
 #       DO NOT SET TAB SIZE TO 4
 
-# $Id: memberentry.pl,v 1.5.2.13.2.2 2007/05/03 13:11:08 kylemhall Exp $
+# $Id: memberentry.pl,v 1.5.2.13.2.3 2007/05/15 15:24:57 kylemhall Exp $
 
 #script to set up screen for modification of borrower details
 #written 20/12/99 by chris at katipo.co.nz
@@ -83,17 +83,26 @@
 		} else {
 			$nounique = 1;
 		}
-		my $valid=checkdigit('',$data{'cardnumber'}, $nounique);
+		my $valid=checkdigit('',$data{'cardnumber'}, $nounique, $borrowernumber);
 		if ($valid != 1){
 			$nok=1;
 			push @errors, "ERROR_invalid_cardnumber";
 		}
 	}
-
-	if ($data{'sex'} eq '' && $categorycode ne "I"){
-		push @errors, "ERROR_gender";
+#	if ($data{'sex'} eq '' && $categorycode ne "I"){
+#		push @errors, "ERROR_gender";
+#		$nok=1;
+#	}
+## Added for CCFLS ONLY
+        if ($data{'dateofbirth'} eq ''){
+		push @errors,"ERROR_dateofbirth";
+		$nok=1;
+	}
+	if ($data{'othernames'} eq 'none'){
+	        push @errors,"ERROR_othernames";
 		$nok=1;
 	}
+## End of CCFLS Specific requirements
 
 	if ($data{'firstname'} eq '' && $categorycode ne "I"){
 		push @errors,"ERROR_firstname";





More information about the Koha-cvs mailing list