[Koha-patches] [PATCH] [followup] (bug #2829) allow isbn13 in sql requests

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Wed Jun 17 15:46:45 CEST 2009


this patch add the support of the plugin to search for isbn13.
---
 cataloguing/value_builder/unimarc_field_010.pl |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/cataloguing/value_builder/unimarc_field_010.pl b/cataloguing/value_builder/unimarc_field_010.pl
index 11a4ba5..9acfceb 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 )
-- 
1.6.0.4




More information about the Koha-patches mailing list