[freeside-commits] freeside/FS/FS Conf.pm, 1.180.2.4, 1.180.2.5 part_pkg.pm, 1.56.2.1, 1.56.2.2 part_svc.pm, 1.30, 1.30.2.1 svc_acct.pm, 1.217.2.5, 1.217.2.6
Jeff Finucane,420,,
jeff at wavetail.420.am
Wed Apr 11 20:18:26 PDT 2007
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv8008/FS/FS
Modified Files:
Tag: FREESIDE_1_7_BRANCH
Conf.pm part_pkg.pm part_svc.pm svc_acct.pm
Log Message:
input and output on data volume fields specified with k,m,g,or t (backport)
Index: part_svc.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_svc.pm,v
retrieving revision 1.30
retrieving revision 1.30.2.1
diff -u -d -r1.30 -r1.30.2.1
--- part_svc.pm 29 Dec 2006 08:51:32 -0000 1.30
+++ part_svc.pm 12 Apr 2007 03:18:24 -0000 1.30.2.1
@@ -145,9 +145,11 @@
my $flag = $self->getfield($svcdb.'__'.$field.'_flag');
#if ( uc($flag) =~ /^([DFMAX])$/ ) {
if ( uc($flag) =~ /^([A-Z])$/ ) { #part_svc_column will test it
+ my $parser = FS::part_svc->svc_table_fields($svcdb)->{$field}->{parse}
+ || sub { shift };
$part_svc_column->setfield('columnflag', $1);
$part_svc_column->setfield('columnvalue',
- $self->getfield($svcdb.'__'.$field)
+ &$parser($self->getfield($svcdb.'__'.$field))
);
if ( $previous ) {
$error = $part_svc_column->replace($previous);
@@ -264,9 +266,11 @@
my $flag = $new->getfield($svcdb.'__'.$field.'_flag');
#if ( uc($flag) =~ /^([DFMAX])$/ ) {
if ( uc($flag) =~ /^([A-Z])$/ ) { #part_svc_column will test it
+ my $parser = FS::part_svc->svc_table_fields($svcdb)->{$field}->{parse}
+ || sub { shift };
$part_svc_column->setfield('columnflag', $1);
$part_svc_column->setfield('columnvalue',
- $new->getfield($svcdb.'__'.$field)
+ &$parser($new->getfield($svcdb.'__'.$field))
);
if ( $previous ) {
$error = $part_svc_column->replace($previous);
Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.56.2.1
retrieving revision 1.56.2.2
diff -u -d -r1.56.2.1 -r1.56.2.2
--- part_pkg.pm 15 Mar 2007 20:54:37 -0000 1.56.2.1
+++ part_pkg.pm 12 Apr 2007 03:18:24 -0000 1.56.2.2
@@ -817,6 +817,39 @@
\%plans;
}
+=item format OPTION DATA
+
+Returns data formatted according to the function 'format' described
+in the plan info. Returns DATA if no such function exists.
+
+=cut
+
+sub format {
+ my ($self, $option, $data) = (shift, shift, shift);
+ if (exists($plans{$self->plan}->{fields}->{$option}{format})) {
+ &{$plans{$self->plan}->{fields}->{$option}{format}}($data);
+ }else{
+ $data;
+ }
+}
+
+=item prase OPTION DATA
+
+Returns data parsed according to the function 'parse' described
+in the plan info. Returns DATA if no such function exists.
+
+=cut
+
+sub parse {
+ my ($self, $option, $data) = (shift, shift, shift);
+ if (exists($plans{$self->plan}->{fields}->{$option}{parse})) {
+ &{$plans{$self->plan}->{fields}->{$option}{parse}}($data);
+ }else{
+ $data;
+ }
+}
+
+
=back
=head1 NEW PLAN CLASSES
Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.180.2.4
retrieving revision 1.180.2.5
diff -u -d -r1.180.2.4 -r1.180.2.5
--- Conf.pm 10 Apr 2007 01:30:38 -0000 1.180.2.4
+++ Conf.pm 12 Apr 2007 03:18:24 -0000 1.180.2.5
@@ -2063,6 +2063,20 @@
'type' => 'checkbox',
},
+ {
+ 'key' => 'datavolume-forcemegabytes',
+ 'section' => 'UI',
+ 'description' => 'All data volumes are expressed in megabytes',
+ 'type' => 'checkbox',
+ },
+
+ {
+ 'key' => 'datavolume-significantdigits',
+ 'section' => 'UI',
+ 'description' => 'number of significant digits to use to represent data volumes',
+ 'type' => 'text',
+ },
+
);
1;
Index: svc_acct.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_acct.pm,v
retrieving revision 1.217.2.5
retrieving revision 1.217.2.6
diff -u -d -r1.217.2.5 -r1.217.2.6
--- svc_acct.pm 11 Apr 2007 04:29:48 -0000 1.217.2.5
+++ svc_acct.pm 12 Apr 2007 03:18:24 -0000 1.217.2.6
@@ -290,6 +290,53 @@
disable_inventory => 1,
disable_select => 1,
},
+ 'upbytes' => { label => 'Upload',
+ type => 'text',
+ disable_inventory => 1,
+ disable_select => 1,
+ 'format' => \&FS::UI::Web::display_bytecount,
+ 'parse' => \&FS::UI::Web::parse_bytecount,
+ },
+ 'downbytes' => { label => 'Download',
+ type => 'text',
+ disable_inventory => 1,
+ disable_select => 1,
+ 'format' => \&FS::UI::Web::display_bytecount,
+ 'parse' => \&FS::UI::Web::parse_bytecount,
+ },
+ 'totalbytes'=> { label => 'Total up and download',
+ type => 'text',
+ disable_inventory => 1,
+ disable_select => 1,
+ 'format' => \&FS::UI::Web::display_bytecount,
+ 'parse' => \&FS::UI::Web::parse_bytecount,
+ },
+ 'seconds_threshold' => { label => 'Seconds',
+ type => 'text',
+ disable_inventory => 1,
+ disable_select => 1,
+ },
+ 'upbytes_threshold' => { label => 'Upload',
+ type => 'text',
+ disable_inventory => 1,
+ disable_select => 1,
+ 'format' => \&FS::UI::Web::display_bytecount,
+ 'parse' => \&FS::UI::Web::parse_bytecount,
+ },
+ 'downbytes_threshold' => { label => 'Download',
+ type => 'text',
+ disable_inventory => 1,
+ disable_select => 1,
+ 'format' => \&FS::UI::Web::display_bytecount,
+ 'parse' => \&FS::UI::Web::parse_bytecount,
+ },
+ 'totalbytes_threshold'=> { label => 'Total up and download',
+ type => 'text',
+ disable_inventory => 1,
+ disable_select => 1,
+ 'format' => \&FS::UI::Web::display_bytecount,
+ 'parse' => \&FS::UI::Web::parse_bytecount,
+ },
},
};
}
More information about the freeside-commits
mailing list