From e706ef3bb01ff25d53a44b75980b46739f77c7ae Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 31 Mar 2022 14:23:23 +0000 Subject: [PATCH] Bug 2222: Modify C4::AuthoritiesMarc::GetTagsLabels and callers Content-Type: text/plain; charset=utf-8 We adjust two callers here to rename the parameter from framework to authtypecode in order to prevent confusion. --- C4/AuthoritiesMarc.pm | 4 +-- authorities/merge.pl | 28 +++++++++---------- .../prog/en/modules/authorities/merge.tt | 26 ++++++++--------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 36cbf5c43b..43bac0f482 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -478,7 +478,7 @@ sub GetTagsLabels { $res->{$tag}->{repeatable} = $repeatable; } $sth= $dbh->prepare( -"SELECT tagfield,tagsubfield,liblibrarian,libopac,tab, mandatory, repeatable,authorised_value,frameworkcode as authtypecode,value_builder,kohafield,seealso,hidden,isurl,defaultvalue, display_order +"SELECT tagfield,tagsubfield,liblibrarian,libopac,tab, mandatory, repeatable,authorised_value,value_builder,kohafield,seealso,hidden,isurl,defaultvalue, display_order FROM auth_subfield_structure WHERE authtypecode=? ORDER BY tagfield, display_order, tagsubfield" @@ -497,7 +497,7 @@ ORDER BY tagfield, display_order, tagsubfield" while ( ( $tag, $subfield, $liblibrarian, , $libopac, $tab, - $mandatory, $repeatable, $authorised_value, $authtypecode, + $mandatory, $repeatable, $authorised_value, $value_builder, $kohafield, $seealso, $hidden, $isurl, $defaultvalue, $display_order ) = $sth->fetchrow diff --git a/authorities/merge.pl b/authorities/merge.pl index 0799c26b04..391fd5d1ba 100755 --- a/authorities/merge.pl +++ b/authorities/merge.pl @@ -31,6 +31,7 @@ use Koha::MetadataRecord::Authority; my $input = CGI->new; my @authid = $input->multi_param('authid'); my $merge = $input->param('merge'); +my $authtypecode = $input->param('authtypecode'); my @errors; @@ -52,12 +53,11 @@ if ($merge) { my $record = TransformHtmlToMarc($input, 0); my $recordid1 = $input->param('recordid1') // q{}; my $recordid2 = $input->param('recordid2') // q{}; - my $typecode = $input->param('frameworkcode'); # Some error checking if( $recordid1 eq $recordid2 ) { push @errors, { code => 'DESTRUCTIVE_MERGE' }; - } elsif( !$typecode || !Koha::Authority::Types->find($typecode) ) { + } elsif( !$authtypecode || !Koha::Authority::Types->find($authtypecode) ) { push @errors, { code => 'WRONG_FRAMEWORK' }; } elsif( scalar $record->fields == 0 ) { push @errors, { code => 'EMPTY_MARC' }; @@ -75,7 +75,7 @@ if ($merge) { # Modifying the reference record # This triggers a merge for the biblios attached to $recordid1 - ModAuthority( $recordid1, $record, $typecode ); + ModAuthority( $recordid1, $record, $authtypecode ); # Now merge for biblios attached to $recordid2 my $MARCfrom = GetAuthority( $recordid2 ); @@ -129,19 +129,17 @@ else { if ($mergereference ) { - my $framework; if ( $recordObj1->authtypecode ne $recordObj2->authtypecode && $mergereference ne 'breeding' ) { - $framework = $input->param('frameworkcode'); } - else { - $framework = $recordObj1->authtypecode; + else { # overwrite authtypecode parameter + $authtypecode = $recordObj1->authtypecode; } if ($mergereference eq 'breeding') { $mergereference = $authid[0]; } # Getting MARC Structure - my $tagslib = GetTagsLabels( 1, $framework ); + my $tagslib = GetTagsLabels( 1, $authtypecode ); foreach my $field ( keys %$tagslib ) { if ( defined $tagslib->{$field}->{'tab'} && $tagslib->{$field}->{'tab'} eq ' ' ) { $tagslib->{$field}->{'tab'} = 0; @@ -162,14 +160,14 @@ else { { recordid => $mergereference, record => $recordObj1->record, - frameworkcode => $recordObj1->authtypecode, + authtypecode => $recordObj1->authtypecode, display => $recordObj1->createMergeHash($tagslib), reference => 1, }, { recordid => $notreference, record => $recordObj2->record, - frameworkcode => $recordObj2->authtypecode, + authtypecode => $recordObj2->authtypecode, display => $recordObj2->createMergeHash($tagslib), }, ); @@ -178,8 +176,8 @@ else { $template->param( recordid1 => $mergereference, recordid2 => $notreference, - records => \@records, - framework => $framework, + records => \@records, + authtypecode => $authtypecode, ); } else { @@ -195,9 +193,9 @@ else { if ( $recordObj1->authtypecode ne $recordObj2->authtypecode ) { my $authority_types = Koha::Authority::Types->search( { authtypecode => { '!=' => '' } }, { order_by => ['authtypetext'] } ); $template->param( - frameworkselect => $authority_types->unblessed, - frameworkcode1 => $recordObj1->authtypecode, - frameworkcode2 => $recordObj2->authtypecode, + authority_types => $authority_types->unblessed, + authtypecode1 => $recordObj1->authtypecode, + authtypecode2 => $recordObj2->authtypecode, ); } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt index d472c924f8..76dfcf761d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt @@ -70,19 +70,19 @@ div#result { margin-top: 1em; }
Merge reference
    -
  1. -
  2. - - [% IF frameworkselect %] -
  3. -
  4. +
  5. + + [% IF authority_types %] +
  6. +
  7. @@ -111,7 +111,7 @@ div#result { margin-top: 1em; } - +
    @@ -135,7 +135,7 @@ div#result { margin-top: 1em; } $(document).ready(function(){ // Getting marc structure via ajax tagslib = []; - $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework | html %]" }, function(json) { + $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {authtypecode : "[% authtypecode | html %]" }, function(json) { tagslib = json; rebuild_target($("#tabs"), $("#resultul")); }); -- 2.20.1