Bug 25728: Create AV when cataloguing an authority record
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 9 Jun 2020 15:34:34 +0000 (17:34 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 24 Aug 2020 09:19:03 +0000 (11:19 +0200)
Test plan:
Same as the first patch but when cataloguing an authority record

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

authorities/authorities.pl
koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt

index e422caf..afd5749 100755 (executable)
@@ -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 ) ),
     };
 }
 
index fb33a16..601726a 100644 (file)
@@ -5,6 +5,9 @@
 <title>Koha &rsaquo; Authorities &rsaquo; [% IF ( authid ) %]Modify authority #[% authid | html %] ([% authtypetext | html %])[% ELSE %]Adding authority ([% authtypetext | html %])[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% Asset.js("lib/hc-sticky.js") | $raw %]
+<script>
+    var CAN_user_parameters_manage_auth_values = "[% CAN_user_parameters_manage_auth_values | html %]";
+</script>
 [% 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' ) %]
-                     <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor select2" id="[%- mv.id | html -%]">
+                    [% IF mv.category AND CAN_user_parameters_manage_auth_values %]
+                        <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]" data-category="[% mv.category | html %]">
+                    [% ELSE %]
+                        <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor select2" id="[%- mv.id | html -%]">
+                    [% END %]
+
                      [% FOREACH aval IN mv.values %]
                          [% IF aval == mv.default %]
                          <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
@@ -444,6 +452,8 @@ function confirmnotdup(redirect){
 
 </form>
 
+[% INCLUDE 'modals/cataloguing_create_av.inc' %]
+
 </div>
 </div>
 </div>