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.13,1.14


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/C4 Input.pm,1.13,1.14
Date: Mon, 07 Jul 2003 07:43:44 -0700

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

Modified Files:
        Input.pm 
Log Message:
improving checkdigit sub.

Index: Input.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Input.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** Input.pm    1 Jul 2003 17:22:17 -0000       1.13
--- Input.pm    7 Jul 2003 14:43:42 -0000       1.14
***************
*** 91,95 ****
        #not correct
  
!       unless ( $nounique ) 
        {
                my $dbh=C4::Context->dbh;
--- 91,98 ----
        #not correct
  
!       if (C4::Context->preference("checkdigit") eq "none") {
!               return 1;
!       }
!       unless ( $nounique )
        {
                my $dbh=C4::Context->dbh;
***************
*** 104,129 ****
        }
  
!       if (C4::Context->preference("checkdigit") eq "none") {
!               return 1;
!       } else {
!               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
  
--- 107,128 ----
        }
  
!       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]