From: Nahuel ANGELINETTI Date: Wed, 17 Jun 2009 13:46:45 +0000 (+0200) Subject: (bug #2829) allow isbn13 in sql requests X-Git-Tag: n_acq_a_porter~26^2~49 X-Git-Url: http://git.rot13.org/?p=koha.git;a=commitdiff_plain;h=0fc4a490d31a185dced97c5679021287e3b7fc73 (bug #2829) allow isbn13 in sql requests this patch add the support of the plugin to search for isbn13. Signed-off-by: Galen Charlton --- diff --git a/cataloguing/value_builder/unimarc_field_010.pl b/cataloguing/value_builder/unimarc_field_010.pl index 11a4ba5c6b..9acfceb978 100755 --- a/cataloguing/value_builder/unimarc_field_010.pl +++ b/cataloguing/value_builder/unimarc_field_010.pl @@ -89,7 +89,7 @@ sub plugin { my $dbh = C4::Context->dbh; my $len = 0; - my $sth = $dbh->prepare('SELECT publishercode FROM biblioitems WHERE isbn LIKE ? LIMIT 1'); + my $sth = $dbh->prepare('SELECT publishercode FROM biblioitems WHERE isbn LIKE ? OR isbn LIKE ? LIMIT 1'); if (length ($isbn) == 13){ $isbn = substr(3, length($isbn)); @@ -103,8 +103,9 @@ sub plugin { $len = 4 if ( substr( $isbn, 0, 4 ) <= 9989 ); my $x = substr( $isbn, $len ); - my $seg2; - + my $seg2 = ""; + my $seg3 = ""; + if ( substr( $x, 0, 2 ) <= 19 ) { $seg2 = substr( $x, 0, 2 ); } @@ -129,8 +130,8 @@ sub plugin { } $seg2 .= "%"; - warn $seg2; - $sth->execute($seg2); + $seg3 = "978" . $seg2; #support of ISBN13 + $sth->execute($seg2, $seg3); } if( (my $publishercode) = $sth->fetchrow )