Bug 14769: (Follow-up) Let blinddetail look at indicator values
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 9 Feb 2018 11:18:10 +0000 (12:18 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 12 Apr 2018 13:50:36 +0000 (10:50 -0300)
If the indicators are not controlled, blinddetail should not overwrite
what the user already entered. Very strictly seen, we could say that it
is outside the scope. But it is strongly related.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested with 100 and 600 in the cataloging editor.
For 100 the second indicator should not be overwritten. For 600 it should.
Also tested "ind2:" which should blank ind2.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

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

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

index 0146a66..13f5dc6 100755 (executable)
@@ -105,8 +105,8 @@ if ($authid) {
     push( @subfield_loop, { marc_subfield => 'w', marc_values => $relationship } ) if ( $relationship );
 
     my $controlled_ind = $auth->controlled_indicators({ record => $record, biblio_tag => $tag_number });
-    $indicator1 = $controlled_ind->{ind1} // q{};
-    $indicator2 = $controlled_ind->{ind2} // q{};
+    $indicator1 = $controlled_ind->{ind1};
+    $indicator2 = $controlled_ind->{ind2};
     if( defined $controlled_ind->{sub2} ) {
         my $v = $controlled_ind->{sub2};
         push @subfield_loop, { marc_subfield => '2', marc_values => [ $v ] };
@@ -116,15 +116,13 @@ if ($authid) {
     $template->param( "clear" => 1 );
 }
 
-# Remove spaces in indicators
-$indicator1 =~ s/\s//g;
-$indicator2 =~ s/\s//g;
-
 $template->param(
     authid          => $authid ? $authid : "",
     index           => $index,
     tagid           => $tagid,
+    update_ind1     => defined($indicator1),
     indicator1      => $indicator1,
+    update_ind2     => defined($indicator2),
     indicator2      => $indicator2,
     SUBFIELD_LOOP   => \@subfield_loop,
     tag_number      => $tag_number,
index e8b07a4..85bb721 100644 (file)
                 );
             [% END %]
                 var indicators = field_start.getElementsByClassName('indicator flat');
-                indicators[0].value="[% indicator1 %]";
-                indicators[1].value="[% indicator2 %]";
+                [% IF update_ind1 %]
+                    indicators[0].value="[% indicator1 %]";
+                [% END %]
+                [% IF update_ind2 %]
+                    indicators[1].value="[% indicator2 %]";
+                [% END %]
             [% END %]
 
             // browse all its subfields (clear and $9)