[freeside-commits] freeside/FS/FS cdr.pm, 1.76, 1.77 cust_bill_pkg.pm, 1.65, 1.66 part_pkg.pm, 1.127, 1.128 svc_pbx.pm, 1.12, 1.13 svc_phone.pm, 1.40, 1.41

Mark Wells mark at wavetail.420.am
Tue Dec 13 12:40:30 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv25338/FS/FS

Modified Files:
	cdr.pm cust_bill_pkg.pm part_pkg.pm svc_pbx.pm svc_phone.pm 
Log Message:
CDR type separation and summary formats, #15535

Index: svc_phone.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_phone.pm,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -w -d -r1.40 -r1.41
--- svc_phone.pm	18 Nov 2011 00:09:50 -0000	1.40
+++ svc_phone.pm	13 Dec 2011 20:40:28 -0000	1.41
@@ -658,6 +658,10 @@
 =item default_prefix => "XXX": Also accept the phone number of the service prepended 
 with the chosen prefix.
 
+=item begin, end: Start and end of a date range, as unix timestamp.
+
+=item cdrtypenum: Only return CDRs with this type number.
+
 =item disable_src => 1: Only match on "charged_party", not "src".
 
 =item by_svcnum: not supported for svc_phone
@@ -697,6 +701,10 @@
       if exists($options{'status'});
   }
   
+  if ($options{'cdrtypenum'}) {
+    $hash{'cdrtypenum'} = $options{'cdrtypenum'};
+  }
+  
   my $for_update = $options{'for_update'} ? 'FOR UPDATE' : '';
 
   my $number = $self->phonenum;

Index: cust_bill_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill_pkg.pm,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -w -d -r1.65 -r1.66
--- cust_bill_pkg.pm	6 Dec 2011 01:02:54 -0000	1.65
+++ cust_bill_pkg.pm	13 Dec 2011 20:40:28 -0000	1.66
@@ -916,9 +916,9 @@
 
     my %seen = ();
     foreach my $detail ( grep { ref($_) } @{$self->get('details')} ) {
-      $seen{ ref($detail) eq 'HASH'
+      $seen{ (ref($detail) eq 'HASH'
                ? $detail->{'classnum'}
-               : $detail->[3]
+               : $detail->[3]) || ''
            } = 1;
     }
     keys %seen;

Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -w -d -r1.127 -r1.128
--- part_pkg.pm	14 Sep 2011 19:24:01 -0000	1.127
+++ part_pkg.pm	13 Dec 2011 20:40:28 -0000	1.128
@@ -1296,6 +1296,9 @@
 #fallback for everything except bulk.pm
 sub hide_svc_detail { 0; }
 
+#fallback for packages that can't/won't summarize usage
+sub sum_usage { 0; }
+
 =item recur_cost_permonth CUST_PKG
 
 recur_cost divided by freq (only supported for monthly and longer frequencies)

Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -w -d -r1.76 -r1.77
--- cdr.pm	18 Nov 2011 00:09:50 -0000	1.76
+++ cdr.pm	13 Dec 2011 20:40:27 -0000	1.77
@@ -573,6 +573,14 @@
     'name'           => 'Default with description field as destination',
     'invoice_header' => 'Caller,Date,Time,Number,Destination,Duration,Price',
   },
+  'sum_duration' => {
+    'name'           => 'Summary (one line per service, with duration)',
+    'invoice_header' => 'Caller,Calls,Minutes,Price',
+  },
+  'sum_count' => {
+    'name'           => 'Summary (one line per service, with count)',
+    'invoice_header' => 'Caller,Messages,Price',
+  },
 );
 
 my %export_formats = ();
@@ -622,6 +630,19 @@
       #sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
       sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; }, #PRICE
     ],
+    'sum_duration' => [ 
+      # for summary formats, the CDR is a fictitious object containing the 
+      # total billsec and the phone number of the service
+      'src',
+      sub { my($cdr, %opt) = @_; $opt{count} },
+      sub { my($cdr, %opt) = @_; int($opt{seconds}/60).'m' },
+      sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; },
+    ],
+    'sum_count' => [
+      'src',
+      sub { my($cdr, %opt) = @_; $opt{count} },
+      sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; },
+    ],
     'basic' => [
       sub { time2str('%d %b - %I:%M %p', shift->calldate_unix) },
       'dst',
@@ -672,6 +693,8 @@
 
 =item downstream_csv OPTION => VALUE ...
 
+Returns a string of formatted call details for display on an invoice.
+
 Options:
 
 format

Index: svc_pbx.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_pbx.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -d -r1.12 -r1.13
--- svc_pbx.pm	21 Mar 2011 00:52:33 -0000	1.12
+++ svc_pbx.pm	13 Dec 2011 20:40:28 -0000	1.13
@@ -283,6 +283,10 @@
 =item by_svcnum => 1: Select CDRs where the svcnum field matches, instead of 
 title/charged_party.  Normally this field is set after processing.
 
+=item begin, end: Start and end of date range, as unix timestamp.
+
+=item cdrtypenum: Only return CDRs with this type number.
+
 =back
 
 =cut
@@ -296,6 +300,10 @@
   $hash{'freesidestatus'} = $options{'status'}
     if exists($options{'status'});
   
+  if ($options{'cdrtypenum'}) {
+    $hash{'cdrtypenum'} = $options{'cdrtypenum'};
+  }
+
   my $for_update = $options{'for_update'} ? 'FOR UPDATE' : '';
 
   if ( $options{'by_svcnum'} ) {



More information about the freeside-commits mailing list