From c70d39f1426dc2a02c43fbc136a5d1568e7a802a Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 29 Oct 2013 14:36:24 -0300 Subject: [PATCH] Bug 11096: Take advantage of MARC::Field->as_string feature Avoid looping over the subfields for building the facets. pushes higher version dependencies for MARC::File::XML and MARC::Record. Apply on top of the other patches for this bug, facets should still show as usual. Sponsored-by: Universidad Nacional de Cordoba --- C4/Installer/PerlDependencies.pm | 4 ++-- C4/Search.pm | 11 +---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index b769c48..57ba017 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -462,7 +462,7 @@ our $PERL_DEPS = { 'MARC::Record' => { 'usage' => 'Core', 'required' => '1', - 'min_ver' => '2' + 'min_ver' => '2.0.6' }, 'Locale::Currency::Format' => { 'usage' => 'Core', @@ -487,7 +487,7 @@ our $PERL_DEPS = { 'MARC::File::XML' => { 'usage' => 'Core', 'required' => '1', - 'min_ver' => '0.88' + 'min_ver' => '1.0.1' }, 'XML::SAX::Writer' => { 'usage' => 'Core', diff --git a/C4/Search.pm b/C4/Search.pm index 5e03a70..07486f1 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -522,16 +522,7 @@ sub getRecords { my @fields = $marc_record->field($tag_num); foreach my $field (@fields) { - # TODO: Once as_string is capable of using a separator, use this - # my $data = $field->as_string( $subfield_letters, $facet->{sep} ); - - my @values = (); - foreach my $subfield (@subfields) { - push @values, $field->subfield( $subfield ) - if defined $field->subfield( $subfield ); - } - - my $data = join( $facet->{sep}, @values ); + my $data = $field->as_string( $subfield_letters, $facet->{sep} ); unless ( $data ~~ @used_datas ) { push @used_datas, $data; -- 1.8.3.2