hyperlinks for the formats and editions in the catalog staff view
authorJason Etheridge <jason@EquinoxOLI.org>
Thu, 3 Nov 2022 18:45:11 +0000 (14:45 -0400)
committerJason Etheridge <jason@EquinoxOLI.org>
Wed, 4 Jan 2023 13:44:01 +0000 (08:44 -0500)
Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm

index 9ea09d1..585a7fa 100644 (file)
                   <div class="col-lg-8 pl-1">
                     <ul class="list-group">
                         <ng-container *ngIf="summary.staffViewMetabibAttributes.icon_format">
-                        <li class="list-group-item" *ngFor="let _x of summary.staffViewMetabibAttributes.icon_format.label | keyvalue">
-                            <span>{{_x.key}} ({{_x.value}})</span>
+                        <li class="list-group-item" *ngFor="let _x of summary.staffViewMetabibAttributes.icon_format | keyvalue">
+                            <a href="/eg2/staff/catalog/search?query=from_metarecord({{summary.staffViewMetabibId}}) icon_format({{_x.key}})">
+                                {{_x.value.label}}
+                            </a>
+                                {{_x.value.count}}
                         </li>
                         </ng-container>
                         <ng-container *ngIf="summary.staffViewMetabibAttributes.item_lang">
-                        <li class="list-group-item" *ngFor="let _x of summary.staffViewMetabibAttributes.item_lang.label | keyvalue">
-                            <span>{{_x.key}} ({{_x.value}})</span>
+                        <li class="list-group-item" *ngFor="let _x of summary.staffViewMetabibAttributes.item_lang | keyvalue">
+                            <a href="/eg2/staff/catalog/search?query=from_metarecord({{summary.staffViewMetabibId}}) item_lang({{_x.key}})">
+                                {{_x.value.label}}
+                            </a>
+                                {{_x.value.count}}
                         </li>
                         </ng-container>
                     </ul>
index e7ed7c9..73283b8 100644 (file)
@@ -3137,22 +3137,19 @@ sub catalog_record_summary {
                 foreach my $bib_id ( keys %{ $attributes } ) {
                     foreach my $ctype ( keys %{ $attributes->{$bib_id} } ) {
                         # we want {
-                        #   "srce":{
-                        #     "code": { " ":1, ... } # leaf value is the bib count
-                        #     "label": { "National bibliographic agency":1, ... } 
-                        #   }, ...}
+                        #   "srce":{ " ": { "label": "National bibliographic agency", "count" : 1 } },
+                        #       ...
+                        #   }
+                        my $current_code = $attributes->{$bib_id}->{$ctype}->{code};
+                        my $code_label = $attributes->{$bib_id}->{$ctype}->{label};
                         $metabib_attr->{$ctype} = {} unless $metabib_attr->{$ctype};
-                        $metabib_attr->{$ctype}->{code} = {} unless $metabib_attr->{$ctype}->{code};
-                        $metabib_attr->{$ctype}->{label} = {} unless $metabib_attr->{$ctype}->{label};
-                        if ( $metabib_attr->{$ctype}->{code}->{ $attributes->{$bib_id}->{$ctype}->{code} } ) {
-                            $metabib_attr->{$ctype}->{code}->{ $attributes->{$bib_id}->{$ctype}->{code} } += 1;
-                        } else {
-                            $metabib_attr->{$ctype}->{code}->{ $attributes->{$bib_id}->{$ctype}->{code} } = 1;
-                        }
-                        if ( $metabib_attr->{$ctype}->{label}->{ $attributes->{$bib_id}->{$ctype}->{label} } ) {
-                            $metabib_attr->{$ctype}->{label}->{ $attributes->{$bib_id}->{$ctype}->{label} } += 1;
+                        if (! $metabib_attr->{$ctype}->{ $current_code }) {
+                            $metabib_attr->{$ctype}->{ $current_code } = {
+                                "label" => $code_label,
+                                "count" => 1
+                            }
                         } else {
-                            $metabib_attr->{$ctype}->{label}->{ $attributes->{$bib_id}->{$ctype}->{label} } = 1;
+                            $metabib_attr->{$ctype}->{ $current_code }->{count}++;
                         }
                     }
                 }