From 964fae60eebd4141ce49c3cff46881d3b2896e49 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 14 May 2015 10:20:15 +0200 Subject: [PATCH] Bug 13437: Conversion of marc21 cataloguing plugins to new style This patch converts marc21 plugins to new style by making the following modifications: [1] Replace use strict with use Modern::Perl. This implies that we now re-enabled warnings. There are no redefine warnings anymore, but note that we need to silence some warnings from individual plugins that were covered by disabling the warnings pragma until now. Silencing these individual warnings is outside the scope of this report. [2] Sub plugin_javascript is replaced by an anonymous subroutine $builder. [3] The parameters of $builder are combined in a params hashref. In most cases we only need $params->{id} for the function name. [4] Javascript function Clicxxx is renamed to Clickxxx. [5] The builder does no longer return function_name. [6] Sub plugin is replaced by subroutine $launcher. [7] The parameters of $launcher are combined in a params hashref. We only use $params->{cgi}. Mostly we save that to $input. One exception: $query. [8] The plugins returns a hash with $builder and/or $launcher. Test plan: [1] Run t/db_dependent/FrameworkPlugin.t -incl cataloguing/value_builder/ marc21*.pl. This should catch compile errors and general problems when building or launching these plugins. NOTE: You will see several initialize warnings from individual plugins that were hidden until now by disabling warnings. This is fine; we will be able to address these warnings now on new reports. [2] Check behavior of several plugins in the marc editor. Signed-off-by: Marcel de Rooy Checked all marc21 plugins. Attached unused plugins to some field. Some plugins (unused by default) may need some further attention, but also outside the scope of this report. Signed-off-by: Bernardo Gonzalez Kriegel New warnigs, but all seems to work. No errors. Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- cataloguing/value_builder/marc21_field_003.pl | 19 ++++++----- cataloguing/value_builder/marc21_field_005.pl | 19 ++++++----- cataloguing/value_builder/marc21_field_006.pl | 30 +++++++++------- cataloguing/value_builder/marc21_field_007.pl | 30 +++++++++------- cataloguing/value_builder/marc21_field_008.pl | 34 +++++++++++-------- .../marc21_field_008_authorities.pl | 34 +++++++++++-------- .../value_builder/marc21_field_040c.pl | 19 ++++++----- .../value_builder/marc21_field_040d.pl | 19 ++++++----- .../value_builder/marc21_field_245h.pl | 21 +++++++----- cataloguing/value_builder/marc21_leader.pl | 34 +++++++++++-------- .../marc21_leader_authorities.pl | 34 +++++++++++-------- .../value_builder/marc21_leader_book.pl | 30 +++++++++------- .../marc21_leader_computerfile.pl | 30 +++++++++------- .../value_builder/marc21_leader_video.pl | 28 ++++++++------- .../value_builder/marc21_linking_section.pl | 28 ++++++++------- 15 files changed, 232 insertions(+), 177 deletions(-) diff --git a/cataloguing/value_builder/marc21_field_003.pl b/cataloguing/value_builder/marc21_field_003.pl index 4a3b5164bc..9844863d9b 100755 --- a/cataloguing/value_builder/marc21_field_003.pl +++ b/cataloguing/value_builder/marc21_field_003.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # @@ -18,13 +20,12 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -#use warnings; FIXME - Bug 2505 +use Modern::Perl; use C4::Context; -sub plugin_javascript { - my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; - my $function_name= $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $org = C4::Context->preference('MARCOrgCode'); my $res = " @@ -32,12 +33,14 @@ sub plugin_javascript { //{id}\").value='$org'; return 0; } //]]> "; - return ($function_name,$res); -} + return $res; +}; + +return { builder => $builder }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_field_005.pl b/cataloguing/value_builder/marc21_field_005.pl index ad8d64d917..4771bbdb45 100755 --- a/cataloguing/value_builder/marc21_field_005.pl +++ b/cataloguing/value_builder/marc21_field_005.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,12 +19,11 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -#use warnings; FIXME - Bug 2505 +use Modern::Perl; -sub plugin_javascript { - my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; - my $function_name= $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; # find today's date my @a= (localtime) [5,4,3,2,1,0]; $a[0]+=1900; $a[1]++; @@ -33,12 +34,14 @@ sub plugin_javascript { //{id}\").value='$date'; return 0; } //]]> "; - return ($function_name,$res); -} + return $res; +}; + +return { builder => $builder }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_field_006.pl b/cataloguing/value_builder/marc21_field_006.pl index 0268a33f78..1a01cf033e 100755 --- a/cataloguing/value_builder/marc21_field_006.pl +++ b/cataloguing/value_builder/marc21_field_006.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,8 +19,7 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -#use warnings; FIXME - Bug 2505 +use Modern::Perl; use C4::Auth; use CGI qw ( -utf8 ); use C4::Context; @@ -28,27 +29,28 @@ use C4::Output; use XML::LibXML; -sub plugin_javascript { - my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_; - my $function_name = $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $res = " "; - return ($function_name, $res); -} + return $res; +}; -sub plugin { - my ($input) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; my $index = $input->param('index'); my $result = $input->param('result'); @@ -86,4 +88,6 @@ sub plugin { errorXml => $errorXml, ); output_html_with_http_headers $input, $cookie, $template->output; -} +}; + +return { builder => $builder, launcher => $launcher }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_field_007.pl b/cataloguing/value_builder/marc21_field_007.pl index 65f7d09d73..d8bf1ea67a 100755 --- a/cataloguing/value_builder/marc21_field_007.pl +++ b/cataloguing/value_builder/marc21_field_007.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,9 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; +use Modern::Perl; -#use warnings; FIXME - Bug 2505 use C4::Auth; use CGI qw ( -utf8 ); use C4::Context; @@ -27,27 +28,28 @@ use C4::Context; use C4::Search; use C4::Output; -sub plugin_javascript { - my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; - my $function_name = $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $res = " "; - return ( $function_name, $res ); -} + return $res; +}; -sub plugin { - my ($input) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; my $index = $input->param('index'); my $result = $input->param('result'); @@ -144,4 +146,6 @@ sub plugin { "f22$f22" => $f22, ); output_html_with_http_headers $input, $cookie, $template->output; -} +}; + +return { builder => $builder, launcher => $launcher }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_field_008.pl b/cataloguing/value_builder/marc21_field_008.pl index 9503fe090c..e93e5226b7 100755 --- a/cataloguing/value_builder/marc21_field_008.pl +++ b/cataloguing/value_builder/marc21_field_008.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,8 +19,7 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -#use warnings; FIXME - Bug 2505 +use Modern::Perl; use C4::Auth; use CGI qw ( -utf8 ); use C4::Context; @@ -29,30 +30,30 @@ use C4::Output; use XML::LibXML; use Koha::Util::FrameworkPlugin qw|date_entered|; -sub plugin_javascript { - my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_; +my $builder = sub { + my ( $params ) = @_; my $lang = C4::Context->preference('DefaultLanguageField008' ); $lang = "eng" unless $lang; $lang = pack("A3", $lang); - my $function_name = $field_number; + my $function_name = $params->{id}; my $dateentered = date_entered(); my $res = " "; - return ($function_name, $res); -} + return $res; +}; -sub plugin { - my ($input) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; my $lang = C4::Context->preference('DefaultLanguageField008' ); $lang = "eng" unless $lang; $lang = pack("A3", $lang); @@ -163,4 +165,6 @@ sub plugin { material_configuration => $material_configuration, ); output_html_with_http_headers $input, $cookie, $template->output; -} +}; + +return { builder => $builder, launcher => $launcher }; diff --git a/cataloguing/value_builder/marc21_field_008_authorities.pl b/cataloguing/value_builder/marc21_field_008_authorities.pl index 699ab65e32..5489a4381c 100755 --- a/cataloguing/value_builder/marc21_field_008_authorities.pl +++ b/cataloguing/value_builder/marc21_field_008_authorities.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,8 +19,7 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -#use warnings; FIXME - Bug 2505 +use Modern::Perl; use C4::Auth; use CGI qw ( -utf8 ); use C4::Context; @@ -30,9 +31,9 @@ use Koha::Util::FrameworkPlugin qw|date_entered|; use constant FIXLEN_DATA_ELTS => '|| aca||aabn | a|a d'; use constant PREF_008 => 'MARCAuthorityControlField008'; -sub plugin_javascript { - my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; - my $function_name= $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $dateentered = date_entered(); my $defaultval = substr( C4::Context->preference(PREF_008) || FIXLEN_DATA_ELTS, 0, 34 ); my $res=" @@ -40,32 +41,33 @@ sub plugin_javascript { //{id}\").value) { var authtype=document.forms['f'].elements['authtypecode'].value; var fieldval='$dateentered$defaultval'; if(authtype && (authtype == 'TOPIC_TERM' || authtype == 'GENRE/FORM' || authtype == 'CHRON_TERM')) { fieldval= fieldval.substr(0,14)+'b'+fieldval.substr(15); } - document.getElementById(\"$field_number\").value=fieldval; + document.getElementById(\"$params->{id}\").value=fieldval; } return 1; } -function Clic$function_name(i) { +function Click$function_name(i) { var authtype=document.forms['f'].elements['authtypecode'].value; - defaultvalue=document.getElementById(\"$field_number\").value; - newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_authorities.pl&index=$field_number&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); + defaultvalue=document.getElementById(\"$params->{id}\").value; + newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_authorities.pl&index=$params->{id}&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); } //]]> "; - return ($function_name,$res); -} + return $res; +}; -sub plugin { - my ($input) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; my $index= $input->param('index'); my $result= $input->param('result'); my $authtype= $input->param('authtypecode')||''; @@ -101,4 +103,6 @@ sub plugin { ); } output_html_with_http_headers $input, $cookie, $template->output; -} +}; + +return { builder => $builder, launcher => $launcher }; diff --git a/cataloguing/value_builder/marc21_field_040c.pl b/cataloguing/value_builder/marc21_field_040c.pl index 35cc7b370d..0ad692b8ab 100755 --- a/cataloguing/value_builder/marc21_field_040c.pl +++ b/cataloguing/value_builder/marc21_field_040c.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,13 +19,12 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -#use warnings; FIXME - Bug 2505 +use Modern::Perl; use C4::Context; -sub plugin_javascript { - my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; - my $function_name= $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $org = C4::Context->preference('MARCOrgCode'); my $res = " @@ -31,12 +32,14 @@ sub plugin_javascript { //{id}\").value='$org'; return 0; } //]]> "; - return ($function_name,$res); -} + return $res; +}; + +return { builder => $builder }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_field_040d.pl b/cataloguing/value_builder/marc21_field_040d.pl index aad04b111f..0ad692b8ab 100755 --- a/cataloguing/value_builder/marc21_field_040d.pl +++ b/cataloguing/value_builder/marc21_field_040d.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,13 +19,12 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -#use warnings; FIXME - Bug 2505 +use Modern::Perl; use C4::Context; -sub plugin_javascript { - my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; - my $function_name = $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $org = C4::Context->preference('MARCOrgCode'); my $res = " @@ -31,12 +32,14 @@ sub plugin_javascript { //{id}\").value='$org'; return 0; } //]]> "; - return ($function_name,$res); -} + return $res; +}; + +return { builder => $builder }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_field_245h.pl b/cataloguing/value_builder/marc21_field_245h.pl index 1912c4cc46..9317497944 100755 --- a/cataloguing/value_builder/marc21_field_245h.pl +++ b/cataloguing/value_builder/marc21_field_245h.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2009 Kyle Hall # # This file is part of Koha. @@ -17,25 +19,24 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -#use warnings; FIXME - Bug 2505 +use Modern::Perl; use C4::Context; -sub plugin_javascript { - my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; - my $function_name = $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $res = " "; - return ($function_name,$res); -} + return $res; +}; + +return { builder => $builder }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_leader.pl b/cataloguing/value_builder/marc21_leader.pl index 4b49ae0e4e..28f7dce74d 100755 --- a/cataloguing/value_builder/marc21_leader.pl +++ b/cataloguing/value_builder/marc21_leader.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,9 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; +use Modern::Perl; -#use warnings; FIXME - Bug 2505 use C4::Auth; use CGI qw ( -utf8 ); use C4::Context; @@ -27,34 +28,35 @@ use C4::Context; use C4::Search; use C4::Output; -sub plugin_javascript { - my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; - my $function_name = $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $res = " "; - return ( $function_name, $res ); -} + return $res; +}; -sub plugin { - my ($input) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; my $index = $input->param('index'); my $result = $input->param('result'); @@ -90,4 +92,6 @@ sub plugin { "f2023" => $f2023, ); output_html_with_http_headers $input, $cookie, $template->output; -} +}; + +return { builder => $builder, launcher => $launcher }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_leader_authorities.pl b/cataloguing/value_builder/marc21_leader_authorities.pl index 15e31ff3e7..527b12f6b2 100755 --- a/cataloguing/value_builder/marc21_leader_authorities.pl +++ b/cataloguing/value_builder/marc21_leader_authorities.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,9 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; +use Modern::Perl; -#use warnings; FIXME - Bug 2505 use C4::Auth; use CGI qw ( -utf8 ); use C4::Context; @@ -27,34 +28,35 @@ use C4::Context; use C4::Search; use C4::Output; -sub plugin_javascript { - my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; - my $function_name = $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $res = " "; - return ( $function_name, $res ); -} + return $res; +}; -sub plugin { - my ($input) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; my $index = $input->param('index'); my $result = $input->param('result'); @@ -88,4 +90,6 @@ sub plugin { "f2023" => $f2023, ); output_html_with_http_headers $input, $cookie, $template->output; -} +}; + +return { builder => $builder, launcher => $launcher }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_leader_book.pl b/cataloguing/value_builder/marc21_leader_book.pl index 45aeb70c86..646b32d488 100755 --- a/cataloguing/value_builder/marc21_leader_book.pl +++ b/cataloguing/value_builder/marc21_leader_book.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,9 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; +use Modern::Perl; -#use warnings; FIXME - Bug 2505 use C4::Auth; use CGI qw ( -utf8 ); use C4::Context; @@ -27,27 +28,28 @@ use C4::Context; use C4::Search; use C4::Output; -sub plugin_javascript { - my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; - my $function_name = $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $res = " "; - return ( $function_name, $res ); -} + return $res; +}; -sub plugin { - my ($input) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; my $index = $input->param('index'); my $result = $input->param('result'); @@ -84,4 +86,6 @@ sub plugin { "f19$f19" => 1, ); output_html_with_http_headers $input, $cookie, $template->output; -} +}; + +return { builder => $builder, launcher => $launcher }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_leader_computerfile.pl b/cataloguing/value_builder/marc21_leader_computerfile.pl index 9dc90c79eb..d47cf3623e 100755 --- a/cataloguing/value_builder/marc21_leader_computerfile.pl +++ b/cataloguing/value_builder/marc21_leader_computerfile.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,9 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; +use Modern::Perl; -#use warnings; FIXME - Bug 2505 use C4::Auth; use CGI qw ( -utf8 ); use C4::Context; @@ -27,27 +28,28 @@ use C4::Context; use C4::Search; use C4::Output; -sub plugin_javascript { - my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; - my $function_name = $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $res = " "; - return ( $function_name, $res ); -} + return $res; +}; -sub plugin { - my ($input) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; my $index = $input->param('index'); my $result = $input->param('result'); @@ -84,4 +86,6 @@ sub plugin { "f19$f19" => 1, ); output_html_with_http_headers $input, $cookie, $template->output; -} +}; + +return { builder => $builder, launcher => $launcher }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_leader_video.pl b/cataloguing/value_builder/marc21_leader_video.pl index 7edc5f645e..a52a0c6b71 100755 --- a/cataloguing/value_builder/marc21_leader_video.pl +++ b/cataloguing/value_builder/marc21_leader_video.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright 2000-2002 Katipo Communications # # This file is part of Koha. @@ -17,9 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; +use Modern::Perl; -#use warnings; FIXME - Bug 2505 use C4::Auth; use CGI qw ( -utf8 ); use C4::Context; @@ -27,15 +28,15 @@ use C4::Context; use C4::Search; use C4::Output; -sub plugin_javascript { - my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; - my $function_name = $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $res = " "; - return ( $function_name, $res ); -} + return $res; +}; -sub plugin { - my ($input) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; my $index = $input->param('index'); my $result = $input->param('result'); @@ -84,4 +86,6 @@ sub plugin { "f19$f19" => 1, ); output_html_with_http_headers $input, $cookie, $template->output; -} +}; + +return { builder => $builder, launcher => $launcher }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_linking_section.pl b/cataloguing/value_builder/marc21_linking_section.pl index f53ed2a9b8..54909babb3 100644 --- a/cataloguing/value_builder/marc21_linking_section.pl +++ b/cataloguing/value_builder/marc21_linking_section.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Converted to new plugin style (Bug 13437) + # Copyright Biblibre 2007 - CILEA 2011 # # This file is part of Koha. @@ -17,8 +19,7 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use CGI qw ( -utf8 ); use C4::Output; @@ -33,24 +34,25 @@ use MARC::Record; use C4::Branch; use C4::ItemType; -sub plugin_javascript { - my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; - my $function_name = $field_number; +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; my $res = " "; - return ( $function_name, $res ); -} + return $res; +}; -sub plugin { - my ($query) = @_; +my $launcher = sub { + my ( $params ) = @_; + my $query = $params->{cgi}; my $dbh = C4::Context->dbh; my $op = $query->param('op'); # -- op could be equal to @@ -311,4 +313,6 @@ sub plugin { ); } output_html_with_http_headers $query, $cookie, $template->output; -} +}; + +return { builder => $builder, launcher => $launcher }; \ No newline at end of file -- 2.39.5