From c66668b16cd8949e46f88a104870298ba013ed82 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 20 Jul 2021 10:30:30 +0200 Subject: [PATCH] Bug 28769: Remove tabloop from cataloguing plugins There is a "tabloop" variable that is passed from the add item form logic to the cataloguing plugins. But there is confusion, sometimes it's an iterator ($i) and sometimes (batchMod.pl) an array. Actually this tabloop variable is never used from cataloguing plugins, we should remove it. Test plan: Read the code and confirm the above. You can also test a couple of plugins and confirm that they are still working. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- C4/Items.pm | 2 +- Koha/FrameworkPlugin.pm | 4 ++-- authorities/authorities.pl | 14 +++++++------- cataloguing/addbiblio.pl | 12 ++++++------ cataloguing/additem.pl | 6 +++--- cataloguing/value_builder/unimarc_field_010.pl | 2 +- cataloguing/value_builder/unimarc_field_100.pl | 2 +- .../value_builder/unimarc_field_100_authorities.pl | 2 +- cataloguing/value_builder/unimarc_field_105.pl | 2 +- cataloguing/value_builder/unimarc_field_106.pl | 2 +- cataloguing/value_builder/unimarc_field_110.pl | 2 +- cataloguing/value_builder/unimarc_field_115a.pl | 2 +- cataloguing/value_builder/unimarc_field_115b.pl | 2 +- cataloguing/value_builder/unimarc_field_116.pl | 2 +- cataloguing/value_builder/unimarc_field_117.pl | 2 +- cataloguing/value_builder/unimarc_field_120.pl | 2 +- cataloguing/value_builder/unimarc_field_121a.pl | 2 +- cataloguing/value_builder/unimarc_field_121b.pl | 2 +- cataloguing/value_builder/unimarc_field_122.pl | 2 +- cataloguing/value_builder/unimarc_field_123a.pl | 2 +- cataloguing/value_builder/unimarc_field_123d.pl | 2 +- cataloguing/value_builder/unimarc_field_123e.pl | 2 +- cataloguing/value_builder/unimarc_field_123f.pl | 2 +- cataloguing/value_builder/unimarc_field_123g.pl | 2 +- cataloguing/value_builder/unimarc_field_123i.pl | 2 +- cataloguing/value_builder/unimarc_field_123j.pl | 2 +- cataloguing/value_builder/unimarc_field_124.pl | 2 +- cataloguing/value_builder/unimarc_field_124a.pl | 2 +- cataloguing/value_builder/unimarc_field_124b.pl | 2 +- cataloguing/value_builder/unimarc_field_124c.pl | 2 +- cataloguing/value_builder/unimarc_field_124d.pl | 2 +- cataloguing/value_builder/unimarc_field_124e.pl | 2 +- cataloguing/value_builder/unimarc_field_124f.pl | 2 +- cataloguing/value_builder/unimarc_field_124g.pl | 2 +- cataloguing/value_builder/unimarc_field_125.pl | 2 +- cataloguing/value_builder/unimarc_field_125a.pl | 2 +- cataloguing/value_builder/unimarc_field_125b.pl | 2 +- cataloguing/value_builder/unimarc_field_126.pl | 2 +- cataloguing/value_builder/unimarc_field_126a.pl | 2 +- cataloguing/value_builder/unimarc_field_126b.pl | 2 +- cataloguing/value_builder/unimarc_field_127.pl | 2 +- cataloguing/value_builder/unimarc_field_128a.pl | 2 +- cataloguing/value_builder/unimarc_field_128b.pl | 2 +- cataloguing/value_builder/unimarc_field_128c.pl | 2 +- cataloguing/value_builder/unimarc_field_130.pl | 2 +- cataloguing/value_builder/unimarc_field_135a.pl | 2 +- cataloguing/value_builder/unimarc_field_140.pl | 2 +- cataloguing/value_builder/unimarc_field_141.pl | 2 +- cataloguing/value_builder/unimarc_field_210c.pl | 2 +- .../value_builder/unimarc_field_210c_bis.pl | 2 +- cataloguing/value_builder/unimarc_field_225a.pl | 2 +- .../value_builder/unimarc_field_225a_bis.pl | 2 +- cataloguing/value_builder/unimarc_field_4XX.pl | 4 ++-- cataloguing/value_builder/unimarc_field_686a.pl | 2 +- cataloguing/value_builder/unimarc_field_700-4.pl | 2 +- cataloguing/value_builder/unimarc_leader.pl | 2 +- t/db_dependent/FrameworkPlugin.t | 2 +- tools/batchMod.pl | 2 +- 58 files changed, 73 insertions(+), 73 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 1fa72d21c2..13c7f579f4 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1757,7 +1757,7 @@ sub PrepareItemrecordDisplay { name => $subfield->{value_builder}, item_style => 1, }); - my $pars = { dbh => $dbh, record => undef, tagslib =>$tagslib, id => $subfield_data{id}, tabloop => undef }; + my $pars = { dbh => $dbh, record => undef, tagslib =>$tagslib, id => $subfield_data{id} }; $plugin->build( $pars ); if ( $itemrecord and my $field = $itemrecord->field($tag) ) { $defaultvalue = $field->subfield($subfield->{subfield}) || q{}; diff --git a/Koha/FrameworkPlugin.pm b/Koha/FrameworkPlugin.pm index a50328a1f6..2331bfa6b3 100644 --- a/Koha/FrameworkPlugin.pm +++ b/Koha/FrameworkPlugin.pm @@ -155,7 +155,7 @@ sub new { Generate html and javascript by calling the builder sub of the plugin. Params is a hashref supporting keys: id (=html id for the input field), - record (MARC record or undef), dbh (database handle), tagslib, tabloop. + record (MARC record or undef), dbh (database handle), tagslib. Note that some of these parameters are not used in most (if not all) plugins and may be obsoleted in the future (kept for now to provide backward compatibility). @@ -276,7 +276,7 @@ sub _generate_js { my @params = $self->{oldschool}//0 ? ( $params->{dbh}, $params->{record}, $params->{tagslib}, - $params->{id}, $params->{tabloop} ): + $params->{id} ): ( $params ); my @rv = &$sub( @params ); return $self->_error( 'Builder sub failed: ' . $@ ) if $@; diff --git a/authorities/authorities.pl b/authorities/authorities.pl index 229dc27660..fc4ae1a200 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -133,8 +133,8 @@ builds the entry for a subfield. =cut sub create_input { - my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi ) = @_; - + my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth,$cgi ) = @_; + my $index_subfield = CreateKey(); # create a specifique key for each subfield # determine maximum length; 9999 bytes per ISO 2709 except for leader and MARC21 008 @@ -213,7 +213,7 @@ sub create_input { name => $tagslib->{$tag}->{$subfield}->{'value_builder'}, }); my $pars= { dbh => $dbh, record => $rec, tagslib =>$tagslib, - id => $subfield_data{id}, tabloop => $tabloop }; + id => $subfield_data{id} }; $plugin->build( $pars ); if( !$plugin->errstr ) { $subfield_data{marc_value} = { @@ -410,7 +410,7 @@ sub build_tabs { push( @subfields_data, &create_input( - $tag, $subfield, $value, $index_tag, $tabloop, $record, + $tag, $subfield, $value, $index_tag, $record, $authorised_values_sth,$input ) ); @@ -426,7 +426,7 @@ sub build_tabs { push( @subfields_data, &create_input( - $tag, $subfield, $value, $index_tag, $tabloop, + $tag, $subfield, $value, $index_tag, $record, $authorised_values_sth,$input ) ); @@ -444,7 +444,7 @@ sub build_tabs { push( @subfields_data, &create_input( - $tag, $subfield, '', $index_tag, $tabloop, $record, + $tag, $subfield, '', $index_tag, $record, $authorised_values_sth,$input ) ); @@ -486,7 +486,7 @@ sub build_tabs { push( @subfields_data, &create_input( - $tag, $subfield->{subfield}, '', $index_tag, $tabloop, $record, + $tag, $subfield->{subfield}, '', $index_tag, $record, $authorised_values_sth,$input ) ); diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index f1a13bed7b..903b30b26f 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -283,7 +283,7 @@ sub GetMandatoryFieldZ3950 { =cut sub create_input { - my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi ) = @_; + my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth,$cgi ) = @_; my $index_subfield = CreateKey(); # create a specifique key for each subfield @@ -394,7 +394,7 @@ sub create_input { name => $tagslib->{$tag}->{$subfield}->{'value_builder'}, }); my $pars= { dbh => $dbh, record => $rec, tagslib => $tagslib, - id => $subfield_data{id}, tabloop => $tabloop }; + id => $subfield_data{id} }; $plugin->build( $pars ); if( !$plugin->errstr ) { $subfield_data{marc_value} = { @@ -567,7 +567,7 @@ sub build_tabs { push( @subfields_data, &create_input( - $tag, $subfield, $value, $index_tag, $tabloop, $record, + $tag, $subfield, $value, $index_tag, $record, $authorised_values_sth,$input ) ); @@ -582,7 +582,7 @@ sub build_tabs { push( @subfields_data, &create_input( - $tag, $subfield, $value, $index_tag, $tabloop, + $tag, $subfield, $value, $index_tag, $record, $authorised_values_sth,$input ) ); @@ -612,7 +612,7 @@ sub build_tabs { push( @subfields_data, &create_input( - $tag, $subfield, '', $index_tag, $tabloop, $record, + $tag, $subfield, '', $index_tag, $record, $authorised_values_sth,$input ) ); @@ -668,7 +668,7 @@ sub build_tabs { push( @subfields_data, &create_input( - $tag, $subfield->{subfield}, '', $index_tag, $tabloop, $record, + $tag, $subfield->{subfield}, '', $index_tag, $record, $authorised_values_sth,$input ) ); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 2dd4ad0a84..bdccd48ad1 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -59,7 +59,7 @@ use List::MoreUtils qw( any uniq ); our $dbh = C4::Context->dbh; sub generate_subfield_form { - my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $subfields, $i, $restrictededition, $item) = @_; + my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $biblionumber, $temp, $i, $restrictededition, $item) = @_; my $frameworkcode = &GetFrameworkCode($biblionumber); @@ -241,7 +241,7 @@ sub generate_subfield_form { item_style => 1, }); my $pars= { dbh => $dbh, record => $temp, tagslib =>$tagslib, - id => $subfield_data{id}, tabloop => $subfields }; + id => $subfield_data{id} }; $plugin->build( $pars ); if( !$plugin->errstr ) { my $class= 'buttonDot'. ( $plugin->noclick? ' disabled': '' ); @@ -889,7 +889,7 @@ foreach my $tag ( keys %{$tagslib} ) { $value, $tagslib, $subfield, $libraries, $biblionumber, $temp, - \@subfields, $i, + $i, $restrictededition, $current_item, ); push @subfields, $subfield_data; diff --git a/cataloguing/value_builder/unimarc_field_010.pl b/cataloguing/value_builder/unimarc_field_010.pl index 56a5c5c3ce..00f5eb05b1 100755 --- a/cataloguing/value_builder/unimarc_field_010.pl +++ b/cataloguing/value_builder/unimarc_field_010.pl @@ -26,7 +26,7 @@ use C4::Output qw( output_html_with_http_headers ); sub plugin_javascript { - my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; + my ($dbh,$record,$tagslib,$field_number) = @_; my $res="