From 43a06151e47d2c59b833cbd8c26d97865ee850b6 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 7 Jun 2012 00:56:06 -0700 Subject: starting to work... --- rt/share/html/Elements/SelectStatus | 57 +++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 12 deletions(-) (limited to 'rt/share/html/Elements/SelectStatus') diff --git a/rt/share/html/Elements/SelectStatus b/rt/share/html/Elements/SelectStatus index 5718a2a9d..e571baf63 100755 --- a/rt/share/html/Elements/SelectStatus +++ b/rt/share/html/Elements/SelectStatus @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -46,24 +46,57 @@ %# %# END BPS TAGGED BLOCK }}} % my $onchange_attr = $onchange ? " onchange=\"$onchange\"" : ''; - <% $onchange_attr |n%>> +% if ( $DefaultValue ) { + +% } +% foreach my $status (@status) { +% next if ($SkipDeleted && $status eq 'deleted'); +% my $selected = defined $Default && $status eq $Default ? 'selected="selected"' : ''; + % } -<%ONCE> -my $queue = new RT::Queue($session{'CurrentUser'}); -my @status = $queue->StatusArray(); - +<%INIT> +### XXX: no cover for Tools/MyDay.html + + +my @status; +if ( @Statuses ) { + @status = @Statuses; +} +elsif ( $TicketObj ) { + my $current = $TicketObj->Status; + my $lifecycle = $TicketObj->QueueObj->Lifecycle; + + my %has = (); + foreach my $next ( $lifecycle->Transitions( $current ) ) { + my $check = $lifecycle->CheckRight( $current => $next ); + $has{ $check } = $TicketObj->CurrentUserHasRight( $check ) + unless exists $has{ $check }; + push @status, $next if $has{ $check }; + } +} +elsif ( $QueueObj ) { + @status = $QueueObj->Lifecycle->Transitions(''); +} +else { + @status = RT::Queue->Lifecycle->Valid; +} + <%ARGS> $Name => undef + +@Statuses => () +$TicketObj => undef +$QueueObj => undef + $Default => '' $SkipDeleted => 0 $DefaultValue => 1 $DefaultLabel => "-" + +$Multiple => 0 +$Size => 6 + $onchange => '' -- cgit v1.2.1 From c24d6e2242ae0e026684b8f95decf156aba6e75e Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 7 Jun 2012 16:55:45 -0700 Subject: rt 4.0.6 --- rt/share/html/Elements/SelectStatus | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'rt/share/html/Elements/SelectStatus') diff --git a/rt/share/html/Elements/SelectStatus b/rt/share/html/Elements/SelectStatus index e571baf63..af1ff615f 100755 --- a/rt/share/html/Elements/SelectStatus +++ b/rt/share/html/Elements/SelectStatus @@ -66,6 +66,8 @@ if ( @Statuses ) { } elsif ( $TicketObj ) { my $current = $TicketObj->Status; + push @status, $current; + my $lifecycle = $TicketObj->QueueObj->Lifecycle; my %has = (); @@ -78,8 +80,15 @@ elsif ( $TicketObj ) { } elsif ( $QueueObj ) { @status = $QueueObj->Lifecycle->Transitions(''); -} -else { +} elsif ( %Queues ) { + for my $id (keys %Queues) { + my $queue = RT::Queue->new($session{'CurrentUser'}); + $queue->Load($id); + push @status, $queue->Lifecycle->Valid if $queue->id; + } + my %seen; + @status = grep { not $seen{$_}++ } @status; +} else { @status = RT::Queue->Lifecycle->Valid; } @@ -89,6 +98,7 @@ $Name => undef @Statuses => () $TicketObj => undef $QueueObj => undef +%Queues => () $Default => '' $SkipDeleted => 0 -- cgit v1.2.1