From 2717dea949526bc9caecb2f7a87d3f3fd146a97a 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 Content-Type: text/plain; charset=utf-8 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. --- 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 +++++++++++--------- .../value_builder/marc21_field_008_authorities.pl | 34 +++++++++++--------- cataloguing/value_builder/marc21_field_040c.pl | 19 ++++++----- cataloguing/value_builder/marc21_field_040d.pl | 19 ++++++----- cataloguing/value_builder/marc21_field_245h.pl | 21 ++++++------ cataloguing/value_builder/marc21_leader.pl | 34 +++++++++++--------- .../value_builder/marc21_leader_authorities.pl | 34 +++++++++++--------- cataloguing/value_builder/marc21_leader_book.pl | 30 +++++++++-------- .../value_builder/marc21_leader_computerfile.pl | 30 +++++++++-------- cataloguing/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 4a3b516..9844863 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 ad8d64d..4771bbd 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 0268a33..8eb6e70 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 65f7d09..4c7bcde 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 2c330fc..5d17ac7 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; @@ -36,30 +37,30 @@ sub date_entered { return substr($year, 2, 2) . sprintf("%0.2d", $mon) . sprintf("%0.2d", $mday); } -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); @@ -170,4 +172,6 @@ sub plugin { material_configuration => $material_configuration, ); 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_authorities.pl b/cataloguing/value_builder/marc21_field_008_authorities.pl index 940b0ed..91758d2 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; @@ -37,9 +38,9 @@ sub date_entered { return substr($year,2,2).sprintf ("%0.2d", $mon).sprintf ("%0.2d",$mday); } -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 = Field008(); my $res=" @@ -47,32 +48,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')||''; @@ -108,7 +110,7 @@ sub plugin { ); } output_html_with_http_headers $input, $cookie, $template->output; -} +}; sub Field008 { my $pref= C4::Context->preference(PREF_008); @@ -121,3 +123,5 @@ sub Field008 { } return substr($pref,0,34); #ignore remainder } + +return { builder => $builder, launcher => $launcher }; \ No newline at end of file diff --git a/cataloguing/value_builder/marc21_field_040c.pl b/cataloguing/value_builder/marc21_field_040c.pl index 35cc7b3..0ad692b 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 aad04b1..0ad692b 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 1912c4c..9317497 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 4b49ae0..a8252a2 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 15e31ff..c496ab9 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 45aeb70..a83ecdf 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 9dc90c7..0819762 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 7edc5f6..18da3e3 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 f53ed2a..54909ba 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 -- 1.7.10.4