[freeside-commits] branch master updated. c9f53f211971dc68e3f67cd94df6138a88436bc4

Jonathan Prykop jonathan at 420.am
Tue Apr 19 13:28:35 PDT 2016


The branch, master has been updated
       via  c9f53f211971dc68e3f67cd94df6138a88436bc4 (commit)
      from  e498e76c74a2e65e1c0b6a5514130ff71cee8a5b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c9f53f211971dc68e3f67cd94df6138a88436bc4
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Apr 19 15:27:53 2016 -0500

    RT#41501: OBH: Separate credit additional info into separate field on reports

diff --git a/FS/FS/reason_Mixin.pm b/FS/FS/reason_Mixin.pm
index 9c436ab..a1b32f2 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 2241f02..dbf0ff3 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 b9bbc4d..0cdd8de 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 3ef88bd..1d5f8d2 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 18731d1..8a8b413 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(),
               ;
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/reason_Mixin.pm                              |   31 +++++++++++++++-----
 httemplate/search/cust_credit.html                 |   11 +++++--
 httemplate/search/cust_credit_bill_pkg.html        |   10 +++++--
 httemplate/search/cust_credit_source_bill_pkg.html |    2 +-
 httemplate/search/cust_credit_void.html            |   10 +++++--
 5 files changed, 49 insertions(+), 15 deletions(-)




More information about the freeside-commits mailing list