[freeside-commits] branch master updated. 4c886d5b7b118382dd021636ecb3de2ce275e7c1

Ivan ivan at 420.am
Thu Oct 11 14:45:21 PDT 2012


The branch, master has been updated
       via  4c886d5b7b118382dd021636ecb3de2ce275e7c1 (commit)
      from  f5540dd87ad191257c3c1364993fc275bb68c881 (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 4c886d5b7b118382dd021636ecb3de2ce275e7c1
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Oct 11 14:45:20 2012 -0700

    show application date if over 24 hours after (or before) payment/credit date, RT#19217

diff --git a/FS/FS/cust_bill_ApplicationCommon.pm b/FS/FS/cust_bill_ApplicationCommon.pm
index cb07050..d8ccdd0 100644
--- a/FS/FS/cust_bill_ApplicationCommon.pm
+++ b/FS/FS/cust_bill_ApplicationCommon.pm
@@ -1,9 +1,11 @@
 package FS::cust_bill_ApplicationCommon;
 
 use strict;
-use vars qw( @ISA $DEBUG $me $skip_apply_to_lineitems_hack );
+use vars qw( @ISA $DEBUG $me $skip_apply_to_lineitems_hack $date_format );
 use List::Util qw(min);
+use Date::Format;
 use FS::Schema qw( dbdef );
+use FS::UID;
 use FS::Record qw( qsearch qsearchs dbh );
 use FS::cust_pkg;
 use FS::cust_svc;
@@ -18,6 +20,11 @@ $me = '[FS::cust_bill_ApplicationCommon]';
 
 $skip_apply_to_lineitems_hack = 0;
 
+FS::UID->install_callback( sub { 
+  my $conf = new FS::Conf;
+  $date_format = $conf->config('date_format') || '%x'; #/YY
+} );
+
 =head1 NAME
 
 FS::cust_bill_ApplicationCommon - Base class for bill application classes
@@ -500,7 +507,34 @@ Returns a string representing the invoice (see L<FS::cust_bill>), for example:
 
 sub applied_to_invoice {
   my $self = shift;
-  'applied to '. $self->cust_bill->invnum_date_pretty;
+  my $string = 'applied to '. $self->cust_bill->invnum_date_pretty;
+
+  #show application date if over 24 hours after (or before) payment/credit date
+  $string .= ' on '. $self->_date_pretty
+    if abs( $self->_date - $self->_app_source_object->_date ) > 86400;
+
+  $string;
+}
+
+=item _app_source_object 
+
+=cut
+
+sub _app_source_object {
+  my $self = shift;
+  my $source_table = $self->_app_source_table;
+  $self->$source_table();
+}
+
+=item _date_pretty
+
+Returns a string with the application date, for example: "3/20/2008"
+
+=cut
+
+sub _date_pretty {
+  my $self = shift;
+  time2str($date_format, $self->_date);
 }
 
 =item lineitem_breakdown_table 

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

Summary of changes:
 FS/FS/cust_bill_ApplicationCommon.pm |   38 ++++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list