[open-ils-commits] r10814 - trunk/Open-ILS/src/support-scripts

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Oct 10 09:25:27 EDT 2008


Author: erickson
Date: 2008-10-10 09:25:25 -0400 (Fri, 10 Oct 2008)
New Revision: 10814

Modified:
   trunk/Open-ILS/src/support-scripts/generate_circ_notices.pl
Log:
use org ancester setting for sender address

Modified: trunk/Open-ILS/src/support-scripts/generate_circ_notices.pl
===================================================================
--- trunk/Open-ILS/src/support-scripts/generate_circ_notices.pl	2008-10-10 03:16:06 UTC (rev 10813)
+++ trunk/Open-ILS/src/support-scripts/generate_circ_notices.pl	2008-10-10 13:25:25 UTC (rev 10814)
@@ -248,27 +248,16 @@
 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 {



More information about the open-ils-commits mailing list