~bestpractical/rt/master

« back to all changes in this revision

Viewing changes to share/html/Admin/Queues/Modify.html

  • Committer: sunnavy
  • Date: 2023-10-19 19:45:11 UTC
  • mfrom: (8471.1.577)
  • Revision ID: git-v1:9fca83d11d15fb8034308194b9c9052d5df7d454
Merge branch '5.0-trunk'

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
        <input type="hidden" class="hidden" name="SetSLAEnabled" value="1" />
115
115
      </div>
116
116
  </&>
117
 
% my $CFs = $QueueObj->CustomFields;
118
 
% while (my $CF = $CFs->Next) {
119
 
<&| /Elements/LabeledValue, Label => $CF->Name, LabelTooltip => $CF->EntryHint &>
120
117
 
121
 
      <& /Elements/EditCustomField, CustomField => $CF,
122
 
                                    Object => $QueueObj, &>
123
 
</&>
124
 
% }
 
118
  <& /Elements/EditCustomFields, Object => $QueueObj &>
125
119
 
126
120
% if ( RT->Config->Get('Crypt')->{'Enable'} ) {
127
121
  <&| /Elements/LabeledValue, Label => '' &>
196
190
 
197
191
<%INIT>
198
192
my ($title, @results, @no_redirect_results, $Disabled, $EnabledChecked);
 
193
my $skip_update = 0;
 
194
 
199
195
my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
200
 
$QueueObj->Load( $id ) if !$id || $id eq 'new';
 
196
 
 
197
my ( $ok, $msg );
 
198
if ( ($id && $id ne 'new') || ( $Name && not $id ) ) {
 
199
    if ( $id ) {
 
200
        ( $ok, $msg ) = $QueueObj->Load($id);
 
201
    }
 
202
    else {
 
203
        ( $ok, $msg ) = $QueueObj->Load($Name);
 
204
    }
 
205
    if ( not $ok ) {
 
206
        RT->Logger->error("Unable to load queue with id $id: $msg");
 
207
        Abort(loc("Couldn't load queue '[_1]'", $Name));
 
208
    }
 
209
}
 
210
 
 
211
my $CustomFields = $QueueObj->CustomFields;
 
212
 
 
213
my ($status, @msg) = $m->comp(
 
214
    '/Elements/ValidateCustomFields',
 
215
    Object       => $QueueObj,
 
216
    CustomFields => $CustomFields,
 
217
    ARGSRef      => \%ARGS,
 
218
);
 
219
unless ($status) {
 
220
    push @results, @msg;
 
221
    $skip_update = 1;
 
222
    if ( $id && $id eq 'new' ) {
 
223
        $Create = 1;
 
224
    }
 
225
}
201
226
 
202
227
$EnabledChecked = 'checked="checked"';
203
228
 
204
229
unless ($Create) {
205
 
    if ( defined $id && $id eq 'new' ) {
 
230
    if ( defined $id && $id eq 'new' && not $skip_update ) {
206
231
        my ($val, $msg) = $QueueObj->Create( Name => $Name );
207
232
        if (!$val) {
208
233
            $Create = 1; # Create failed, so bring us back to step 1
209
234
        }
210
235
        push @results, $msg;
211
 
    } else {
212
 
        $QueueObj->Load($id) || $QueueObj->Load($Name) || Abort(loc("Couldn't load queue '[_1]'", $Name));
213
236
    }
214
237
}
215
238
 
216
 
if ( $QueueObj->Id ) {
 
239
if ( $QueueObj->Id && not $skip_update ) {
217
240
    $title = loc('Configuration for queue [_1]', $QueueObj->Name );
218
241
    my @attribs= qw(Description CorrespondAddress CommentAddress Name SortOrder
219
242
        Sign SignAuto Encrypt Lifecycle SubjectTag SLADisabled Disabled);
273
296
my $InternalQueue = ($QueueObj->Id and $QueueObj->Disabled == 2);
274
297
 
275
298
# This code does automatic redirection if any updates happen.
276
 
MaybeRedirectForResults(
277
 
    Actions   => \@results,
278
 
    Arguments => { id => $QueueObj->Id },
279
 
) if $QueueObj->id;
 
299
unless ( $skip_update ) {
 
300
    MaybeRedirectForResults(
 
301
        Actions   => \@results,
 
302
        Arguments => { id => $QueueObj->Id },
 
303
    ) if $QueueObj->id;
 
304
}
280
305
 
281
306
push @results, @no_redirect_results;
282
307
</%INIT>