[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3152] trunk/LedgerSMB



Revision: 3152
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3152&view=rev
Author:   einhverfr
Date:     2011-05-22 19:38:25 +0000 (Sun, 22 May 2011)

Log Message:
-----------
Correcting User email detection logic in Template.pm (user emails not currently handled though), and some code clarify fixes to Company_config.

Modified Paths:
--------------
    trunk/LedgerSMB/Company_Config.pm
    trunk/LedgerSMB/Template.pm

Modified: trunk/LedgerSMB/Company_Config.pm
===================================================================
--- trunk/LedgerSMB/Company_Config.pm	2011-05-22 19:37:11 UTC (rev 3151)
+++ trunk/LedgerSMB/Company_Config.pm	2011-05-22 19:38:25 UTC (rev 3152)
@@ -42,16 +42,14 @@
 
 sub initialize{
    my ($self) = @_;
-   for my $k (keys %$settings){
-       delete $settings->{$k};
-   }
-   for my $setting (@company_settings){
+   $settings= {}; # In case code is cached
+   for my $key (@company_settings){
        my ($ref) = LedgerSMB::call_procedure($self, procname => 'setting_get', 
-                  args => [$setting]);
+                  args => [$key ]);
        if ($ref->{setting_key} eq 'curr'){
-          $settings->{$setting} = split /:/, $ref->{value};
+          $settings->{$key } = split /:/, $ref->{value};
        } else {
-          $settings->{$setting} = $ref->{value};
+          $settings->{$key } = $ref->{value};
        }
    }
 }

Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	2011-05-22 19:37:11 UTC (rev 3151)
+++ trunk/LedgerSMB/Template.pm	2011-05-22 19:38:25 UTC (rev 3152)
@@ -364,6 +364,9 @@
 		@mailmime = ('contenttype', $self->{mimeytype});
 	}
 
+        # User default for email from
+        $args->{from} ||= $self->{user}->{email};
+
         # Default addresses
         my $csettings = $LedgerSMB::Company_Config::settings;
         $args->{from} ||= $csettings->{default_email_from};
@@ -371,9 +374,10 @@
         $args->{cc} ||= $csettings->{default_email_cc};
         $args->{bcc} ||= $csettings->{default_email_bcc};
 
+
         # Mailer stuff
 	my $mail = new LedgerSMB::Mailer(
-		from => $args->{from} || $self->{user}->{email},
+		from => $args->{from},
 		to => $args->{to},
 		cc => $args->{cc},
 		bcc => $args->{bcc},


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.