diff options
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_credit_void.pm | 2 | ||||
-rw-r--r-- | FS/FS/reason_Mixin.pm | 31 |
2 files changed, 25 insertions, 8 deletions
diff --git a/FS/FS/cust_credit_void.pm b/FS/FS/cust_credit_void.pm index 8d06a72f1..6b9674a8e 100644 --- a/FS/FS/cust_credit_void.pm +++ b/FS/FS/cust_credit_void.pm @@ -1,7 +1,7 @@ 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; 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. |