diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-06-18 15:26:02 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-06-18 15:26:02 -0700 |
commit | 20e279396ac0a7a99a3dc9c831e44f435035d17f (patch) | |
tree | c99caf6adf89295bef7e55167c4d09815b2de535 | |
parent | 94929dd9a9f81ea430f4e8f3a26642466bdd4642 (diff) | |
parent | e5002a24fee7e476cbb3d8d916c8d87ddfc12093 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
-rw-r--r-- | FS/FS/cdr/netsapiens.pm | 50 | ||||
-rw-r--r-- | FS/FS/cust_location.pm | 4 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 12 |
3 files changed, 64 insertions, 2 deletions
diff --git a/FS/FS/cdr/netsapiens.pm b/FS/FS/cdr/netsapiens.pm new file mode 100644 index 000000000..bcaa3496d --- /dev/null +++ b/FS/FS/cdr/netsapiens.pm @@ -0,0 +1,50 @@ +package FS::cdr::netsapiens; + +use strict; +use base qw( FS::cdr ); +use vars qw( %info ); +use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker ); + +%info = ( + 'name' => 'NetSapiens', + 'weight' => 160, + 'header' => 1, #0 default, set to 1 to ignore the first line, or + # to higher numbers to ignore that number of lines + 'type' => 'csv', #csv (default), fixedlength or xls + 'sep_char' => ',', #for csv, defaults to , + 'disabled' => 0, #0 default, set to 1 to disable + + 'import_fields' => [ + + sub { my ($cdr, $direction) = @_; + if ($direction =~ /^o/) { # 'origination' + # leave src and dst as they are + } elsif ($direction =~ /^t/) { + my ($local, $remote) = ($cdr->src, $cdr->dst); + $cdr->set('dst', $local); + $cdr->set('src', $remote); + } + }, + '', #Domain + '', #user + 'src', #local party (src/dst, based on direction) + _cdr_date_parser_maker('startddate'), + _cdr_date_parser_maker('answerdate'), + sub { my ($cdr, $duration) = @_; + $cdr->set('duration', $duration); + $cdr->set('billsec', $duration); + $cdr->set('enddate', $duration + $cdr->answerdate) + if $cdr->answerdate; + }, + 'dst', #remote party + '', #dialed number + 'uniqueid', #CallID (timestamp + '-' + 32 char hex string) + 'src_ip_addr', + 'dst_ip_addr', + 'disposition', + ], + +); + +1; + diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm index a834859ba..b98ade157 100644 --- a/FS/FS/cust_location.pm +++ b/FS/FS/cust_location.pm @@ -257,12 +257,12 @@ and replace methods. =cut -#some false laziness w/cust_main, but since it should eventually lose these -#fields anyway... sub check { my $self = shift; my $conf = new FS::Conf; + return '' if $self->disabled; # so that disabling locations never fails + my $error = $self->ut_numbern('locationnum') || $self->ut_foreign_keyn('prospectnum', 'prospect_main', 'prospectnum') diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 1c9d8e136..ddfab5dcb 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -1925,6 +1925,18 @@ sub change { } } + # transfer (copy) invoice details + foreach my $detail ($self->cust_pkg_detail) { + my $new_detail = FS::cust_pkg_detail->new({ $detail->hash }); + $new_detail->set('pkgdetailnum', ''); + $new_detail->set('pkgnum', $cust_pkg->pkgnum); + $error = $new_detail->insert; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "Error transferring package notes: $error"; + } + } + # Order any supplemental packages. my $part_pkg = $cust_pkg->part_pkg; my @old_supp_pkgs = $self->supplemental_pkgs; |