OPAC Browse: Don't try to build hyperlinks from 680 ‡a
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 21 Jun 2013 22:03:00 +0000 (18:03 -0400)
committerBen Shum <bshum@biblio.org>
Mon, 15 Jul 2013 15:45:25 +0000 (11:45 -0400)
Public general notes can be formatted in too many way to try to cleverly
build browse links out of the contents.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm
Open-ILS/src/templates/opac/browse.tt2

index 5431774..c31e424 100644 (file)
@@ -76,43 +76,24 @@ sub prepare_browse_parameters {
     );
 }
 
-# Break out any Public General Notes (field 680) for display and
-# hyperlinking. These are sometimes (erroneously?) called "scope notes."
-# I say erroneously, tentatively, because LoC doesn't seem to document
-# a "scope notes" field for authority records, while it does so for
-# classification records, which are something else. But I am not a
-# librarian.
+# Break out any Public General Notes (field 680) for display. These are
+# sometimes (erroneously?) called "scope notes." I say erroneously,
+# tentatively, because LoC doesn't seem to document a "scope notes"
+# field for authority records, while it does so for classification
+# records, which are something else. But I am not a librarian.
 sub extract_public_general_notes {
     my ($self, $record, $row) = @_;
 
-    my @notes;
-    foreach my $note ($record->field('680')) {
-        my @note;
-        my $last_heading;
-
-        foreach my $subfield ($note->subfields) {
-            my ($code, $value) = @$subfield;
-
-            if ($code eq 'i') {
-                push @note, $value;
-            } elsif ($code eq '5') {
-                if ($last_heading) {
-                    my $org = $self->ctx->{get_aou_by_shortname}->($value);
-                    $last_heading->{org_id} = $org->id if $org;
-                }
-                push @note, { institution => $value };
-            } elsif ($code eq 'a') {
-                $last_heading = {
-                    heading => $value, bterm => search_normalize($value)
-                };
-                push @note, $last_heading;
-            }
-        }
-
-        push @notes, \@note if @note;
-    }
-
-    $row->{notes} = \@notes;
+    # Make a list of strings, each string being a concatentation of any
+    # subfields 'i', '5', or 'a' from one field 680, in order of appearance.
+    $row->{notes} = [
+        map {
+            join(
+                " ",
+                map { $_->[1] } grep { $_->[0] =~ /[i5a]/ } $_->subfields
+            )
+        } $record->field('680')
+    ];
 }
 
 sub find_authority_headings_and_notes {
index df0e7fc..ac12438 100644 (file)
                     [% l("Note:") %]
                 </span>
                 <span class="browse-public-general-note-body">
-            [% FOR piece IN note;
-                IF piece.heading;
-                    mkurl_args = {bterm => piece.bterm};
-                    IF piece.org_id;
-                        mkurl_args.locg = piece.org_id;
-                    END;
-                %]
-                <a href="[% mkurl('', mkurl_args, ['bpivot']) %]">[% piece.heading | html %]</a>
-                [% ELSIF piece.institution %]
-                <span class="browse-public-general-note-institution">
-                    [% piece.institution | html %]
-                </span>
-                [% ELSE %]
-                    [% piece | html %]
-                [% END;
-            END %]
+                [% FOR piece IN note; piece | html; END %]
                 </span>
             </div>
         [% END;