koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/C4 Input.pm,1.10,1.11


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/C4 Input.pm,1.10,1.11
Date: Tue, 18 Mar 2003 02:58:22 -0800

Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv15147/C4

Modified Files:
        Input.pm 
Log Message:
adding checkdigit parameter that choose how to check the members cardnumber.
At the moment :
* none = no checking
* katipo = checked as before

Index: Input.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Input.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** Input.pm    28 Feb 2003 16:29:11 -0000      1.10
--- Input.pm    18 Mar 2003 10:58:20 -0000      1.11
***************
*** 21,24 ****
--- 21,25 ----
  use strict;
  require Exporter;
+ use C4::Context;
  
  use vars qw($VERSION @ISA @EXPORT);
***************
*** 79,105 ****
  #'
  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;
  } # sub checkdigit
  
--- 80,108 ----
  #'
  sub checkdigit {
!       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
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]