LP#1851306: (follow-up) add get_org_unit() helper to print templates
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 18 Jun 2020 20:12:08 +0000 (16:12 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 18 Jun 2020 20:12:08 +0000 (16:12 -0400)
The immediate use case is allowing the destination library's
shortname to print on booking capture slips.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/PrintTemplate.pm

index be76da0..47dc807 100644 (file)
@@ -208,7 +208,14 @@ $helpers = {
         my $tz = shift || 'local';
         my $date = DateTime->now(time_zone => $tz);
         return $helpers->{format_date}->($date);
-    }
+    },
+
+    get_org_unit => sub {
+        my $org_id = shift;
+        return $org_id if ref $org_id;
+        return new_editor()->retrieve_actor_org_unit($org_id);
+    },
+
 };