summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2008-06-01 20:16:03 +0000
committerivan <ivan>2008-06-01 20:16:03 +0000
commitd1f2f7f8286ce366efe7c72b731fd3536d751ef1 (patch)
tree542a9f30ce391a61982b3a5b3560472c9095af2e
parent85c7dede23274d2cfeb1259e2ddcf46aa58a899b (diff)
backport cust_bill_ApplicationCommon::applied_to_invoice and cust_bill::invnum_date_pretty to 1.7
-rw-r--r--FS/FS/cust_bill.pm12
-rw-r--r--FS/FS/cust_bill_ApplicationCommon.pm12
-rw-r--r--httemplate/view/cust_main/payment_history.html20
3 files changed, 32 insertions, 12 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 844204d02..b5b0f4eda 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -2386,6 +2386,18 @@ sub balance_due_msg {
$msg;
}
+=item invnum_date_pretty
+
+Returns a string with the invoice number and date, for example:
+"Invoice #54 (3/20/2008)"
+
+=cut
+
+sub invnum_date_pretty {
+ my $self = shift;
+ 'Invoice #'. $self->invnum. ' ('. time2str('%x', $self->_date). ')';
+}
+
sub _items {
my $self = shift;
diff --git a/FS/FS/cust_bill_ApplicationCommon.pm b/FS/FS/cust_bill_ApplicationCommon.pm
index 24274e701..803239d04 100644
--- a/FS/FS/cust_bill_ApplicationCommon.pm
+++ b/FS/FS/cust_bill_ApplicationCommon.pm
@@ -359,6 +359,18 @@ sub cust_bill {
qsearchs( 'cust_bill', { 'invnum' => $self->invnum } );
}
+=item applied_to_invoice
+
+Returns a string representing the invoice (see L<FS::cust_bill), for example:
+"applied to Invoice #54 (3/20/2008)"
+
+=cut
+
+sub applied_to_invoice {
+ my $self = shift;
+ 'applied to '. $self->cust_bill->invnum_date_pretty;
+}
+
=item lineitem_breakdown_table
=cut
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html
index 6cf0c40d5..49c18358b 100644
--- a/httemplate/view/cust_main/payment_history.html
+++ b/httemplate/view/cust_main/payment_history.html
@@ -141,8 +141,7 @@
% #completely unapplied
% $pre = '<B><FONT COLOR="#FF0000">Unapplied ';
% $post = '</FONT></B>';
-% if ( $curuser->access_right('Apply payment') # ) {
-% || $curuser->access_right('Post payment') ) { #remove after 1.7.3
+% if ( $curuser->access_right('Apply payment') ) {
% $apply = ' ('. include( '/elements/popup_link.html',
% 'label' => 'apply',
% 'action' => "${p}edit/cust_bill_pay.cgi?".
@@ -157,7 +156,7 @@
% && scalar(@cust_pay_refund) == 0
% && $cust_pay->unapplied == 0 ) {
% #applied to one invoice, the usual situation
-% $desc = ' applied to Invoice #'. $cust_bill_pay[0]->invnum;
+% $desc = ' '. $cust_bill_pay[0]->applied_to_invoice;
% } elsif ( scalar(@cust_bill_pay) == 0
% && scalar(@cust_pay_refund) == 1
% && $cust_pay->unapplied == 0 ) {
@@ -171,7 +170,7 @@
% if ( $app->isa('FS::cust_bill_pay') ) {
% $desc .= '&nbsp;&nbsp;'.
% '$'. $app->amount.
-% ' applied to Invoice #'. $app->invnum.
+% ' '. $app->applied_to_invoice.
% '<BR>';
% #' on '. time2str("%D", $cust_bill_pay->_date).
% } elsif ( $app->isa('FS::cust_pay_refund') ) {
@@ -187,8 +186,7 @@
% $desc .= '&nbsp;&nbsp;'.
% '<B><FONT COLOR="#FF0000">$'.
% $cust_pay->unapplied. ' unapplied</FONT></B>';
-% if ( $curuser->access_right('Apply payment') # ) {
-% || $curuser->access_right('Post payment') ) { #remove after 1.7.3
+% if ( $curuser->access_right('Apply payment') ) {
% $desc = ' ('. include( '/elements/popup_link.html',
% 'label' => 'apply',
% 'action' => "${p}edit/cust_bill_pay.cgi?".
@@ -342,8 +340,7 @@
% #completely unapplied
% $pre = '<B><FONT COLOR="#FF0000">Unapplied ';
% $post = '</FONT></B>';
-% if ( $curuser->access_right('Apply credit') # ) {
-% || $curuser->access_right('Post credit') ) { #remove after 1.7.3
+% if ( $curuser->access_right('Apply credit') ) {
% $apply = ' ('. include( '/elements/popup_link.html',
% 'label' => 'apply',
% 'action' => "${p}edit/cust_credit_bill.cgi?".
@@ -358,7 +355,7 @@
% && scalar(@cust_credit_refund) == 0
% && $cust_credit->credited == 0 ) {
% #applied to one invoice, the usual situation
-% $desc = ' applied to Invoice #'. $cust_credit_bill[0]->invnum;
+% $desc = ' '. $cust_credit_bill[0]->applied_to_invoice;
% } elsif ( scalar(@cust_credit_bill) == 0
% && scalar(@cust_credit_refund) == 1
% && $cust_credit->credited == 0 ) {
@@ -372,7 +369,7 @@
% if ( $app->isa('FS::cust_credit_bill') ) {
% $desc .= '&nbsp;&nbsp;'.
% '$'. $app->amount.
-% ' applied to Invoice #'. $app->invnum.
+% ' '. $app->applied_to_invoice.
% '<BR>';
% #' on '. time2str("%D", $app->_date).
% } elsif ( $app->isa('FS::cust_credit_refund') ) {
@@ -387,8 +384,7 @@
% if ( $cust_credit->credited > 0 ) {
% $desc .= '&nbsp;&nbsp;<B><FONT COLOR="#FF0000">$'.
% $cust_credit->credited. ' unapplied</FONT></B>';
-% if ( $curuser->access_right('Apply credit') # ) {
-% || $curuser->access_right('Post credit') ) { #remove after 1.7.3
+% if ( $curuser->access_right('Apply credit') ) {
% $desc = ' ('. include( '/elements/popup_link.html',
% 'label' => 'apply',
% 'action' => "${p}edit/cust_credit_bill.cgi?".