use strict;
require Exporter;
+use C4::Context;
use vars qw($VERSION @ISA @EXPORT);
=cut
#'
sub checkdigit {
- my ($env,$infl) = @_;
- $infl = uc $infl;
- my @weightings = (8,4,6,3,5,2,1);
- my $sum;
- my $i = 1;
- my $valid = 0;
- # print $infl."<br>";
-
- foreach $i (1..7) {
- my $temp1 = $weightings[$i-1];
- my $temp2 = substr($infl,$i,1);
- $sum += $temp1 * $temp2;
-# print "$sum $temp1 $temp2<br>";
- }
- my $rem = ($sum%11);
- if ($rem == 10) {
- $rem = "X";
- }
- #print $rem."<br>";
- if ($rem eq substr($infl,8,1)) {
- $valid = 1;
- }
- return $valid;
+ if (C4::Context->preference("checkdigit") eq "none") {
+ warn "XXcheckdigit : ".C4::Context->preference("checkdigit");
+ return 1;
+ } else {
+ my ($env,$infl) = @_;
+ $infl = uc $infl;
+ my @weightings = (8,4,6,3,5,2,1);
+ my $sum;
+ my $i = 1;
+ my $valid = 0;
+
+ foreach $i (1..7) {
+ my $temp1 = $weightings[$i-1];
+ my $temp2 = substr($infl,$i,1);
+ $sum += $temp1 * $temp2;
+ }
+ my $rem = ($sum%11);
+ if ($rem == 10) {
+ $rem = "X";
+ }
+ if ($rem eq substr($infl,8,1)) {
+ $valid = 1;
+ }
+ return $valid;
+ }
} # sub checkdigit
=item checkvalidisbn
{ uniquefieldrequired => 'variable', variable => 'timeout', value => '12000000', explanation => 'login timeout' },
{ uniquefieldrequired => 'variable', variable => 'marc', value => 'ON', explanation => 'MARC support (ON or OFF)' },
{ uniquefieldrequired => 'variable', variable => 'marcflavour', value => 'MARC21', explanation => 'your MARC flavor (MARC21 or UNIMARC) used for character encoding' },
+ { uniquefieldrequired => 'variable', variable => 'checkdigit', value => 'katipo', explanation => 'none= no check on member cardnumber. katipo= katipo check' },
],
);
exit;
# $Log$
+# Revision 1.38 2003/03/18 10:58:19 tipaul
+# adding checkdigit parameter that choose how to check the members cardnumber.
+# At the moment :
+# * none = no checking
+# * katipo = checked as before
+#
# Revision 1.37 2003/01/30 01:47:48 acli
# Corrected syntax error reported by Benedict
#