[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4731] branches/1.3/LedgerSMB/RP.pm
- Subject: SF.net SVN: ledger-smb:[4731] branches/1.3/LedgerSMB/RP.pm
- From: ..hidden..
- Date: Sat, 19 May 2012 10:05:33 +0000
Revision: 4731
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4731&view=rev
Author: ehuelsmann
Date: 2012-05-19 10:05:32 +0000 (Sat, 19 May 2012)
Log Message:
-----------
Add billing e-mail refinement also present for mailing of invoices to aging.
Modified Paths:
--------------
branches/1.3/LedgerSMB/RP.pm
Modified: branches/1.3/LedgerSMB/RP.pm
===================================================================
--- branches/1.3/LedgerSMB/RP.pm 2012-05-19 08:30:50 UTC (rev 4730)
+++ branches/1.3/LedgerSMB/RP.pm 2012-05-19 10:05:32 UTC (rev 4731)
@@ -1881,19 +1881,37 @@
my $dbh = $form->{dbh};
my $query = qq|
- SELECT e.name, c.contact, cc.class
+ SELECT e.name, c.contact, c.contact_class_id as class_id
FROM entity_credit_account eca
JOIN entity e ON e.id = eca.entity_id
JOIN eca_to_contact c ON (c.credit_id = eca.id)
- JOIN contact_class cc ON (c.contact_class_id = cc.id)
WHERE eca.id = ?
- AND cc.id BETWEEN 12 AND 17|;
+ AND contact_class_id BETWEEN 12 AND 17
+ ORDER BY contact_class_id DESC|;
$sth = $dbh->prepare($query);
$sth->execute( $form->{"$form->{ct}_id"} );
- while (my $ref = $sth->fetchrow_hashref('NAME_lc')){
+
+ # This is a copy from code also present in Form.pm
+ my %id_map = ( 12 => 'email',
+ 13 => 'cc',
+ 14 => 'bcc',
+ 15 => 'email',
+ 16 => 'cc',
+ 17 => 'bcc' );
+
+ my $ctype;
+ my $billing_email = 0;
+ while (my $ref = $sth->fetchrow_hashref('NAME_lc')) {
+ $ctype = $id_map{$ref->{class_id}};
+
+ $billing_email = 1
+ if $ref->{class_id} == 15;
+
$form->{ $form->{ct} } = $ref->{name}; # each 'name' row is the same
- $form->{ lc($ref->{class}) } .=
- ($form->{ lc($ref->{class}) } ? ", " : "") . $ref->{contact};
+ $form->{$ctype} .=
+ ($form->{$ctype} ? ", " : "") . $ref->{contact}
+ if (($ref->{class_id} < 15) && ! $billing_email)
+ || $ref->{class_id} >= 15;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.