View | Details | Raw Unified | Return to bug 17979
Collapse All | Expand All

(-)a/cataloguing/addbooks.pl (-12 / +6 lines)
Lines 85-91 if ($query) { Link Here
85
85
86
    if ( defined $error ) {
86
    if ( defined $error ) {
87
        $template->param( error => $error );
87
        $template->param( error => $error );
88
        warn "error: " . $error;
89
        output_html_with_http_headers $input, $cookie, $template->output;
88
        output_html_with_http_headers $input, $cookie, $template->output;
90
        exit;
89
        exit;
91
    }
90
    }
Lines 110-127 if ($query) { Link Here
110
my $countbr = 0;
109
my $countbr = 0;
111
my @resultsbr;
110
my @resultsbr;
112
if ($query) {
111
if ($query) {
113
# fill isbn or title, depending on what has been entered
112
    # fill isbn or title, depending on what has been entered
114
#u must do check on isbn because u can find number in beginning of title
113
    #u must do check on isbn because u can find number in beginning of title
115
#check is on isbn legnth 13 for new isbn and 10 for old isbn
116
    my ( $title, $isbn );
114
    my ( $title, $isbn );
117
    if ($query=~/\d/) {
115
    if( $isbn = Business::ISBN->new( $query ) ) {
118
        my $clean_query = $query;
116
        $isbn = $isbn->as_isbn10->as_string;
119
        $clean_query =~ s/-//g; # remove hyphens
117
        $isbn =~ s/-//g;
120
        my $querylength = length $clean_query;
121
        if ( $querylength == 13 || $querylength == 10 ) {
122
            $isbn = $query;
123
        }
124
    }
118
    }
119
125
    if (!$isbn) {
120
    if (!$isbn) {
126
        $title = $query;
121
        $title = $query;
127
    }
122
    }
128
- 

Return to bug 17979