X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FCron%2Frt_tasks.pm;h=01ea0b5dd77ad5d0b2798407e7fe2c474562a345;hb=cf98bcb1b302d553ef050c2ef1e4fe7b660705b1;hp=6658b47819bd7f1fd437af42fbbc8dcbd75cf70e;hpb=4c8c18409f82d56320a80f6c94f275fa15486897;p=freeside.git diff --git a/FS/FS/Cron/rt_tasks.pm b/FS/FS/Cron/rt_tasks.pm index 6658b4781..01ea0b5dd 100644 --- a/FS/FS/Cron/rt_tasks.pm +++ b/FS/FS/Cron/rt_tasks.pm @@ -29,12 +29,8 @@ sub rt_daily { # RT_External installations should have their own cron scripts for this my $system = $FS::TicketSystem::system; - return if $system ne 'RT_Internal'; + return if !defined($system) || $system ne 'RT_Internal'; - FS::TicketSystem->init; - $DEBUG = 1 if $opt{'v'}; - RT::Config->Set( LogToScreen => 'debug' ) if $DEBUG; - # if -d or -y is in use, bail out. There's no reliable way to tell RT # to use an alternate system time. if ( $opt{'d'} or $opt{'y'} ) { @@ -42,10 +38,14 @@ sub rt_daily { return; } + FS::TicketSystem->init; my $session = FS::TicketSystem->session(); my $CurrentUser = $session->{'CurrentUser'} or die "Failed to create RT session"; + $DEBUG = 1 if $opt{'v'}; + RT::Config->Set( LogToScreen => 'debug' ) if $DEBUG; + # load some modules that aren't handled in FS::TicketSystem foreach (qw( Search::ActiveTicketsInQueue @@ -69,7 +69,6 @@ sub rt_daily { $queues->UnLimit; while (my $queue = $queues->Next) { warn "Queue '".$queue->Name."'\n" if $DEBUG; - my $CurrentUser = $queue->CurrentUser; my %opt = @_; my $tickets = RT::Tickets->new($CurrentUser); my $search = RT::Search::ActiveTicketsInQueue->new(