add name (svc_acct.finger) to bulk billing detail, RT#3519
authorivan <ivan>
Mon, 23 Mar 2009 17:03:03 +0000 (17:03 +0000)
committerivan <ivan>
Mon, 23 Mar 2009 17:03:03 +0000 (17:03 +0000)
FS/FS/part_pkg/bulk.pm
FS/FS/svc_Common.pm
FS/FS/svc_acct.pm

index 63d344d..8095595 100644 (file)
@@ -54,7 +54,7 @@ sub calc_recur {
                                            #   END      START
   foreach my $h_svc ( $cust_pkg->h_cust_svc( $$sdate, $last_bill ) ) {
 
-    my @label = $h_svc->label( $$sdate, $last_bill );
+    my @label = $h_svc->label_long( $$sdate, $last_bill );
     die "fatal: no historical label found, wtf?" unless scalar(@label); #?
     #my $svc_details = $label[0].': '. $label[1]. ': ';
     my $svc_details = $label[1]. ': ';
index da1cfe1..869ab58 100644 (file)
@@ -151,6 +151,11 @@ sub label {
   $self->svcnum;
 }
 
+sub label_long {
+  my $self = shift;
+  $self->label(@_);
+}
+
 =item check
 
 Checks the validity of fields in this record.
index 57ef615..fcd73ac 100644 (file)
@@ -256,7 +256,7 @@ sub table_info {
                          disable_inventory => 1,
                          disable_select => 1,
                        },
-        'finger'    => 'Real name (GECOS)',
+        'finger'    => 'Real name', # (GECOS)',
         'domsvc'    => {
                          label     => 'Domain',
                          #def_label => 'svcnum from svc_domain',
@@ -446,8 +446,23 @@ sub label {
   $self->email(@_);
 }
 
+=item label_long [ END_TIMESTAMP [ START_TIMESTAMP ] ]
+
+Returns a longer string label for this acccount ("Real Name <username@domain>"
+if available, or "username@domain").
+
+END_TIMESTAMP and START_TIMESTAMP can optionally be passed when dealing with
+history records.
+
 =cut
 
+sub label_long {
+  my $self = shift;
+  ( $self->finger =~ /\S/ )
+    ? $self->finger. ' <'.$self->label(@_).'>'
+    : $self->label(@_);
+}
+
 =item insert [ , OPTION => VALUE ... ]
 
 Adds this account to the database.  If there is an error, returns the error,