From 19986c34ef647f0858f3f234305bd5937be3db2c Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Mon, 6 May 2019 21:01:26 +0000 Subject: [PATCH] Bug 21280: (follow-up) Refactor build_tabs to return array for better transparency Signed-off-by: Josef Moravec --- Koha/MarcEditor.pm | 10 +++++----- authorities/authorities.pl | 4 ++-- cataloguing/addbiblio.pl | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Koha/MarcEditor.pm b/Koha/MarcEditor.pm index b7c94c0..67fcaf7 100644 --- a/Koha/MarcEditor.pm +++ b/Koha/MarcEditor.pm @@ -71,14 +71,14 @@ sub new { =head3 build_tabs - $editor->build_tabs($template, $record, $encoding); + my @tabs = $editor->build_tabs($record, $encoding); -Builds tab data in the template +Builds tab data for the template =cut sub build_tabs { - my ( $self, $template, $record, $encoding ) = @_; + my ( $self, $record, $encoding ) = @_; # fill arrays my @loop_data = (); @@ -90,7 +90,7 @@ sub build_tabs { my %seen; my @tab_data; # all tags to display my $max_num_tab=-1; - my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" ); + my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" ); if (defined $self->{used_tags}) { foreach my $used ( @{$self->{used_tags}} ) { @@ -287,7 +287,7 @@ sub build_tabs { }; } } - $template->param( BIG_LOOP => \@BIG_LOOP ); + return \@BIG_LOOP; } =head2 Internal methods diff --git a/authorities/authorities.pl b/authorities/authorities.pl index cec9d94..49fd2ae 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -176,7 +176,7 @@ if ($op eq "add") { exit; } else { # it may be a duplicate, warn the user and do nothing - $editor->build_tabs($template, $record, $encoding); + $template->param( BIG_LOOP => $editor->build_tabs($record, $encoding) ); $template->param(authid =>$authid, duplicateauthid => $duplicateauthid, duplicateauthvalue => $duplicateauthvalue->{'authorized'}->[0]->{'heading'}, @@ -196,7 +196,7 @@ if ($op eq "duplicate") { $authid = ""; } - $editor->build_tabs ($template, $record, $encoding); + $template->param( BIG_LOOP => $editor->build_tabs($record, $encoding) ); $template->param(oldauthtypetagfield=>$oldauthtypetagfield, oldauthtypetagsubfield=>$oldauthtypetagsubfield, oldauthnumtagfield=>$oldauthnumtagfield, oldauthnumtagsubfield=>$oldauthnumtagsubfield, authid => $authid , authtypecode=>$authtypecode, ); diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 9181952..53ad86c 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -408,7 +408,7 @@ if ( $op eq "addbiblio" ) { } } else { # it may be a duplicate, warn the user and do nothing - $editor->build_tabs($template, $record, $encoding); + $template->param( BIG_LOOP => $editor->build_tabs($record, $encoding) ); $template->param( biblionumber => $biblionumber, biblioitemnumber => $biblioitemnumber, @@ -455,7 +455,7 @@ elsif ( $op eq "delete" ) { $record = $urecord; }; } - $editor->build_tabs( $template, $record, $encoding ); + $template->param( BIG_LOOP => $editor->build_tabs( $record, $encoding ) ); $template->param( biblionumber => $biblionumber, biblionumbertagfield => $biblionumbertagfield, -- 2.1.4