https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17979

            Bug ID: 17979
           Summary: Fatal error when searching from addbooks.pl due to
                    ISBN flaw
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P5 - low
         Component: Searching
          Assignee: gmcha...@gmail.com
          Reporter: dc...@prosentient.com.au
        QA Contact: testo...@bugs.koha-community.org

If you're doing a "Cataloging Search" from
/cgi-bin/koha/cataloguing/addbooks.pl, and you type in "1st to die", you'll see
the following:

DBD::mysql::st execute failed: You have an error in your SQL syntax; check the
manual that corresponds to your MariaDB server version for the right syntax to
use near '' at line 5 at /<koha>/lib/C4/Breeding.pm line 107

The reason is that the string is 10 characters long and contains a digit, so
Koha thinks it's an ISBN. But when it tries to normalize it, it fails, and
instead Koha generates no data for the WHERE clause and then the SQL statement
fails because it contains a WHERE without the actual clause.


The code:

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
    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) {
        $title = $query;
    }
    ( $countbr, @resultsbr ) = BreedingSearch( $title, $isbn );
}

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to