Bug 13969: Replace calls to $sth->fetchrow* with a call to $dbh->selectrow* and Clean...
[koha.git] / cataloguing / value_builder / marc21_linking_section.pl
index 514394f..8407ace 100644 (file)
@@ -4,23 +4,23 @@
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use strict;
 use warnings;
 
-use CGI;
+use CGI qw ( -utf8 );
 use C4::Output;
 use C4::Context;
 use C4::Search;
@@ -33,24 +33,11 @@ use MARC::Record;
 use C4::Branch;
 use C4::ItemType;
 
-sub plugin_parameters {
- my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_;
-     return "";
-}
-
 sub plugin_javascript {
   my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
   my $function_name = $field_number;
      my $res           = "
   <script type='text/javascript'>
-                function Focus$function_name(subfield_managed) {
-                       return 1;
-              }
-
-             function Blur$function_name(subfield_managed) {
-                        return 1;
-              }
-
              function Clic$function_name(i) {
                        defaultvalue=document.getElementById(\"$field_number\").value;
                  window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&index=\" + i + \"&result=\"+defaultvalue,\"marc21_field_7\"+i+\"\",'width=900,height=700,toolbar=false,scrollbars=yes');
@@ -335,64 +322,13 @@ sub plugin {
                   }
               );
 
-            my $sth = $dbh->prepare(
-                       "Select itemtype,description from itemtypes order by description");
-            $sth->execute;
-         my @itemtype;
-          my %itemtypes;
-         push @itemtype, "";
-            $itemtypes{''} = "";
-           while ( my ( $value, $lib ) = $sth->fetchrow_array ) {
-                 push @itemtype, $value;
-                        $itemtypes{$value} = $lib;
-             }
+            my @itemtypes = C4::ItemType->all;
 
-             my $CGIitemtype = CGI::scrolling_list(
-                 -name     => 'value',
-                  -values   => \@itemtype,
-                       -labels   => \%itemtypes,
-                      -size     => 1,
-                        -multiple => 0
-         );
-             $sth->finish;
-
-         # To show list of branches please use GetBranchesLoop() and modify template
-
-         my $req = $dbh->prepare(
-"select distinctrow left(publishercode,45) from biblioitems order by publishercode"
-           );
-             $req->execute;
-         my @select;
-            push @select, "";
-              while ( my ($value) = $req->fetchrow ) {
-                       push @select, $value;
-          }
-              my $CGIpublisher = CGI::scrolling_list(
-                        -name     => 'value',
-                  -id       => 'publisher',
-                      -values   => \@select,
-                 -size     => 1,
-                        -multiple => 0
-         );
-
-#         my $sth=$dbh->prepare("select description,itemtype from itemtypes order by description");
-#         $sth->execute;
-#         while (my ($description,$itemtype) = $sth->fetchrow) {
-#             $classlist.="<option value=\"$itemtype\">$description</option>\n";
-#         }
-#         $sth->finish;
-
-                my @itemtypes = C4::ItemType->all;
-
-            $template->param(    #classlist => $classlist,
-                 CGIitemtype  => $CGIitemtype,
-                    CGIPublisher => $CGIpublisher,
-                 itypeloop    => \@itemtypes,
-                   index        => $query->param('index'),
+            $template->param(
+                        itypeloop    => \@itemtypes,
+                        index        => $query->param('index'),
                         Search       => 1,
-             );
+            );
      }
       output_html_with_http_headers $query, $cookie, $template->output;
 }
-
-1;