[freeside-commits] branch master updated. 39dc3ac864bac4509c54900d952ef759b2102fb1

Mark Wells mark at 420.am
Tue Apr 10 17:48:33 PDT 2012


The branch, master has been updated
       via  39dc3ac864bac4509c54900d952ef759b2102fb1 (commit)
      from  546fbb0c5054566e4916852403bff5f62827adf4 (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 39dc3ac864bac4509c54900d952ef759b2102fb1
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Apr 10 17:48:24 2012 -0700

    add special format for display_custnum prefix, #16815

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 2a76a15..d342e74 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3883,6 +3883,15 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'cust_main-custnum-display_special',
+    'section'     => 'UI',
+    'description' => 'Use this customer number prefix format',
+    'type'        => 'select',
+    'select_hash' => [ '' => '',
+                       'CoStCl' => 'CoStCl (country, state, class name)' ],
+  },
+
+  {
     'key'         => 'cust_main-custnum-display_length',
     'section'     => 'UI',
     'description' => 'Zero fill the customer number to this many digits for display purposes.',
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 7d1a156..1e0e6d3 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -3962,12 +3962,25 @@ cust_main-default_agent_custid is set and it has a value, custnum otherwise.
 
 sub display_custnum {
   my $self = shift;
+
+  my $prefix = $conf->config('cust_main-custnum-display_prefix') || '';
+  if ( my $special = $conf->config('cust_main-custnum-display_special') ) {
+    if ( $special eq 'CoStCl' ) {
+      $prefix = uc( join('',
+        $self->country,
+        ($self->state =~ /^(..)/),
+        ($self->classnum ? $self->cust_class->classname =~ /^(..)/ : '__')
+      ) );
+    }
+    # add any others here if needed
+  }
+
   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') ) {
+  } elsif ( $prefix ) {
     $length = 8 if !defined($length);
-    return $conf->config('cust_main-custnum-display_prefix').
+    return $prefix . 
            sprintf('%0'.$length.'d', $self->custnum)
   } elsif ( $length ) {
     return sprintf('%0'.$length.'d', $self->custnum);

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

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




More information about the freeside-commits mailing list