[freeside-commits] freeside/FS/FS cust_bill.pm,1.232,1.233
Ivan,,,
ivan at wavetail.420.am
Tue Jan 20 11:35:19 PST 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv21719
Modified Files:
cust_bill.pm
Log Message:
fix agent-specific logos migrated from 1.7, RT#4645
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.232
retrieving revision 1.233
diff -u -d -r1.232 -r1.233
--- cust_bill.pm 23 Dec 2008 00:34:06 -0000 1.232
+++ cust_bill.pm 20 Jan 2009 19:35:16 -0000 1.233
@@ -843,7 +843,9 @@
my $invoice_from =
scalar(@_)
? shift
- : ( $self->_agent_invoice_from || $conf->config('invoice_from') );
+ : ( $self->_agent_invoice_from || #XXX should go away
+ $conf->config('invoice_from', $self->cust_main->agentnum )
+ );
my $balance_over = ( scalar(@_) && $_[0] !~ /^\s*$/ ) ? shift : 0;
@@ -899,7 +901,10 @@
my $invoice_from =
scalar(@_)
? shift
- : ( $self->_agent_invoice_from || $conf->config('invoice_from') );
+ : ( $self->_agent_invoice_from || #XXX should go away
+ $conf->config('invoice_from', $self->cust_main->agentnum )
+ );
+
my @invoicing_list = grep { $_ !~ /^(POST|FAX)$/ }
$self->cust_main->invoicing_list;
@@ -907,10 +912,13 @@
#better to notify this person than silence
@invoicing_list = ($invoice_from) unless @invoicing_list;
+ my $subject = $self->email_subject($template);
+
my $error = send_email(
$self->generate_email(
'from' => $invoice_from,
'to' => [ grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ],
+ 'subject' => $subject,
'template' => $template,
)
);
@@ -919,6 +927,24 @@
}
+sub email_subject {
+ my $self = shift;
+
+ #my $template = scalar(@_) ? shift : '';
+ #per-template?
+
+ my $subject = $conf->config('invoice_subject', $self->cust_main->agentnum)
+ || 'Invoice';
+
+ my $cust_main = $self->cust_main;
+ my $name = $cust_main->name;
+ my $name_short = $cust_main->name_short;
+ my $invoice_number = $self->invnum;
+ my $invoice_date = $self->_date_pretty;
+
+ eval qq("$subject");
+}
+
=item lpr_data [ TEMPLATENAME ]
Returns the postscript or plaintext for this invoice as an arrayref.
@@ -1760,6 +1786,7 @@
s/~/ /g;
s/\\\\\*?\s*$/<BR>/;
s/\\hyphenation\{[\w\s\-]+}//;
+ s/\\([&])/$1/g;
$_;
} @_
},
@@ -1854,7 +1881,7 @@
)
)
);
- } elsif ( grep /\S/, $conf->config('company_address') ) {
+ } elsif ( grep /\S/, $conf->config('company_address', $self->cust_main->agentnum) ) {
my $convert_map = $convert_maps{$format}{'returnaddress'};
$returnaddress = join( "\n", &$convert_map(
@@ -1862,8 +1889,8 @@
s/$/\\\\\*/;
$_
}
- ( $conf->config('company_name'),
- $conf->config('company_address'),
+ ( $conf->config('company_name', $self->cust_main->agentnum),
+ $conf->config('company_address', $self->cust_main->agentnum),
)
)
);
@@ -1879,8 +1906,8 @@
}
my %invoice_data = (
- 'company_name' => scalar( $conf->config('company_name') ),
- 'company_address' => join("\n", $conf->config('company_address') ). "\n",
+ 'company_name' => scalar( $conf->config('company_name', $self->cust_main->agentnum) ),
+ 'company_address' => join("\n", $conf->config('company_address', $self->cust_main->agentnum) ). "\n",
'custnum' => $cust_main->display_custnum,
'invnum' => $self->invnum,
'date' => time2str($date_format, $self->_date),
@@ -1898,7 +1925,7 @@
'returnaddress' => $returnaddress,
#'quantity' => 1,
'terms' => $self->terms,
- 'template' => $params{'template'},
+ 'template' => $template, #params{'template'},
#'notes' => join("\n", $conf->config('invoice_latexnotes') ),
# better hang on to conf_dir for a while
'conf_dir' => "$FS::UID::conf_dir/conf.$FS::UID::datasrc",
@@ -2586,7 +2613,18 @@
sub invnum_date_pretty {
my $self = shift;
- 'Invoice #'. $self->invnum. ' ('. time2str('%x', $self->_date). ')';
+ 'Invoice #'. $self->invnum. ' ('. $self->_date_pretty. ')';
+}
+
+=item _date_pretty
+
+Returns a string with the date, for example: "3/20/2008"
+
+=cut
+
+sub _date_pretty {
+ my $self = shift;
+ time2str('%x', $self->_date);
}
sub _items_sections {
More information about the freeside-commits
mailing list