From 0fc4a490d31a185dced97c5679021287e3b7fc73 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Wed, 17 Jun 2009 15:46:45 +0200 Subject: [PATCH] (bug #2829) allow isbn13 in sql requests this patch add the support of the plugin to search for isbn13. Signed-off-by: Galen Charlton --- cataloguing/value_builder/unimarc_field_010.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 ) -- 2.20.1