From 2b6ffabf85495113194787e19503fffb122caa90 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 9 Jun 2020 17:34:34 +0200 Subject: [PATCH] Bug 25728: Create AV when cataloguing an authority record Test plan: Same as the first patch but when cataloguing an authority record Sponsored-by: Orex Digital Signed-off-by: Hugo Agud Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- authorities/authorities.pl | 6 ++++-- .../prog/en/modules/authorities/authorities.tt | 12 +++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/authorities/authorities.pl b/authorities/authorities.pl index e422cafb36..afd5749c9e 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -73,7 +73,8 @@ sub build_authorized_values_list { #---- branch - if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { + my $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'}; + if ( $category eq "branches" ) { my $sth = $dbh->prepare( "select branchcode,branchname from branches order by branchname"); @@ -86,7 +87,7 @@ sub build_authorized_values_list { $authorised_lib{$branchcode} = $branchname; } } - elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) { + elsif ( $category eq "itemtypes" ) { push @authorised_values, "" unless ( $tagslib->{$tag}->{$subfield}->{mandatory} && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) ); @@ -121,6 +122,7 @@ sub build_authorized_values_list { values => \@authorised_values, labels => \%authorised_lib, default => $value, + ( ( grep { $_ eq $category } ( qw(branches itemtypes cn_source) ) ) ? () : ( category => $category ) ), }; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index fb33a1631c..601726a25f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -5,6 +5,9 @@ Koha › Authorities › [% IF ( authid ) %]Modify authority #[% authid | html %] ([% authtypetext | html %])[% ELSE %]Adding authority ([% authtypetext | html %])[% END %] [% INCLUDE 'doc-head-close.inc' %] [% Asset.js("lib/hc-sticky.js") | $raw %] + [% INCLUDE 'select2.inc' %] [% Asset.js("js/cataloging.js") | $raw %] @@ -369,7 +372,12 @@ function confirmnotdup(redirect){ [% SET mv = subfield_loo.marc_value %] [% IF ( mv.type == 'select' ) %] - + [% ELSE %] +