[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 6c10ac1711ffc9d27985530d0ea39e343bc4587a

Mark Wells mark at 420.am
Thu Mar 8 14:56:41 PST 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  6c10ac1711ffc9d27985530d0ea39e343bc4587a (commit)
      from  a6433f415264da45cf5a4222779773a59a84ebf6 (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 6c10ac1711ffc9d27985530d0ea39e343bc4587a
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Mar 8 14:55:37 2012 -0800

    option to adjust zero-filling of custnum, #16815

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 4593890..8953469 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3860,12 +3860,19 @@ and customer address. Include units.',
   {
     'key'         => 'cust_main-custnum-display_prefix',
     'section'     => 'UI',
-    'description' => 'Prefix the customer number with this number for display purposes (and zero fill to 8 digits).',
+    'description' => 'Prefix the customer number with this string for display purposes.',
     'type'        => 'text',
     #and then probably agent-virt this to merge these instances
   },
 
   {
+    'key'         => 'cust_main-custnum-display_length',
+    'section'     => 'UI',
+    'description' => 'Zero fill the customer number to this many digits for display purposes.',
+    'type'        => 'text',
+  },
+
+  {
     'key'         => 'cust_main-default_areacode',
     'section'     => 'UI',
     'description' => 'Default area code for customers.',
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 9a07aac..d45af58 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -3911,11 +3911,15 @@ cust_main-default_agent_custid is set and it has a value, custnum otherwise.
 
 sub display_custnum {
   my $self = shift;
+  my $length = $conf->config('cust_main-custnum-display_length');
   if ( $conf->exists('cust_main-default_agent_custid') && $self->agent_custid ){
     return $self->agent_custid;
   } elsif ( $conf->config('cust_main-custnum-display_prefix') ) {
+    $length = 8 if !defined($length);
     return $conf->config('cust_main-custnum-display_prefix').
-           sprintf('%08d', $self->custnum)
+           sprintf('%0'.$length.'d', $self->custnum)
+  } elsif ( $length ) {
+    return sprintf('%0'.$length.'d', $self->custnum);
   } else {
     return $self->custnum;
   }

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

Summary of changes:
 FS/FS/Conf.pm      |    9 ++++++++-
 FS/FS/cust_main.pm |    6 +++++-
 2 files changed, 13 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list