[Koha-cvs] CVS: koha/C4 Input.pm,1.12,1.13
Mike Hansen
wolfpac444 at users.sourceforge.net
Tue Jul 1 19:22:19 CEST 2003
Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv28465/koha/C4
Modified Files:
Input.pm
Log Message:
Index: Input.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Input.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** Input.pm 19 Mar 2003 21:03:33 -0000 1.12
--- Input.pm 1 Jul 2003 17:22:17 -0000 1.13
***************
*** 80,88 ****
#'
sub checkdigit {
if (C4::Context->preference("checkdigit") eq "none") {
return 1;
} else {
- my ($env,$infl) = @_;
- $infl = uc $infl;
my @weightings = (8,4,6,3,5,2,1);
my $sum;
--- 80,110 ----
#'
sub checkdigit {
+
+ my ($env,$infl, $nounique) = @_;
+ $infl = uc $infl;
+
+
+ #Check to make sure the cardnumber is unique
+
+ #FIXME: We should make the error for a nonunique cardnumber
+ #different from the one where the checkdigit on the number is
+ #not correct
+
+ unless ( $nounique )
+ {
+ my $dbh=C4::Context->dbh;
+ my $query=qq{SELECT * FROM borrowers WHERE cardnumber="$infl"};
+ my $sth=$dbh->prepare($query);
+ $sth->execute;
+ my %results = $sth->fetchrow_hashref();
+ if ( $sth->rows != 0 )
+ {
+ return 0;
+ }
+ }
+
if (C4::Context->preference("checkdigit") eq "none") {
return 1;
} else {
my @weightings = (8,4,6,3,5,2,1);
my $sum;
More information about the Koha-cvs
mailing list