<<

NAME

C4::Input - Miscellaneous sanity checks

SYNOPSIS

  use C4::Input;

DESCRIPTION

This module provides functions to see whether a given library card number or ISBN is valid.

FUNCTIONS

checkdigit
  $valid = &checkdigit($cardnumber $nounique);

Takes a card number, computes its check digit, and compares it to the checkdigit at the end of $cardnumber. Returns a true value iff $cardnumber has a valid check digit.

checkvalidisbn # Obsolete Function!
  $valid = &checkvalidisbn($isbn);

Returns a true value iff $isbn is a valid ISBN: it must be ten digits long (counting "X" as a digit), and must have a valid check digit at the end.

sub checkvalidisbn ($) { # Obsolete Function! my ($q) = shift or return undef; $q=~s/[^Xx\d]//g; /(\d{9})(X|\d)/i or /(\d{12})(X|\d)/i or return 0; my $checksum = $2; my $isbn = $1; my $c = 0; my $max = length $isbn; for (my $i=0; $i<$max; $i++) { my $digit=substr($q,$i,1); $c+=$digit*(10-$i); } $c %= 11; ($c==10) and $c = 'X'; return ($c eq $checksum) ? 1 : 0; }

buildCGISort
  $CGIScrollingList = &buildCGISort($name string, $input_name string);

Returns the scrolling list with name $input_name, built on authorised Values named $name. Returns NULL if no authorised values found

AUTHOR

Koha Developement team <info@koha.org>

<<