summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Record.pm35
-rw-r--r--FS/FS/cust_main.pm2
-rw-r--r--FS/FS/part_pkg/base_rate.pm102
-rwxr-xr-xFS/FS/svc_broadband.pm6
-rwxr-xr-xFS/bin/freeside-delete-addr_blocks31
-rw-r--r--FS/t/cust_pkg_option.t5
6 files changed, 4 insertions, 177 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 94cc356e5..4efaeffdc 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1338,41 +1338,6 @@ sub ut_floatn {
}
}
-=item ut_sfloat COLUMN
-
-Check/untaint signed floating point numeric data: 1.1, 1, 1.1e10, 1e10.
-May not be null. If there is an error, returns the error, otherwise returns
-false.
-
-=cut
-
-sub ut_sfloat {
- my($self,$field)=@_ ;
- ($self->getfield($field) =~ /^(-?\d+\.\d+)$/ ||
- $self->getfield($field) =~ /^(-?\d+)$/ ||
- $self->getfield($field) =~ /^(-?\d+\.\d+[eE]-?\d+)$/ ||
- $self->getfield($field) =~ /^(-?\d+[eE]-?\d+)$/)
- or return "Illegal or empty (float) $field: ". $self->getfield($field);
- $self->setfield($field,$1);
- '';
-}
-=item ut_sfloatn COLUMN
-
-Check/untaint signed floating point numeric data: 1.1, 1, 1.1e10, 1e10. May be
-null. If there is an error, returns the error, otherwise returns false.
-
-=cut
-
-sub ut_sfloatn {
- my( $self, $field ) = @_;
- if ( $self->getfield($field) =~ /^()$/ ) {
- $self->setfield($field,'');
- '';
- } else {
- $self->ut_sfloat($field);
- }
-}
-
=item ut_snumber COLUMN
Check/untaint signed numeric data (whole numbers). If there is an error,
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index d775e75d6..08b8c3749 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -4713,7 +4713,7 @@ sub batch_charge {
=item notify CUSTOMER_OBJECT TEMPLATE_NAME OPTIONS
-Sends a templated email notification to the customer (see L<Text::Template>).
+Sends a templated email notification to the customer (see L<Text::Template).
OPTIONS is a hash and may include
diff --git a/FS/FS/part_pkg/base_rate.pm b/FS/FS/part_pkg/base_rate.pm
deleted file mode 100644
index 9e64184ab..000000000
--- a/FS/FS/part_pkg/base_rate.pm
+++ /dev/null
@@ -1,102 +0,0 @@
-package FS::part_pkg::base_rate;
-
-use strict;
-use vars qw(@ISA %info);
-#use FS::Record qw(qsearch);
-use FS::part_pkg;
-
-@ISA = qw(FS::part_pkg);
-
-%info = (
- 'name' => 'Base rate (anniversary billing, Times units ordered)',
- 'fields' => {
- 'setup_fee' => { 'name' => 'Setup fee for this package',
- 'default' => 0,
- },
- 'recur_fee' => { 'name' => 'Recurring Base fee for this package',
- 'default' => 0,
- },
- 'unused_credit' => { 'name' => 'Credit the customer for the unused portion'.
- ' of service at cancellation',
- 'type' => 'checkbox',
- },
- 'externalid' => { 'name' => 'Optional External ID',
- 'default' => '',
- },
- },
- 'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit',
- 'externalid' ],
- 'weight' => 10,
-);
-
-sub calc_setup {
- my($self, $cust_pkg, $sdate, $details ) = @_;
-
- my $i = 0;
- my $count = $self->option( 'additional_count', 'quiet' ) || 0;
- while ($i < $count) {
- push @$details, $self->option( 'additional_info' . $i++ );
- }
-
- $self->option('setup_fee');
-}
-
-sub calc_recur {
- my($self, $cust_pkg) = @_;
- $self->reset_usage($cust_pkg);
- $self->base_recur($cust_pkg);
-}
-
-sub base_recur {
- my($self, $cust_pkg) = @_;
- my $units = $cust_pkg->option('units') ? $cust_pkg->option('units') : 1 ;
- # default to 1 if not found
- sprintf("%.2f",
- ($self->option('recur_fee') * $units )
- );
-}
-
-sub calc_remain {
- my ($self, $cust_pkg) = @_;
- my $time = time; #should be able to pass this in for credit calculation
- my $next_bill = $cust_pkg->getfield('bill') || 0;
- my $last_bill = $cust_pkg->last_bill || 0;
- return 0 if ! $self->base_recur
- || ! $self->option('unused_credit', 1)
- || ! $last_bill
- || ! $next_bill
- || $next_bill < $time;
-
- my %sec = (
- 'h' => 3600, # 60 * 60
- 'd' => 86400, # 60 * 60 * 24
- 'w' => 604800, # 60 * 60 * 24 * 7
- 'm' => 2629744, # 60 * 60 * 24 * 365.2422 / 12
- );
-
- $self->freq =~ /^(\d+)([hdwm]?)$/
- or die 'unparsable frequency: '. $self->freq;
- my $freq_sec = $1 * $sec{$2||'m'};
- return 0 unless $freq_sec;
-
- sprintf("%.2f", $self->base_recur * ( $next_bill - $time ) / $freq_sec );
-
-}
-
-sub is_free_options {
- qw( setup_fee recur_fee );
-}
-
-sub is_prepaid {
- 0; #no, we're postpaid
-}
-
-sub reset_usage {
- my($self, $cust_pkg) = @_;
- my %values = map { $_, $self->option($_) }
- grep { $self->option($_, 'hush') }
- qw(seconds upbytes downbytes totalbytes);
- $cust_pkg->set_usage(\%values);
-}
-
-1;
diff --git a/FS/FS/svc_broadband.pm b/FS/FS/svc_broadband.pm
index 07821f9f5..ab97ac82c 100755
--- a/FS/FS/svc_broadband.pm
+++ b/FS/FS/svc_broadband.pm
@@ -200,9 +200,9 @@ sub check {
|| $self->ut_ipn('ip_addr')
|| $self->ut_hexn('mac_addr')
|| $self->ut_hexn('auth_key')
- || $self->ut_sfloatn('latitude')
- || $self->ut_sfloatn('longitude')
- || $self->ut_sfloatn('altitude')
+ || $self->ut_floatn('latitude')
+ || $self->ut_floatn('longitude')
+ || $self->ut_floatn('altitude')
|| $self->ut_textn('vlan_profile')
;
return $error if $error;
diff --git a/FS/bin/freeside-delete-addr_blocks b/FS/bin/freeside-delete-addr_blocks
deleted file mode 100755
index a7e99766a..000000000
--- a/FS/bin/freeside-delete-addr_blocks
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/perl -Tw
-
-use strict;
-use vars qw( $user $block @blocks );
-use FS::UID qw(adminsuidsetup);
-use FS::Record qw(qsearch);
-use FS::addr_block;
-use FS::svc_broadband;
-
-$user = shift or die &usage;
-&adminsuidsetup( $user );
-
-@blocks = qsearch('addr_block', {} );
-die "No address blocks" unless (scalar(@blocks) > 0);
-
-foreach $block (@blocks) {
- my @devices = qsearch('svc_broadband', { 'blocknum' => $block->blocknum } );
- if (@devices) {
- print "Skipping block " . $block->ip_gateway . " / " . $block->ip_netmask;
- print "\n";
- }else{
- print "Deleting block " . $block->ip_gateway . " / " . $block->ip_netmask;
- print "\n";
- $block->delete;
- }
-}
-
-
-sub usage {
- "Usage:\n freeside-delete-addr_blocks user \n";
-}
diff --git a/FS/t/cust_pkg_option.t b/FS/t/cust_pkg_option.t
deleted file mode 100644
index 12314bf80..000000000
--- a/FS/t/cust_pkg_option.t
+++ /dev/null
@@ -1,5 +0,0 @@
-BEGIN { $| = 1; print "1..1\n" }
-END {print "not ok 1\n" unless $loaded;}
-use FS::cust_pkg_option;
-$loaded=1;
-print "ok 1\n";