diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-06-04 03:23:12 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-06-04 03:23:12 -0700 |
commit | 05eb6fd62056682d8760b85ced91dabd33357a3b (patch) | |
tree | c541401962c75dcbe9833dde33943c109a865bac /FS/FS | |
parent | 39754a8b5468d95124ee2c0bbcd1c104904d1fe5 (diff) |
move services between packages, RT#22619
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/AccessRight.pm | 1 | ||||
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/XMLRPC.pm | 2 | ||||
-rw-r--r-- | FS/FS/access_right.pm | 1 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 40 |
5 files changed, 42 insertions, 9 deletions
diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm index 4753d31..d7e5a17 100644 --- a/FS/FS/AccessRight.pm +++ b/FS/FS/AccessRight.pm @@ -160,6 +160,7 @@ tie my %rights, 'Tie::IxHash', 'View customer services', #NEW 'Provision customer service', 'Bulk provision customer service', + 'Bulk move customer services', #NEWNEW 'Recharge customer service', #NEW 'Unprovision customer service', 'Change customer service', #NEWNEW diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 3dffa45..7e835a2 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -5078,13 +5078,6 @@ and customer address. Include units.', }, { - 'key' => 'maestro-status_test', - 'section' => 'UI', - 'description' => 'Display a link to the maestro status test page on the customer view page', - 'type' => 'checkbox', - }, - - { 'key' => 'cust_main-custom_link', 'section' => 'UI', 'description' => 'URL to use as source for the "Custom" tab in the View Customer page. The customer number will be appended, or you can insert "$custnum" to have it inserted elsewhere. "$agentnum" will be replaced with the agent number, and "$usernum" will be replaced with the employee number.', diff --git a/FS/FS/XMLRPC.pm b/FS/FS/XMLRPC.pm index 73ce13f..62ae43d 100644 --- a/FS/FS/XMLRPC.pm +++ b/FS/FS/XMLRPC.pm @@ -11,8 +11,6 @@ use FS::Conf; use FS::Record; use FS::cust_main; -use FS::Maestro; - use Data::Dumper; $DEBUG = 0; diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm index a42d7f2..f8e30d0 100644 --- a/FS/FS/access_right.pm +++ b/FS/FS/access_right.pm @@ -234,6 +234,7 @@ sub _upgrade_data { # class method ], 'Change customer package' => 'Detach customer package', 'Services: Accounts' => 'Services: Cable Subscribers', + 'Bulk change customer packages' => 'Bulk move customer services', ; foreach my $old_acl ( keys %onetime ) { diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 4dced54..4ce2e8e 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -3191,6 +3191,46 @@ sub transfer { return $remaining; } +=item grab_svcnums SVCNUM, SVCNUM ... + +Change the pkgnum for the provided services to this packages. If there is an +error, returns the error, otherwise returns false. + +=cut + +sub grab_svcnums { + my $self = shift; + my @svcnum = @_; + + local $SIG{HUP} = 'IGNORE'; + local $SIG{INT} = 'IGNORE'; + local $SIG{QUIT} = 'IGNORE'; + local $SIG{TERM} = 'IGNORE'; + local $SIG{TSTP} = 'IGNORE'; + local $SIG{PIPE} = 'IGNORE'; + + my $oldAutoCommit = $FS::UID::AutoCommit; + local $FS::UID::AutoCommit = 0; + my $dbh = dbh; + + foreach my $svcnum (@svcnum) { + my $cust_svc = qsearchs('cust_svc', { svcnum=>$svcnum } ) or do { + $dbh->rollback if $oldAutoCommit; + return "unknown svcnum $svcnum"; + }; + $cust_svc->pkgnum( $self->pkgnum ); + my $error = $cust_svc->replace; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + ''; + +} + =item reexport This method is deprecated. See the I<depend_jobnum> option to the insert and |