[freeside-commits] branch master updated. abff127758a08cedc9bb323e1d973d27c0e2deb3

Ivan ivan at 420.am
Sun Sep 8 23:10:16 PDT 2013


The branch, master has been updated
       via  abff127758a08cedc9bb323e1d973d27c0e2deb3 (commit)
      from  5c1ffe11b3af54011fb87e4dceb845139d0d3553 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit abff127758a08cedc9bb323e1d973d27c0e2deb3
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Sep 8 23:10:13 2013 -0700

    don't reinitialized RT on service unprovision, RT#24767

diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm
index 2066a05..7b35357 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<cancel> 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);

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_svc.pm |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list