use org ancester setting for sender address
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 10 Oct 2008 13:25:25 +0000 (13:25 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 10 Oct 2008 13:25:25 +0000 (13:25 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10814 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/support-scripts/generate_circ_notices.pl

index d00740f..b33f8e1 100755 (executable)
@@ -248,27 +248,16 @@ my %ORG_FROM_CACHE;
 sub get_from_addr {
     my $type = shift;
     my $org_id = shift;
-    my $sender;
 
-    if(defined $ORG_FROM_CACHE{$org_id}) {
-        # we have we already loaded the setting for this org unit
-               $sender = $ORG_FROM_CACHE{$org_id};
+    return $ORG_FROM_CACHE{$org_id} if $ORG_FROM_CACHE{$org_id};
 
-    } elsif(my $set = $e->search_actor_org_unit_setting( 
-                       {name => 'org.bounced_emails', org_unit => $org_id} )->[0]) {
-               my $bemail = OpenSRF::Utils::JSON->JSON2perl($set->value);
-               $sender = $ORG_FROM_CACHE{$org_id} = $bemail if $bemail;
+    if(my $bemail = $U->ou_ancestor_setting_value($org_id, 'org.bounced_emails', $e)) {
+               return $ORG_FROM_CACHE{$org_id} = $bemail;
        }
 
-    unless($sender) {
-        # there is no setting, use the configured sender
-        $sender = $settings->config_value(
-            notifications => $type => 'sender_address') || 
-            $settings->config_value(notifications => 'sender_address');
-        $ORG_FROM_CACHE{$org_id} = '';
-    }
-
-    return $sender;
+    return $ORG_FROM_CACHE{$org_id} = 
+        $settings->config_value(notifications => $type => 'sender_address') || 
+        $settings->config_value(notifications => 'sender_address');
 }
 
 sub generate_notice {