Skip to content

Commit

Permalink
Unapply Incidents Processes class globally
Browse files Browse the repository at this point in the history
The articles on the Incidents Processes class are intended to be displayed
only on the Incident view page, but they were also available at the
Include Article field of tickets, because the class was applied globally.
  • Loading branch information
richieri-bps committed Dec 10, 2024
1 parent 03f8d24 commit 8c5cb78
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions etc/initialdata
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ for my $cf (@CustomFields) {
{
Name => 'Incidents Processes',
Description => 'Processes to be followed in the event of an incident',
ApplyTo => [],
}
);

Expand Down
15 changes: 15 additions & 0 deletions etc/upgrade/5.0.8/content
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
our @Final = sub {
my $CurrentUser = RT::CurrentUser->new();
$CurrentUser->LoadByName('RT_System');

require RT::Class;
my $incident_processes = RT::Class->new($CurrentUser);
$incident_processes->Load('Incidents Processes');
die "Could not load 'Incidents Processes' class: $msg" unless $incident_processes->Id;

if ( $incident_processes->IsApplied( 0 ) ) {
my $empty_queue = RT::Queue->new( RT->SystemUser );
my ($ok, $msg) = $incident_processes->RemoveFromObject( $empty_queue );
die "Could not remove 'Incidents Processes' from 'Global' queue: $msg" unless $ok;
}
};

0 comments on commit 8c5cb78

Please sign in to comment.