summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-04-16 10:47:35 +0000
committerivan <ivan>2002-04-16 10:47:35 +0000
commit4201aaaae8a957bc98ce345d3ee0e599da354766 (patch)
tree1f4cc956f932b9b301900928343ece96955a6b31
parent17ddcceb66e4c5c45abe890403d2ca98b128d375 (diff)
report on failed billing events...
-rw-r--r--FS/FS/Conf.pm4
-rw-r--r--FS/FS/cust_bill.pm8
-rw-r--r--FS/FS/cust_bill_event.pm11
-rw-r--r--httemplate/index.html2
-rw-r--r--httemplate/search/cust_bill_event.cgi62
-rwxr-xr-xhttemplate/search/cust_bill_event.html23
-rwxr-xr-xhttemplate/search/report_cc.html4
-rwxr-xr-xhttemplate/search/report_credit.html4
-rwxr-xr-xhttemplate/search/report_tax.html4
-rwxr-xr-xhttemplate/view/cust_bill.cgi2
10 files changed, 112 insertions, 12 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index dc1cbb820..6bcf9c43e 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -896,14 +896,14 @@ httemplate/docs/config.html
},
{
- 'key' => 'declinetemplate'
+ 'key' => 'declinetemplate',
'section' => 'billing',
'description' => 'Template file for credit card decline emails.',
'type' => 'textarea',
},
{
- 'key' => 'emaildecline'
+ 'key' => 'emaildecline',
'section' => 'billing',
'description' => 'Enable emailing of credit card decline notices.',
'type' => 'checkbox',
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index cb2aa4629..816553bda 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -582,9 +582,9 @@ sub realtime_card {
my $template = new Text::Template (
TYPE => 'ARRAY',
SOURCE => [ map "$_\n", @templ ],
- ) or die "($perror) can't create template: $Text::Template::ERROR";
+ ) or return "($perror) can't create template: $Text::Template::ERROR";
$template->compile()
- or die "($perror) can't compile template: $Text::Template::ERROR";
+ or return "($perror) can't compile template: $Text::Template::ERROR";
my $error = $transaction->error_message;
@@ -605,7 +605,7 @@ sub realtime_card {
$!=0;
$message->smtpsend( Host => $smtpmachine )
or $message->smtpsend( Host => $smtpmachine, Debug => 1 )
- or die "($perror) (customer # ". $self->custnum.
+ or return "($perror) (customer # ". $self->custnum.
") can't send card decline email to ".
join(', ', grep { $_ ne 'POST' } $cust_main->invoicing_list ).
" via server $smtpmachine with SMTP: $!";
@@ -944,7 +944,7 @@ sub print_text {
=head1 VERSION
-$Id: cust_bill.pm,v 1.28 2002-04-16 09:38:19 ivan Exp $
+$Id: cust_bill.pm,v 1.29 2002-04-16 10:47:34 ivan Exp $
=head1 BUGS
diff --git a/FS/FS/cust_bill_event.pm b/FS/FS/cust_bill_event.pm
index 146a30e02..d5ca55f36 100644
--- a/FS/FS/cust_bill_event.pm
+++ b/FS/FS/cust_bill_event.pm
@@ -132,6 +132,17 @@ sub part_bill_event {
qsearchs( 'part_bill_event', { 'eventpart' => $self->eventpart } );
}
+=item cust_bill
+
+Returns the invoice (see L<FS::cust_bill>) for this completed invoice event.
+
+=cut
+
+sub cust_bill {
+ my $self = shift;
+ qsearchs( 'cust_bill', { 'invnum' => $self->invnum } );
+}
+
=back
=head1 BUGS
diff --git a/httemplate/index.html b/httemplate/index.html
index 934767dde..b562a2280 100644
--- a/httemplate/index.html
+++ b/httemplate/index.html
@@ -58,6 +58,7 @@
<BR><A HREF="browse/cust_pay_batch.cgi">View pending credit card batch</A>
<BR><BR>Invoice reports
<UL>
+ <LI><a href="search/cust_bill_event.html">Invoice event errors (failed credit cards)</a>
<LI>open invoices (<A HREF="search/cust_bill.cgi?OPEN_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN_custnum">by customer number</A>)
<LI>30 day open invoices (<A HREF="search/cust_bill.cgi?OPEN30_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN30_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN30_custnum">by customer number</A>)
<LI>60 day open invoices (<A HREF="search/cust_bill.cgi?OPEN60_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN60_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN60_custnum">by customer number</A>)
@@ -122,6 +123,7 @@
</UL>
Invoices
<UL>
+ <LI><a href="search/cust_bill_event.html">Invoice event errors (failed credit cards)</a>
<LI>open invoices (<A HREF="search/cust_bill.cgi?OPEN_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN_custnum">by customer number</A>)
<LI>30 day open invoices (<A HREF="search/cust_bill.cgi?OPEN30_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN30_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN30_custnum">by customer number</A>)
<LI>60 day open invoices (<A HREF="search/cust_bill.cgi?OPEN60_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN60_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN60_custnum">by customer number</A>)
diff --git a/httemplate/search/cust_bill_event.cgi b/httemplate/search/cust_bill_event.cgi
new file mode 100644
index 000000000..9cb36d28e
--- /dev/null
+++ b/httemplate/search/cust_bill_event.cgi
@@ -0,0 +1,62 @@
+<!-- mason kludge -->
+<%
+
+#false laziness with view/cust_bill.cgi
+
+$cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/;
+my $beginning = str2time($1);
+
+$cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/;
+my $ending = str2time($1) + 86400;
+
+my @cust_bill_event =
+ sort { $a->_date <=> $b->_date }
+ qsearch('cust_bill_event', {
+ _date => { op=> '>=', value=>$beginning },
+ statustext => { op=> '!=', value=>'' },
+# i wish...
+# _date => { op=> '<=', value=>$ending },
+ }, '', "AND _date <= $ending");
+
+%>
+
+<%= header('Failed billing events') %>
+
+<%= table() %>
+<TR>
+ <TH>Event</TH>
+ <TH>Date</TH>
+ <TH>Status</TH>
+ <TH>Invoice</TH>
+ <TH>(bill) name</TH>
+ <TH>company</TH>
+<% if ( defined dbdef->table('cust_main')->column('ship_last') ) { %>
+ <TH>(service) name</TH>
+ <TH>company</TH>
+<% } %>
+</TR>
+
+<% foreach my $cust_bill_event ( @cust_bill_event ) {
+ my $status = $cust_bill_event->status;
+ $status .= ': '.$cust_bill_event->statustext if $cust_bill_event->statustext;
+ my $cust_bill = $cust_bill_event->cust_bill;
+ my $cust_main = $cust_bill->cust_main;
+ my $invlink = "${p}view/cust_bill.cgi?". $cust_bill->invnum;
+ my $custlink = "${p}view/cust_main.cgi?". $cust_main->custnum;
+%>
+<TR>
+ <TD><%= $cust_bill_event->part_bill_event->event %></TD>
+ <TD><%= time2str("%a %b %e %T %Y", $cust_bill_event->_date) %></TD>
+ <TD><%= $status %></TD>
+ <TD><A HREF="<%=$invlink%>">Invoice #<%= $cust_bill->invnum %> (<%= time2str("%D", $cust_bill->_date ) %>)</A></TD>
+ <TD><A HREF="<%=$custlink%>"><%= $cust_main->last. ', '. $cust_main->first %></A></TD>
+ <TD><A HREF="<%=$custlink%>"><%= $cust_main->company %></A></TD>
+ <% if ( defined dbdef->table('cust_main')->column('ship_last') ) { %>
+ <TD><A HREF="<%=$custlink%>"><%= $cust_main->ship_last. ', '. $cust_main->ship_first %></A></TD>
+ <TD><A HREF="<%=$custlink%>"><%= $cust_main->ship_company %></A></TD>
+ <% } %>
+</TR>
+<% } %>
+</TABLE>
+
+</BODY></HTML>
diff --git a/httemplate/search/cust_bill_event.html b/httemplate/search/cust_bill_event.html
new file mode 100755
index 000000000..d76ce3c8c
--- /dev/null
+++ b/httemplate/search/cust_bill_event.html
@@ -0,0 +1,23 @@
+<HTML>
+ <HEAD>
+ <TITLE>Failed billing events</TITLE>
+ </HEAD>
+ <BODY>
+ <CENTER>
+ <H1>Failed billing events</H1>
+ </CENTER>
+ <HR>
+ <FORM ACTION="cust_bill_event.cgi" METHOD="post">
+ Return <B>failed billing events</B> for period:
+ from <INPUT TYPE="text" NAME="beginning"> <i>m/d/y</i>
+ to <INPUT TYPE="text" NAME="ending"> <i>m/d/y</i>
+
+ <P><INPUT TYPE="submit" VALUE="Get Report">
+
+ </FORM>
+
+ <HR>
+
+ </BODY>
+</HTML>
+
diff --git a/httemplate/search/report_cc.html b/httemplate/search/report_cc.html
index a028a87df..8653dcc69 100755
--- a/httemplate/search/report_cc.html
+++ b/httemplate/search/report_cc.html
@@ -9,8 +9,8 @@
<HR>
<FORM ACTION="report_cc.cgi" METHOD="post">
Return <B>credit card receipt report</B> for period:
- from <INPUT TYPE="text" NAME="beginning">
- to <INPUT TYPE="text" NAME="ending">
+ from <INPUT TYPE="text" NAME="beginning"> <i>m/d/y</i>
+ to <INPUT TYPE="text" NAME="ending"> <i>m/d/y</i>
<P><INPUT TYPE="submit" VALUE="Get Report">
diff --git a/httemplate/search/report_credit.html b/httemplate/search/report_credit.html
index bda08e31d..df9b9581f 100755
--- a/httemplate/search/report_credit.html
+++ b/httemplate/search/report_credit.html
@@ -9,8 +9,8 @@
<HR>
<FORM ACTION="report_credit.cgi" METHOD="post">
Return <B>in house credit report</B> for period:
- from <INPUT TYPE="text" NAME="beginning">
- to <INPUT TYPE="text" NAME="ending">
+ from <INPUT TYPE="text" NAME="beginning"> <i>m/d/y</i>
+ to <INPUT TYPE="text" NAME="ending"> <i>m/d/y</i>
<P><INPUT TYPE="submit" VALUE="Get Report">
diff --git a/httemplate/search/report_tax.html b/httemplate/search/report_tax.html
index a7beb2471..7bf681b42 100755
--- a/httemplate/search/report_tax.html
+++ b/httemplate/search/report_tax.html
@@ -9,8 +9,8 @@
<HR>
<FORM ACTION="report_tax.cgi" METHOD="post">
Return <B>tax report</B> for period:
- from <INPUT TYPE="text" NAME="beginning">
- to <INPUT TYPE="text" NAME="ending">
+ from <INPUT TYPE="text" NAME="beginning"> <i>m/d/y</i>
+ to <INPUT TYPE="text" NAME="ending"> <i>m/d/y</i>
<P><INPUT TYPE="submit" VALUE="Get Report">
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi
index 95f1a0af8..53d7bc051 100755
--- a/httemplate/view/cust_bill.cgi
+++ b/httemplate/view/cust_bill.cgi
@@ -22,6 +22,8 @@ print qq!<A HREF="${p}edit/cust_pay.cgi?$invnum">Enter payments (check/cash) aga
print qq!<A HREF="${p}misc/print-invoice.cgi?$invnum">Reprint this invoice</A>!. '<BR><BR>';
+#false laziness with search/cust_bill_event.cgi
+
print table(). '<TR><TH>Event</TH><TH>Date</TH><TH>Status</TH></TR>';
foreach my $cust_bill_event (
sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event