LP#1713160: fix crash viewing circ history in public catalog
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 12 Sep 2017 21:45:09 +0000 (17:45 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 13 Sep 2017 14:02:05 +0000 (10:02 -0400)
This patch fixes a crash when a patron views their circulation
history in the public catalog.

To test
-------
[1] Set up a patron record that retains circ history and make
    and returns some loans. Ensure that at least one of the
    loans is aged.
[2] Log into the public catalog as the test patron and riew the
    Check Out History page (/eg/opac/myopac/circ_history).
[3] Note that an internal server error is reported.
[4] Apply the patch, repeat step 2, and verify that the check out
    history is now displayed.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/src/templates/opac/myopac/circ_history.tt2

index 765ecf3..8295e12 100644 (file)
@@ -1645,7 +1645,7 @@ sub fetch_user_circ_history {
     my %flesh_ops = (
         flesh => 3,
         flesh_fields => {
-            auch => ['target_copy'],
+            auch => ['target_copy','source_circ'],
             acp => ['call_number'],
             acn => ['record']
         },
index 423c4ff..1faffe6 100644 (file)
                             [% date.format(ctx.parse_datetime(circ.circ.xact_start),DATE_FORMAT); %]
                         </td>
                         <td>
-                            [% date.format(ctx.parse_datetime(circ.circ.due_date, circ.circ.circ_lib),DATE_FORMAT); %]
+                            [% IF circ.circ.source_circ;
+                                date.format(ctx.parse_datetime(circ.circ.due_date, circ.circ.source_circ.circ_lib),DATE_FORMAT);
+                               ELSE;
+                                date.format(ctx.parse_datetime(circ.circ.due_date, ctx.user.home_ou),DATE_FORMAT);
+                               END;
+                            %]
                         </td>
                         <td>
                             [% IF circ.circ.checkin_time;