From: Ivan Kohler Date: Mon, 9 Sep 2013 06:10:13 +0000 (-0700) Subject: don't reinitialized RT on service unprovision, RT#24767 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=abff127758a08cedc9bb323e1d973d27c0e2deb3 don't reinitialized RT on service unprovision, RT#24767 --- diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm index 2066a05ac..7b353579a 100644 --- a/FS/FS/cust_svc.pm +++ b/FS/FS/cust_svc.pm @@ -1,7 +1,7 @@ package FS::cust_svc; use strict; -use vars qw( @ISA $DEBUG $me $ignore_quantity ); +use vars qw( @ISA $DEBUG $me $ignore_quantity $conf $ticket_system ); use Carp; #use Scalar::Util qw( blessed ); use FS::Conf; @@ -25,6 +25,12 @@ $me = '[cust_svc]'; $ignore_quantity = 0; +#ask FS::UID to run this stuff for us later +FS::UID->install_callback( sub { + $conf = new FS::Conf; + $ticket_system = $conf->config('ticket_system') +}); + sub _cache { my $self = shift; my ( $hashref, $cache ) = @_; @@ -103,15 +109,19 @@ record - you should probably use the B method instead. =cut +my $rt_session; + sub delete { my $self = shift; my $error = $self->SUPER::delete; return $error if $error; - if ( FS::Conf->new->config('ticket_system') eq 'RT_Internal' ) { - FS::TicketSystem->init; - my $session = FS::TicketSystem->session; - my $links = RT::Links->new($session->{CurrentUser}); + if ( $ticket_system eq 'RT_Internal' ) { + unless ( $rt_session ) { + FS::TicketSystem->init; + $rt_session = FS::TicketSystem->session; + } + my $links = RT::Links->new($rt_session->{CurrentUser}); my $svcnum = $self->svcnum; $links->Limit(FIELD => 'Target', VALUE => 'freeside://freeside/cust_svc/'.$svcnum);