summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-04-19 15:27:53 -0500
committerJonathan Prykop <jonathan@freeside.biz>2016-04-19 15:27:53 -0500
commitc9f53f211971dc68e3f67cd94df6138a88436bc4 (patch)
treec252f1d134ec0a52296a656ece93d5cb69bdc0aa
parente498e76c74a2e65e1c0b6a5514130ff71cee8a5b (diff)
RT#41501: OBH: Separate credit additional info into separate field on reports
-rw-r--r--FS/FS/reason_Mixin.pm31
-rwxr-xr-xhttemplate/search/cust_credit.html11
-rw-r--r--httemplate/search/cust_credit_bill_pkg.html10
-rw-r--r--httemplate/search/cust_credit_source_bill_pkg.html2
-rwxr-xr-xhttemplate/search/cust_credit_void.html10
5 files changed, 49 insertions, 15 deletions
diff --git a/FS/FS/reason_Mixin.pm b/FS/FS/reason_Mixin.pm
index 9c436ab1e..a1b32f2b5 100644
--- a/FS/FS/reason_Mixin.pm
+++ b/FS/FS/reason_Mixin.pm
@@ -22,13 +22,8 @@ voided payment / voided invoice. This can no longer be used to set the
sub reason {
my $self = shift;
- my $reason_text;
- if ( $self->reasonnum ) {
- my $reason = FS::reason->by_key($self->reasonnum);
- $reason_text = $reason->reason;
- } else { # in case one of these somehow still exists
- $reason_text = $self->get('reason');
- }
+ my $reason_text = $self->reason_only;
+
if ( $self->get('addlinfo') ) {
$reason_text .= ' ' . $self->get('addlinfo');
}
@@ -36,6 +31,28 @@ sub reason {
return $reason_text;
}
+=item reason_only
+
+Returns only the text of the associated reason,
+absent any addlinfo that is included by L</reason>.
+(Currently only affects credit and credit void reasons.)
+
+=cut
+
+# a bit awkward, but much easier to invoke this in the few reports
+# that need separate fields than to update every place
+# that displays them together
+
+sub reason_only {
+ my $self = shift;
+ if ( $self->reasonnum ) {
+ my $reason = FS::reason->by_key($self->reasonnum);
+ return $reason->reason;
+ } else { # in case one of these somehow still exists
+ return $self->get('reason');
+ }
+}
+
# Used by FS::Upgrade to migrate reason text fields to reasonnum.
# Note that any new tables that get reasonnum fields do NOT need to be
# added here unless they have previously had a free-text "reason" field.
diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html
index 2241f02e3..dbf0ff333 100755
--- a/httemplate/search/cust_credit.html
+++ b/httemplate/search/cust_credit.html
@@ -56,24 +56,29 @@ if ($unapplied) {
push @header, emt('Date'),
emt('By'),
emt('Reason'),
+ emt('Info'),
;
push @fields, sub { time2str('%b %d %Y', shift->_date ) },
'otaker',
- 'reason',
+ 'reason_only',
+ 'addlinfo',
;
-push @sort_fields, '_date', 'otaker', 'reason';
-$align .= 'rll';
+push @sort_fields, '_date', 'otaker', 'reasonnum', 'addlinfo';
+$align .= 'rlll';
push @links, '',
'',
'',
+ '',
;
push @color, '',
'',
'',
+ '',
;
push @style, '',
'',
'',
+ '',
;
# insert customer email after 'Reason' if this is a commission report
diff --git a/httemplate/search/cust_credit_bill_pkg.html b/httemplate/search/cust_credit_bill_pkg.html
index b9bbc4dbb..0cdd8defd 100644
--- a/httemplate/search/cust_credit_bill_pkg.html
+++ b/httemplate/search/cust_credit_bill_pkg.html
@@ -14,6 +14,7 @@
'Date',
'By',
'Reason',
+ 'Info',
# line item
'Description',
@@ -33,7 +34,8 @@
sub { time2str('%b %d %Y', shift->get('cust_credit_date') ) },
sub { shift->cust_credit_bill->cust_credit->otaker },
- sub { shift->cust_credit_bill->cust_credit->reason },
+ sub { shift->cust_credit_bill->cust_credit->reason_only },
+ sub { shift->cust_credit_bill->cust_credit->addlinfo },
sub { $_[0]->pkgnum > 0
? $_[0]->get('pkg') # possibly use override.pkg
@@ -51,6 +53,7 @@
'cust_credit_date',
'', #'otaker',
'', #reason
+ '', #addlinfo
'', #line item description
'', #location
@post_desc_null,
@@ -66,6 +69,7 @@
'',
'',
'',
+ '',
@post_desc_null,
$ilink,
$ilink,
@@ -73,7 +77,7 @@
FS::UI::Web::cust_header()
),
],
- 'align' => 'rrrllll'.
+ 'align' => 'rrrlllll'.
$post_desc_align.
'rr'.
FS::UI::Web::cust_aligns(),
@@ -85,6 +89,7 @@
'',
'',
'',
+ '',
@post_desc_null,
'',
'',
@@ -98,6 +103,7 @@
'',
'',
'',
+ '',
@post_desc_null,
'',
'',
diff --git a/httemplate/search/cust_credit_source_bill_pkg.html b/httemplate/search/cust_credit_source_bill_pkg.html
index 3ef88bdf9..1d5f8d2a0 100644
--- a/httemplate/search/cust_credit_source_bill_pkg.html
+++ b/httemplate/search/cust_credit_source_bill_pkg.html
@@ -28,7 +28,7 @@
sub { time2str('%b %d %Y', shift->get('cust_credit_date') ) },
sub { shift->cust_credit->otaker },
- sub { shift->cust_credit->reason },
+ sub { shift->cust_credit->reason }, # split into reason_only/addlinfo if addlinfo ever gets used here
sub { $_[0]->pkgnum > 0
? $_[0]->get('pkg') # possibly use override.pkg
diff --git a/httemplate/search/cust_credit_void.html b/httemplate/search/cust_credit_void.html
index 18731d144..8a8b4133e 100755
--- a/httemplate/search/cust_credit_void.html
+++ b/httemplate/search/cust_credit_void.html
@@ -47,6 +47,7 @@ push @header, emt('Void Date'),
emt('Date'),
emt('By'),
emt('Reason'),
+ emt('Info'),
FS::UI::Web::cust_header(),
;
push @fields, sub { time2str('%b %d %Y', shift->void_date ) },
@@ -54,7 +55,8 @@ push @fields, sub { time2str('%b %d %Y', shift->void_date ) },
'void_reason',
sub { time2str('%b %d %Y', shift->_date ) },
'otaker',
- 'reason',
+ 'reason_only',
+ 'addlinfo',
\&FS::UI::Web::cust_fields,
;
push @sort_fields, 'void_date',
@@ -63,14 +65,16 @@ push @sort_fields, 'void_date',
'_date',
'usernum', #ditto
'reasonnum, reason', #ditto
+ 'addlinfo',
FS::UI::Web::cust_sort_fields();
-$align .= 'rllrll'.FS::UI::Web::cust_aligns();
+$align .= 'rllrlll'.FS::UI::Web::cust_aligns();
push @links, '',
'',
'',
'',
'',
'',
+ '',
( map { $_ ne 'Cust. Status' ? $clink : '' }
FS::UI::Web::cust_header()
),
@@ -81,6 +85,7 @@ push @color, '',
'',
'',
'',
+ '',
FS::UI::Web::cust_colors(),
;
push @style, '',
@@ -89,6 +94,7 @@ push @style, '',
'',
'',
'',
+ '',
FS::UI::Web::cust_styles(),
;