diff options
author | levinse <levinse> | 2010-12-09 19:26:20 +0000 |
---|---|---|
committer | levinse <levinse> | 2010-12-09 19:26:20 +0000 |
commit | 57fecbd959fd5d72b20105161b7e3df94cbedd03 (patch) | |
tree | 93c68293eeefe6a29f650ee272e93e5832168e35 /FS/FS/cust_svc.pm | |
parent | 19f2731dbceb444c5dd45f57fb0a785dcaf9aa65 (diff) |
-change ikano.pm to use the new part_pkg_vendor, RT7111
-implement service expiry and add export expire to ikano, RT7111
-fix edit part_pkg bug, RT7111
Diffstat (limited to 'FS/FS/cust_svc.pm')
-rw-r--r-- | FS/FS/cust_svc.pm | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm index 7b866fa..0a58d55 100644 --- a/FS/FS/cust_svc.pm +++ b/FS/FS/cust_svc.pm @@ -109,7 +109,7 @@ If there is an error, returns the error, otherwise returns false. =cut sub cancel { - my $self = shift; + my($self,%opt) = @_; local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; @@ -133,19 +133,26 @@ sub cancel { my $svc = $self->svc_x; if ($svc) { - - my $error = $svc->cancel; - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "Error canceling service: $error"; - } - $error = $svc->delete; #this deletes this cust_svc record as well - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "Error deleting service: $error"; + if ( %opt && $opt{'date'} ) { + my $error = $svc->expire($opt{'date'}); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "Error expiring service: $error"; + } + } else { + my $error = $svc->cancel; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "Error canceling service: $error"; + } + $error = $svc->delete; #this deletes this cust_svc record as well + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "Error deleting service: $error"; + } } - } else { + } elsif ( !%opt ) { #huh? warn "WARNING: no svc_ record found for svcnum ". $self->svcnum. |