summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-09-25 15:57:13 -0700
committerIvan Kohler <ivan@freeside.biz>2013-09-25 15:57:13 -0700
commitf2766e203e1aa144d046a26cf13e01e1f5b00f64 (patch)
tree2b891130d2f2a56f387a90ba45f17a2e4bf5aedb /FS
parentd046cb57be3c1a74362d15e90486239cc8a5f4d7 (diff)
parent0d81877c6ae8ea9732065f5400ff37a7458587ed (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm2
-rw-r--r--FS/FS/Report/Table.pm49
-rw-r--r--FS/FS/cust_payby.pm1
-rw-r--r--FS/FS/part_pkg.pm10
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm4
5 files changed, 29 insertions, 37 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index d63c12fa8..03280c484 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2967,7 +2967,7 @@ and customer address. Include units.',
{
'key' => 'network_monitoring_system',
'section' => 'network_monitoring',
- 'description' => 'Networking monitoring system (NMS) integration. <b>Torrus_Internal</b> uses the built-in Torrus ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Torrus_Installation">integrated networking monitoring system installation instructions</a>).',
+ 'description' => 'Networking monitoring system (NMS) integration. <b>Torrus_Internal</b> uses the built-in Torrus ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:3:Documentation:Torrus_Installation">integrated networking monitoring system installation instructions</a>).',
'type' => 'select',
'select_enum' => [ '', qw(Torrus_Internal) ],
},
diff --git a/FS/FS/Report/Table.pm b/FS/FS/Report/Table.pm
index 03ee27391..1d60b6420 100644
--- a/FS/FS/Report/Table.pm
+++ b/FS/FS/Report/Table.pm
@@ -56,12 +56,7 @@ sub signups {
push @where, "refnum = ".$opt{'refnum'};
}
- if ( $opt{'cust_classnum'} ) {
- my $classnums = $opt{'cust_classnum'};
- $classnums = [ $classnums ] if !ref($classnums);
- @$classnums = grep /^\d+$/, @$classnums;
- push @where, 'cust_main.classnum in('. join(',',@$classnums) .')';
- }
+ push @where, $self->with_cust_classnum(%opt);
$self->scalar_sql(
"SELECT COUNT(*) FROM cust_main $join WHERE ".join(' AND ', @where)
@@ -448,12 +443,7 @@ sub cust_bill_pkg_setup {
# yuck, false laziness
push @where, "cust_main.refnum = ". $opt{'refnum'} if $opt{'refnum'};
- if ( $opt{'cust_classnum'} ) {
- my $classnums = $opt{'cust_classnum'};
- $classnums = [ $classnums ] if !ref($classnums);
- @$classnums = grep /^\d+$/, @$classnums;
- push @where, 'cust_main.classnum in('. join(',',@$classnums) .')';
- }
+ push @where, $self->with_cust_classnum(%opt);
my $total_sql = "SELECT COALESCE(SUM(cust_bill_pkg.setup),0)
FROM cust_bill_pkg
@@ -478,12 +468,7 @@ sub cust_bill_pkg_recur {
push @where, 'cust_main.refnum = '. $opt{'refnum'} if $opt{'refnum'};
- if ( $opt{'cust_classnum'} ) {
- my $classnums = $opt{'cust_classnum'};
- $classnums = [ $classnums ] if !ref($classnums);
- @$classnums = grep /^\d+$/, @$classnums;
- push @where, 'cust_main.classnum in('. join(',',@$classnums) .')';
- }
+ push @where, $self->with_cust_classnum(%opt);
# subtract all usage from the line item regardless of date
my $item_usage;
@@ -540,12 +525,7 @@ sub cust_bill_pkg_detail {
push @where, 'cust_main.refnum = '. $opt{'refnum'} if $opt{'refnum'};
- if ( $opt{'cust_classnum'} ) {
- my $classnums = $opt{'cust_classnum'};
- $classnums = [ $classnums ] if !ref($classnums);
- @$classnums = grep /^\d+$/, @$classnums;
- push @where, 'cust_main.classnum in('. join(',',@$classnums) .')';
- }
+ push @where, $self->with_cust_classnum(%opt);
$agentnum ||= $opt{'agentnum'};
@@ -688,12 +668,8 @@ sub for_opts {
if ( $opt{'refnum'} =~ /^(\d+)$/ ) {
$sql .= " and refnum = $1 ";
}
- if ( $opt{'cust_classnum'} ) {
- my $classnums = $opt{'cust_classnum'};
- $classnums = [ $classnums ] if !ref($classnums);
- @$classnums = grep /^\d+$/, @$classnums;
- $sql .= ' and cust_main.classnum in('. join(',',@$classnums) .')'
- if @$classnums;
+ if ( my $where = $self->with_cust_classnum(%opt) ) {
+ $sql .= " and $where";
}
$sql;
@@ -772,6 +748,19 @@ sub with_report_option {
$comparison;
}
+sub with_cust_classnum {
+ my ($self, %opt) = @_;
+ if ( $opt{'cust_classnum'} ) {
+ my $classnums = $opt{'cust_classnum'};
+ $classnums = [ $classnums ] if !ref($classnums);
+ @$classnums = grep /^\d+$/, @$classnums;
+ return 'cust_main.classnum in('. join(',',@$classnums) .')'
+ if @$classnums;
+ }
+ '';
+}
+
+
sub scalar_sql {
my( $self, $sql ) = ( shift, shift );
my $sth = dbh->prepare($sql) or die dbh->errstr;
diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm
index 68c824515..5914ab5c5 100644
--- a/FS/FS/cust_payby.pm
+++ b/FS/FS/cust_payby.pm
@@ -6,6 +6,7 @@ use FS::UID;
use FS::Record qw( qsearchs ); #qsearch;
use FS::payby;
use FS::cust_main;
+use Business::CreditCard qw( validate cardtype );
use vars qw( $conf @encrypted_fields
$ignore_expired_card $ignore_banned_card
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index e1874259e..9e3b67ef1 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -5,7 +5,8 @@ use strict;
use vars qw( %plans $DEBUG $setup_hack $skip_pkg_svc_hack );
use Carp qw(carp cluck confess);
use Scalar::Util qw( blessed );
-use Time::Local qw( timelocal timelocal_nocheck );
+use DateTime;
+use Time::Local qw( timelocal timelocal_nocheck ); # eventually replace with DateTime
use Tie::IxHash;
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh dbdef );
@@ -1094,10 +1095,11 @@ sub delay_start_date {
my $self = shift;
my $delay = $self->delay_start or return '';
-
- my ($mday,$mon,$year) = (localtime(time))[3,4,5];
- timelocal(0,0,0,$mday,$mon,$year) + 86400 * $delay;
+ # avoid timelocal silliness
+ my $dt = DateTime->today(time_zone => 'local');
+ $dt->add(days => $delay);
+ $dt->epoch;
}
sub can_currency_exchange { 0; }
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index de17cd3b8..5a27f064f 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -263,7 +263,7 @@ tie my %detail_formats, 'Tie::IxHash',
'type' => 'checkbox',
},
- 'usage_mandate' => { 'name' => 'Always put usage details in separate section',
+ 'usage_mandate' => { 'name' => 'Always put usage details in separate section. The section is defined in the next option.',
'type' => 'checkbox',
},
#eofalse
@@ -340,7 +340,7 @@ tie my %detail_formats, 'Tie::IxHash',
411_rewrite
output_format
selfservice_format selfservice_inbound_format
- usage_mandate summarize_usage usage_section
+ usage_mandate usage_section summarize_usage
usage_nozero bill_every_call bill_inactive_svcs
count_available_phones suspend_bill
)