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.8,1.9


From: Mike Hansen
Subject: [Koha-cvs] CVS: koha/C4 Input.pm,1.8,1.9
Date: Tue, 18 Feb 2003 16:39:20 -0800

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

Modified Files:
        Input.pm 
Log Message:
Cleaned up the FIXME issues.


Index: Input.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Input.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** Input.pm    13 Oct 2002 11:35:08 -0000      1.8
--- Input.pm    19 Feb 2003 00:39:18 -0000      1.9
***************
*** 48,68 ****
  @ISA = qw(Exporter);
  @EXPORT = qw(
!       &checkflds &checkdigit &checkvalidisbn
  );
  
  # FIXME - This is never used.
! sub checkflds {
!   my ($env,$reqflds,$data) = @_;
!   my $numrflds = @$reqflds;
!   my @probarr;
!   my $i = 0;
!   while ($i < $numrflds) {
!     if ($data->address@hidden eq "") {
!       push(@probarr, @$reqflds[$i]);
!     }
!     $i++
!   }
!   return (address@hidden);
! }
  
  =item checkdigit
--- 48,68 ----
  @ISA = qw(Exporter);
  @EXPORT = qw(
!       &checkdigit &checkvalidisbn
  );
  
  # FIXME - This is never used.
! #sub checkflds {
! #  my ($env,$reqflds,$data) = @_;
! #  my $numrflds = @$reqflds;
! #  my @probarr;
! #  my $i = 0;
! #  while ($i < $numrflds) {
! #    if ($data->address@hidden eq "") {
! #      push(@probarr, @$reqflds[$i]);
! #    }
! #    $i++
! #  }
! #  return (address@hidden);
! #}
  
  =item checkdigit
***************
*** 86,97 ****
    my $valid = 0;
    #  print $infl."<br>";
!   # FIXME - for ($i = 1; $i < 8; $i++)
!   # or      foreach $i (1..7)
!   while ($i <8) {
      my $temp1 = $weightings[$i-1];
      my $temp2 = substr($infl,$i,1);
      $sum += $temp1 * $temp2;
  #    print "$sum $temp1 $temp2<br>";
-     $i++;
    }
    my $rem = ($sum%11);
--- 86,95 ----
    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);
***************
*** 128,150 ****
          $q=~s/[^X\d]//g;
          $q=~s/X.//g;
!         if (length($q)==10) {
!             my $checksum=substr($q,9,1);
!             my $isbn=substr($q,0,9);
!             my $i;
!             my $c=0;
!             for ($i=0; $i<9; $i++) {
!                 my $digit=substr($q,$i,1);
!                 $c+=$digit*(10-$i);
!             }
!           $c %= 11;
!             ($c==10) && ($c='X');
!             # FIXME - $isbngood = $c eq $checksum;
!             $isbngood = $c eq $checksum;
!         } else {
!             # FIXME - Put "return 0 if $length($q) != 10" near the
!             # top, so we don't have to indent the rest of the function
!             # as much.
!             $isbngood=0;
!         } # if length good
  
          return $isbngood;
--- 126,147 ----
          $q=~s/[^X\d]//g;
          $q=~s/X.//g;
!         
!       #return 0 if $q is not ten digits long
!       if ($length($q)!=10) {
!               return 0;
!       }
!       
!       #If we get to here, length($q) must be 10
!         my $checksum=substr($q,9,1);
!         my $isbn=substr($q,0,9);
!         my $i;
!         my $c=0;
!         for ($i=0; $i<9; $i++) {
!             my $digit=substr($q,$i,1);
!             $c+=$digit*(10-$i);
!         }
!       $c %= 11;
!         ($c==10) && ($c='X');
!         $isbngood = $c eq $checksum;
  
          return $isbngood;




reply via email to

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