projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
credit report, add some links to sales/credits/receipts summary, move payment search...
[freeside.git]
/
FS
/
bin
/
freeside-cc-receipts-report
diff --git
a/FS/bin/freeside-cc-receipts-report
b/FS/bin/freeside-cc-receipts-report
index
5ea8cc5
..
136851a
100755
(executable)
--- a/
FS/bin/freeside-cc-receipts-report
+++ b/
FS/bin/freeside-cc-receipts-report
@@
-6,17
+6,18
@@
use Date::Parse;
use Time::Local;
use Getopt::Std;
use Text::Template;
use Time::Local;
use Getopt::Std;
use Text::Template;
+use Net::SMTP;
+use Mail::Header;
+use Mail::Internet;
use FS::Conf;
use FS::UID qw(adminsuidsetup);
use FS::Record qw(qsearch qsearchs);
use FS::cust_pay;
use FS::cust_pay_batch;
use FS::Conf;
use FS::UID qw(adminsuidsetup);
use FS::Record qw(qsearch qsearchs);
use FS::cust_pay;
use FS::cust_pay_batch;
-# Set the mail program
-my $mail_program = "/usr/sbin/sendmail -t -n";
&untaint_argv; #what it sounds like (eww)
&untaint_argv; #what it sounds like (eww)
-use vars qw($opt_v $opt_p $opt_m $opt_e $opt_t $opt_s $opt_f $report_lines $report_template @buf);
+use vars qw($opt_v $opt_p $opt_m $opt_e $opt_t $opt_s $opt_f $report_lines $report_template @buf
$header
);
getopts("vpmef:s:"); #switches
#we're at now now (and later).
getopts("vpmef:s:"); #switches
#we're at now now (and later).
@@
-43,6
+44,9
@@
adminsuidsetup $user;
my $conf = new FS::Conf;
my $lpr = $conf->config('lpr');
my $email = $conf->config('email');
my $conf = new FS::Conf;
my $lpr = $conf->config('lpr');
my $email = $conf->config('email');
+my $smtpmachine = $conf->config('smtpmachine');
+my $mail_sender = $conf->exists('invoice_from') ? $conf->config('invoice_from') :
+ 'postmaster';
my @report_template = $conf->config('report_template')
or die "cannot load config file report_template";
$report_lines = 0;
my @report_template = $conf->config('report_template')
or die "cannot load config file report_template";
$report_lines = 0;
@@
-74,14
+78,14
@@
if ($lpr && $main::opt_p)
if ($email && $main::opt_m)
{
if ($email && $main::opt_m)
{
-
open (MAIL, "|$mail_program")
;
- print MAIL <<END
-To: $email
-From: Account Processor
-Subject: Receivables
-
-
-END
+
$ENV{MAILADDRESS} = $mail_sender
;
+ $header = new Mail::Header ( [
+ "From: Account Processor",
+ "To: $email",
+ "Sender: $mail_sender",
+ "Reply-To: $mail_sender",
+ "Subject: Credit Card Receipts",
+ ] );
}
my $uninvoiced = 0;
}
my $uninvoiced = 0;
@@
-189,15
+193,20
@@
if($lpr && $opt_p)
}
if($email && $opt_m)
{
}
if($email && $opt_m)
{
- print MAIL map "$_\n", @report;
- close MAIL || die "Could not close printer: $email\n";
+ my $message = new Mail::Internet (
+ 'Header' => $header,
+ 'Body' => [ (@report) ],
+ );
+ $!=0;
+ $message->smtpsend( Host => "$smtpmachine" )
+ or die "can't send report to $email via $smtpmachine: $!";
}
# subroutines
sub untaint_argv {
foreach $_ ( $[ .. $#ARGV ) { #untaint @ARGV
}
# subroutines
sub untaint_argv {
foreach $_ ( $[ .. $#ARGV ) { #untaint @ARGV
- $ARGV[$_] =~ /^([\w\-\/ :]*)$/ || die "Illegal argument \"$ARGV[$_]\"";
+ $ARGV[$_] =~ /^([\w\-\/ :
\.
]*)$/ || die "Illegal argument \"$ARGV[$_]\"";
$ARGV[$_]=$1;
}
}
$ARGV[$_]=$1;
}
}
@@
-236,7
+245,7
@@
user: From the mapsecrets file - see config.html from the base documentation
=head1 VERSION
=head1 VERSION
-$Id: freeside-cc-receipts-report,v 1.
2 2002-03-05 23:13:23 jeff
Exp $
+$Id: freeside-cc-receipts-report,v 1.
5 2002-09-09 22:57:34 ivan
Exp $
=head1 BUGS
=head1 BUGS
@@
-251,24
+260,11
@@
for more information regarding this license.
L<FS::cust_main>, config.html from the base documentation
L<FS::cust_main>, config.html from the base documentation
-=head1 HISTORY
-
-griff@aver-computer.com July 99
+=head1 AUTHOR
-$Log: freeside-cc-receipts-report,v $
-Revision 1.2 2002-03-05 23:13:23 jeff
-consistency is nice
-
-Revision 1.2 2002/02/19 14:24:53 jeff
-might be functional now
-
-Revision 1.1 2000/09/20 19:25:19 jeff
-local modifications
-
-Revision 1.1 2000/05/13 21:57:56 ivan
-add print_batch script from Joel Griffiths
+Jeff Finucane <jeff@cmh.net>
+based on print-batch by Joel Griffiths <griff@aver-computer.com>
=cut
=cut
-