@@ -, +, @@ ISBN flaw - In the "Cataloging search" form at the top of the page, test various searches to confirm that results are returned in both the catalog and the reservoir: - Any title search - A search for a title which begins with a numeral, e.g. "1st to die" - A search by 10-digit ISBN - A search by 13-digit ISBN --- cataloguing/addbooks.pl | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) --- a/cataloguing/addbooks.pl +++ a/cataloguing/addbooks.pl @@ -85,7 +85,6 @@ if ($query) { if ( defined $error ) { $template->param( error => $error ); - warn "error: " . $error; output_html_with_http_headers $input, $cookie, $template->output; exit; } @@ -110,18 +109,14 @@ if ($query) { my $countbr = 0; my @resultsbr; if ($query) { -# fill isbn or title, depending on what has been entered -#u must do check on isbn because u can find number in beginning of title -#check is on isbn legnth 13 for new isbn and 10 for old isbn + # fill isbn or title, depending on what has been entered + #u must do check on isbn because u can find number in beginning of title my ( $title, $isbn ); - if ($query=~/\d/) { - my $clean_query = $query; - $clean_query =~ s/-//g; # remove hyphens - my $querylength = length $clean_query; - if ( $querylength == 13 || $querylength == 10 ) { - $isbn = $query; - } + if( $isbn = Business::ISBN->new( $query ) ) { + $isbn = $isbn->as_isbn10->as_string; + $isbn =~ s/-//g; } + if (!$isbn) { $title = $query; } --