X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FAdmin%2FElements%2FEditScrips;h=c92fc5563388386d546dd7a612184e80a4d47d2b;hb=ac20214d38d9af00430423f147b5a0e50751b050;hp=b09eca91041522f741d9c710507631be10fb1e94;hpb=7588a4ac90a9b07c08a3107cd1107d773be1c991;p=freeside.git diff --git a/rt/share/html/Admin/Elements/EditScrips b/rt/share/html/Admin/Elements/EditScrips index b09eca910..c92fc5563 100755 --- a/rt/share/html/Admin/Elements/EditScrips +++ b/rt/share/html/Admin/Elements/EditScrips @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -98,17 +98,33 @@ else { # deal with modifying and deleting existing scrips # we still support DeleteScrip-id format but array is preferred + +my @not_deleted; foreach my $id ( grep $_, @DeleteScrip, map /^DeleteScrip-(\d+)/, keys %ARGS ) { my $scrip = RT::Scrip->new($session{'CurrentUser'}); $scrip->Load( $id ); - my ($retval, $msg) = $scrip->Delete; - if ($retval) { - push @actions, loc("Scrip deleted"); - } - else { - push @actions, $msg; + my $a = $scrip->FirstAttribute('Immutable'); + if ( defined($a) and $a->Content ) { + # then disable the scrip instead of deleting it + my ($retval, $msg) = $scrip->SetStage('Disabled'); + if ( $retval ) { + push @actions, loc("Scrip disabled (cannot delete system scrips)"); + } else { + push @actions, $msg; + push @not_deleted, $id; + } + } else { # not an immutable scrip + my ($retval, $msg) = $scrip->Delete; + if ($retval) { + push @actions, loc("Scrip deleted"); + } + else { + push @actions, $msg; + push @not_deleted, $id; + } } } +$DECODED_ARGS->{DeleteScrip} = \@not_deleted; <%ARGS>