LP#1053397 tpac single-rec MR jumps to detail page
authorBill Erickson <berick@esilibrary.com>
Thu, 6 Feb 2014 19:47:44 +0000 (14:47 -0500)
committerBill Erickson <berick@esilibrary.com>
Mon, 10 Feb 2014 16:02:29 +0000 (11:02 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
Open-ILS/src/templates/opac/parts/result/table.tt2

index 5b0a0a2..feb8e83 100644 (file)
@@ -800,8 +800,6 @@ sub load_place_hold {
 
     my $type_dispatch = {
         M => sub {
-            warn "OMG HERE\n";
-
             # target metarecords
             my $mrecs = $e->batch_retrieve_metabib_metarecord([
                 \@targets, 
@@ -819,8 +817,6 @@ sub load_place_hold {
                 my $holdable_formats = 
                     $self->compile_holdable_formats($mr->id);
 
-                warn "holdable formats: $holdable_formats\n";
-
                 push(@hold_data, $data_filler->({
                     target => $mr, 
                     record => $mr->master_record,
@@ -1125,8 +1121,6 @@ sub compile_holdable_formats {
     my $e = $self->editor;
     my $cgi = $self->cgi;
 
-    warn "MR looking at params param = $_\n" for $cgi->param;
-
     # exit early if not needed
     return "" unless 
         grep /metarecord_formats_|metarecord_langs_/, 
index 0fb53ac..39742a4 100644 (file)
@@ -504,6 +504,11 @@ sub load_rresults {
 
         $ctx->{metarecord_master} = $rec
             if $metarecord_master and $metarecord_master eq $rec_id;
+
+        # MR's with multiple constituent records will have a
+        # null value in position 2 of the result set.  
+        my ($res_rec) = grep { $_->[0] == $rec_id} @{$results->{ids}};
+        $rec->{mr_has_multi} = !$res_rec->[2];
     }
 
     if ($tag_circs) {
@@ -512,7 +517,8 @@ sub load_rresults {
             # index 1 in the per-record result array is a boolean which
             # indicates whether the record in question is in the users
             # accessible circ history list
-            $rec->{user_circulated} = 1 if $res_rec->[1];
+            my $index = $is_meta ? 3 : 1;
+            $rec->{user_circulated} = 1 if $res_rec->[$index];
         }
     }
 
index 33368ba..2e102ad 100644 (file)
                             # note: rec.id refers to the record identifier, regardless
                             # of the type of record. i.e. rec.id = mmr_id ? mmr_id : bre_id
                             IF rec.mmr_id;
-                                # metarecords link to record list page
-                                record_url = mkurl(ctx.opac_root _ '/results', 
-                                    {metarecord => rec.mmr_id}, ['page']);
+                                IF rec.mr_has_multi;
+                                    # metarecords link to record list page
+                                    record_url = mkurl(ctx.opac_root _ '/results', 
+                                        {metarecord => rec.mmr_id}, ['page']);
+                                ELSE;
+                                    # for MR, bre_id refers to the master and in
+                                    # this case, only, record
+                                    record_url = mkurl(ctx.opac_root _ '/record/' _ rec.bre_id);
+                                END;
                                 hold_type = 'M';
                             ELSE;
                                 record_url = mkurl(ctx.opac_root _ '/record/' _ rec.bre_id);