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

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



Revision: 3323
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3323&view=rev
Author:   ehuelsmann
Date:     2011-06-24 14:39:50 +0000 (Fri, 24 Jun 2011)

Log Message:
-----------
Use e-mail, cc and bcc from contact info when mailing invoices.

Patch by John Locke.

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

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2011-06-24 13:56:54 UTC (rev 3322)
+++ trunk/LedgerSMB/Form.pm	2011-06-24 14:39:50 UTC (rev 3323)
@@ -2421,10 +2421,8 @@
         $query = qq|
 			SELECT s.printed, s.emailed, s.spoolfile, s.formname
 			FROM status s WHERE s.trans_id = ?|;
-
         $sth = $dbh->prepare($query);
         $sth->execute( $self->{id} ) || $self->dberror($query);
-
         while ( $ref = $sth->fetchrow_hashref('NAME_lc') ) {
             $self->{printed} .= "$ref->{formname} "
               if $ref->{printed};
@@ -2433,10 +2431,21 @@
             $self->{queued} .= "$ref->{formname} " . "$ref->{spoolfile} "
               if $ref->{spoolfile};
         }
-
         $sth->finish;
         for (qw(printed emailed queued)) { $self->{$_} =~ s/ +$//g }
 
+	# get customer e-mail accounts
+	$query = qq|SELECT * FROM eca__list_contacts(?);|;
+	$sth = $dbh->prepare($query);
+	$sth->execute( $self->{entity_id} ) || $self->dberror( $query );
+
+	my $ctype;
+	while ( $ref = $sth->fetchrow_hashref('NAME_lc') ) {
+	    $ctype = lc $ref->{class};
+	    $self->{$ctype} .= "$ref->{contact} ";
+	}
+	$sth->finish;
+
         # get recurring
         $self->get_recurring($dbh);
 

Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	2011-06-24 13:56:54 UTC (rev 3322)
+++ trunk/LedgerSMB/Template.pm	2011-06-24 14:39:50 UTC (rev 3323)
@@ -271,7 +271,7 @@
 	my $post = $format->can('postprocess')->($self);
 	if (!$self->{'noauto'}) {
 		# Clean up
-		$self->output;
+		$self->output(%$vars);
 		if ($self->{rendered}) {
 			unlink($self->{rendered}) or
 				throw Error::Simple 'Unable to delete output file';


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