Bug 14793: New cataloguing plugin unimarc_field_225a_bis
[koha.git] / cataloguing / value_builder / cn_browser.pl
index 17dfd83..9599666 100755 (executable)
@@ -6,11 +6,6 @@ use C4::Auth;
 use C4::ClassSource;
 use C4::Output;
 
-sub plugin_parameters {
-    my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_;
-    return "";
-}
-
 sub plugin_javascript {
     my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
     my $function_name = "328" . ( int( rand(100000) ) + 1 );
@@ -18,18 +13,9 @@ sub plugin_javascript {
 <script type=\"text/javascript\">
 //<![CDATA[
 
-function Focus$function_name(subfield_managed) {
-return 1;
-}
-
-function Blur$function_name(subfield_managed) {
-    return 1;
-}
-
 function Clic$function_name(i) {
     q = document.getElementById('$field_number');
     window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=cn_browser.pl&popup&q=\"+q.value,\"cnbrowser\",\"width=500,height=400,toolbar=false,scrollbars=yes\");
-
 }
 
 //]]>
@@ -51,7 +37,7 @@ sub plugin {
             query           => $cgi,
             type            => "intranet",
             authnotrequired => 0,
-            flagsrequired   => { tools => 'cn_browser', catalogue => 1 },
+            flagsrequired   => { catalogue => 1 },
         }
     );
 
@@ -96,12 +82,12 @@ sub plugin {
         FROM items AS i
         JOIN biblio AS b USING (biblionumber)
         LEFT OUTER JOIN branches ON (branches.branchcode = homebranch)
-        WHERE cn_sort < '$cn_sort'
+        WHERE cn_sort < ?
         AND itemcallnumber != ''
         ORDER BY cn_sort DESC, itemnumber
         LIMIT $real_limit;";
         $sth = $dbh->prepare($query);
-        $sth->execute();
+        $sth->execute($cn_sort);
         while ( my $data = $sth->fetchrow_hashref ) {
             if ( $data->{itemcallnumber} eq $q ) {
                 $data->{background} = 'red';
@@ -116,7 +102,6 @@ sub plugin {
             unshift @cn, $data;
         }
         $rows_lt = $sth->rows;
-        $sth->finish;
     }
 
     if ( $search ne $lt ) {