From 0fa1de926fd6af220b0bae2e7d9ea1b1a3282103 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 11 Jun 2008 16:43:22 -0500 Subject: [PATCH] kohabug 2112 - add indicators to MARC display In any MARC record display in the OPAC or staff client that displays the MARC tag numbers, the indicators are now displayed as well, following the tag number. If an indicator is a blank, it is displayed as '#'. Add a function to C4::Koha, display_marc_indicators(), to generate this display form of the indicators. Refactoring note: the four scripts changed in this commit have a lot of duplicate code that could be merged into a MARC displayer class. Documentation notes: screenshots of tagged MARC record displays should be updated. Signed-off-by: Joshua Ferraro --- C4/Koha.pm | 24 ++++++++++++++++++++++++ authorities/detail.pl | 5 ++++- catalogue/MARCdetail.pl | 5 ++++- opac/opac-MARCdetail.pl | 5 ++++- opac/opac-authoritiesdetail.pl | 5 ++++- 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index af9b91365e..07597b1287 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1098,6 +1098,30 @@ sub base64_to_str { return decode("UTF-8", decode_base64($in)); } +=head2 display_marc_indicators + +=over 4 + +# field is a MARC::Field object +my $display_form = C4::Koha::display_marc_indicators($field); + +=back + +Generate a display form of the indicators of a variable +MARC field, replacing any blanks with '#'. + +=cut + +sub display_marc_indicators { + my $field = shift; + my $indicators = ''; + if ($field->tag() >= 10) { + $indicators = $field->indicator(1) . $field->indicator(2); + $indicators =~ s/ /#/g; + } + return $indicators; +} + 1; __END__ diff --git a/authorities/detail.pl b/authorities/detail.pl index 7dc1978c42..425b15551c 100755 --- a/authorities/detail.pl +++ b/authorities/detail.pl @@ -384,7 +384,10 @@ sub build_tabs ($$$$$) { } if ($#subfields_data>=0) { my %tag_data; - $tag_data{tag}=$field->tag().' - '. $tagslib->{$field->tag()}->{lib}; + $tag_data{tag}=$field->tag(). ' ' + . C4::Koha::display_marc_indicators($field) + . ' - ' + . $tagslib->{$field->tag()}->{lib}; $tag_data{subfield} = \@subfields_data; push (@loop_data, \%tag_data); } diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index 1448f6e34c..abd86f408f 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -225,7 +225,10 @@ for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) { } else { $tag_data{tag} = - $fields[$x_i]->tag() . ' -' + $fields[$x_i]->tag() + . ' ' + . C4::Koha::display_marc_indicators($fields[$x_i]) + . ' - ' . $tagslib->{ $fields[$x_i]->tag() }->{lib}; } } diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 83597602be..c72d612947 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -187,7 +187,10 @@ for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) { } else { $tag_data{tag} = - $fields[$x_i]->tag() . ' -' + $fields[$x_i]->tag() + . ' ' + . C4::Koha::display_marc_indicators($fields[$x_i]) + . ' - ' . $tagslib->{ $fields[$x_i]->tag() }->{lib}; } } diff --git a/opac/opac-authoritiesdetail.pl b/opac/opac-authoritiesdetail.pl index aa39e05328..40e2d6b135 100755 --- a/opac/opac-authoritiesdetail.pl +++ b/opac/opac-authoritiesdetail.pl @@ -155,7 +155,10 @@ foreach my $field (@fields) { if ( $#subfields_data >= 0 ) { my %tag_data; $tag_data{tag} = - $field->tag() . ' -' . $tagslib->{ $field->tag() }->{lib}; + $field->tag() + . ' ' + . C4::Koha::display_marc_indicators($field) + . ' - ' . $tagslib->{ $field->tag() }->{lib}; $tag_data{subfield} = \@subfields_data; push( @loop_data, \%tag_data ); } -- 2.39.5