protect against missing (or no) HOO and closure rows
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 Nov 2009 20:19:31 +0000 (20:19 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 Nov 2009 20:19:31 +0000 (20:19 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14870 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm

index 709fe23..0b8afca 100644 (file)
@@ -207,6 +207,8 @@ __PACKAGE__->register_method(
 
 sub make_hoo_spanset {
     my $hoo = shift;
+    return undef unless $hoo;
+
     my $today = shift || DateTime->now;
 
     my $tz = OpenSRF::AppSession->create('open-ils.actor')->request(
@@ -242,6 +244,7 @@ sub make_hoo_spanset {
 
 sub make_closure_spanset {
     my $closures = shift;
+    return undef unless $closures;
 
     my $spanset = DateTime::SpanSet->empty_set;
     for my $k ( keys %$closures ) {
@@ -287,7 +290,7 @@ sub org_closed_overlap {
         actor::org_unit::closed_date->db_Main->selectall_hashref( $sql, 'id', {}, $date, $ou )
     );
 
-    if ($closure_spanset->intersects( $target_date )) {
+    if ($closure_spanset && $closure_spanset->intersects( $target_date )) {
         my $closure_intersection = $closure_spanset->intersection( $target_date );
         $begin = $closure_intersection->min;
         $end = $closure_intersection->max;