[freeside-commits] branch FREESIDE_3_BRANCH updated. 97ec2961fb6f1a284748034e324f4118d7ced574

Mark Wells mark at 420.am
Thu May 15 19:22:29 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  97ec2961fb6f1a284748034e324f4118d7ced574 (commit)
      from  26cd0bcebfd35aa805162718a2e27206ff65e4e4 (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 97ec2961fb6f1a284748034e324f4118d7ced574
Author: Mark Wells <mark at freeside.biz>
Date:   Thu May 15 19:16:11 2014 -0700

    allow non-integer minutes in CDR usage pools, #5738, see also #28308

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 47f3bd8..ad1f72f 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -1720,7 +1720,7 @@ sub list_svcs {
     my $tag = $part->description . ($part->shared ? 1 : 0);
     my $row = $usage_pools{$tag} 
           ||= [ $part->description, 0, 0, $part->shared ? 1 : 0 ];
-    $row->[1] += $_->minutes; # minutes remaining
+    $row->[1] += sprintf('%.1f', $_->minutes); # minutes remaining
     $row->[2] += $part->minutes; # minutes total
   }
 
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 9f30f80..360a382 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1944,7 +1944,7 @@ sub tables_hashref {
       'columns' => [
         'pkgusagenum', 'serial', '', '', '', '',
         'pkgnum',         'int', '', '', '', '',
-        'minutes',        'int', '', '', '', '',
+        'minutes',        'double precision', '', '', '', '',
         'pkgusagepart',   'int', '', '', '', '',
       ],
       'primary_key' => 'pkgusagenum',
@@ -1957,7 +1957,7 @@ sub tables_hashref {
         'cdrusagenum', 'bigserial', '', '', '', '',
         'acctid',      'bigint',    '', '', '', '',
         'pkgusagenum', 'int',       '', '', '', '',
-        'minutes',     'int',       '', '', '', '',
+        'minutes',     'double precision',       '', '', '', '',
       ],
       'primary_key' => 'cdrusagenum',
       'unique' => [],
@@ -3285,7 +3285,7 @@ sub tables_hashref {
       'columns' => [
         'pkgusagepart', 'serial',   '', '', '', '',
         'pkgpart',  'int',      '', '', '', '',
-        'minutes',  'int',      '', '', '', '',
+        'minutes',  'double precision',      '', '', '', '',
         'priority', 'int',  'NULL', '', '', '',
         'shared',   'char', 'NULL',  1, '', '',
         'rollover', 'char', 'NULL',  1, '', '',
diff --git a/FS/FS/cdr_cust_pkg_usage.pm b/FS/FS/cdr_cust_pkg_usage.pm
index 6ef7f2d..8fa378f 100644
--- a/FS/FS/cdr_cust_pkg_usage.pm
+++ b/FS/FS/cdr_cust_pkg_usage.pm
@@ -87,7 +87,7 @@ sub check {
     $self->ut_numbern('cdrusagenum')
     || $self->ut_foreign_key('acctid', 'cdr', 'acctid')
     || $self->ut_foreign_key('pkgusagenum', 'cust_pkg_usage', 'pkgusagenum')
-    || $self->ut_number('minutes')
+    || $self->ut_float('minutes')
   ;
   return $error if $error;
 
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 2a41bb6..a1f2cb1 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -4052,7 +4052,7 @@ sub apply_usage {
         minutes     => min($cust_pkg_usage->minutes, $minutes),
     });
     $cust_pkg_usage->set('minutes',
-      sprintf('%.0f', $cust_pkg_usage->minutes - $cdr_cust_pkg_usage->minutes)
+      $cust_pkg_usage->minutes - $cdr_cust_pkg_usage->minutes
     );
     $error = $cust_pkg_usage->replace || $cdr_cust_pkg_usage->insert;
     $minutes -= $cdr_cust_pkg_usage->minutes;
diff --git a/FS/FS/cust_pkg_usage.pm b/FS/FS/cust_pkg_usage.pm
index 0eefd74..10fc2e9 100644
--- a/FS/FS/cust_pkg_usage.pm
+++ b/FS/FS/cust_pkg_usage.pm
@@ -119,7 +119,7 @@ sub check {
   my $error = 
     $self->ut_numbern('pkgusagenum')
     || $self->ut_foreign_key('pkgnum', 'cust_pkg', 'pkgnum')
-    || $self->ut_numbern('minutes')
+    || $self->ut_floatn('minutes')
     || $self->ut_foreign_key('pkgusagepart', 'part_pkg_usage', 'pkgusagepart')
   ;
   return $error if $error;
diff --git a/FS/FS/part_pkg_usage.pm b/FS/FS/part_pkg_usage.pm
index 99014d3..5e6bcf4 100644
--- a/FS/FS/part_pkg_usage.pm
+++ b/FS/FS/part_pkg_usage.pm
@@ -117,7 +117,7 @@ sub check {
   my $error = 
     $self->ut_numbern('pkgusagepart')
     || $self->ut_foreign_key('pkgpart', 'part_pkg', 'pkgpart')
-    || $self->ut_number('minutes')
+    || $self->ut_float('minutes')
     || $self->ut_numbern('priority')
     || $self->ut_flag('shared')
     || $self->ut_flag('rollover')
diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html
index 078402b..bc619f8 100644
--- a/httemplate/view/cust_main/packages/package.html
+++ b/httemplate/view/cust_main/packages/package.html
@@ -283,7 +283,7 @@
 %     $trstyle = ' CLASS="shared"' if $part->shared;
     <TR<%$trstyle%>>
       <TD ALIGN="right"><% $part->description %>: </TD>
-      <TD <%$color%> ALIGN="right"><% $usage->minutes %></TD>
+      <TD <%$color%> ALIGN="right"><% sprintf('%.1f', $usage->minutes) %></TD>
       <TD <%$color%>> / </TD>
       <TD <%$color%>><% $part->minutes %></TD>
 %     if ( $part->shared ) {

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

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm                    |    2 +-
 FS/FS/Schema.pm                                 |    6 +++---
 FS/FS/cdr_cust_pkg_usage.pm                     |    2 +-
 FS/FS/cust_pkg.pm                               |    2 +-
 FS/FS/cust_pkg_usage.pm                         |    2 +-
 FS/FS/part_pkg_usage.pm                         |    2 +-
 httemplate/view/cust_main/packages/package.html |    2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)




More information about the freeside-commits mailing list