package FS::cust_credit_void;
use strict;
-use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Record );
+use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::reason_Mixin FS::Record );
use FS::Record qw(qsearch qsearchs dbh fields);
use FS::CurrentUser;
use FS::access_user;
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');
}
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.
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
'Date',
'By',
'Reason',
+ 'Info',
# line item
'Description',
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
'cust_credit_date',
'', #'otaker',
'', #reason
+ '', #addlinfo
'', #line item description
'', #location
@post_desc_null,
'',
'',
'',
+ '',
@post_desc_null,
$ilink,
$ilink,
FS::UI::Web::cust_header()
),
],
- 'align' => 'rrrllll'.
+ 'align' => 'rrrlllll'.
$post_desc_align.
'rr'.
FS::UI::Web::cust_aligns(),
'',
'',
'',
+ '',
@post_desc_null,
'',
'',
'',
'',
'',
+ '',
@post_desc_null,
'',
'',
emt('Date'),
emt('By'),
emt('Reason'),
+ emt('Info'),
FS::UI::Web::cust_header(),
;
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',
'_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()
),
'',
'',
'',
+ '',
FS::UI::Web::cust_colors(),
;
push @style, '',
'',
'',
'',
+ '',
FS::UI::Web::cust_styles(),
;