[Rt-commit] rt branch, 4.0/highlight-approvals-state, created. rt-4.0.4-118-g852f0b1
Ruslan Zakirov
ruz at bestpractical.com
Fri Dec 9 08:33:59 EST 2011
The branch, 4.0/highlight-approvals-state has been created
at 852f0b1619d8650ebd4d1517c482e994972a4dce (commit)
- Log -----------------------------------------------------------------
commit 852f0b1619d8650ebd4d1517c482e994972a4dce
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Dec 9 17:31:06 2011 +0400
check radio that reflects the current status of approval
don't show 'no action' if approval is already accepted
or denied. treat deleted and rejected statuses as denied.
diff --git a/share/html/Approvals/Elements/Approve b/share/html/Approvals/Elements/Approve
index f651139..0e086a6 100755
--- a/share/html/Approvals/Elements/Approve
+++ b/share/html/Approvals/Elements/Approve
@@ -67,17 +67,29 @@
<div class="form">
<div class="action">
<div>
+% if ( $inactive && $status eq 'resolved' ) {
+ <input type="radio" class="radio" id="Approval-<%$ticket->Id%>-Action-approve" name="Approval-<%$ticket->Id%>-Action" value="approve" checked="checked" />
+ <label for="Approval-<%$ticket->Id%>-Action-approve"><% loc('[_1] (Unchanged)', loc('Approve')) %></label>
+% } else {
<input type="radio" class="radio" id="Approval-<%$ticket->Id%>-Action-approve" name="Approval-<%$ticket->Id%>-Action" value="approve" />
<label for="Approval-<%$ticket->Id%>-Action-approve"><&|/l&>Approve</&></label>
+% }
</div>
<div>
+% if ( $inactive && $status ne 'resolved' ) {
+ <input type="radio" class="radio" id="Approval-<%$ticket->Id%>-Action-deny" name="Approval-<%$ticket->Id%>-Action" value="deny" checked="checked" />
+ <label for="Approval-<%$ticket->Id%>-Action-deny"><% loc('[_1] (Unchanged)', loc('Deny')) %></label>
+% } else {
<input type="radio" class="radio" id="Approval-<%$ticket->Id%>-Action-deny" name="Approval-<%$ticket->Id%>-Action" value="deny" />
<label for="Approval-<%$ticket->Id%>-Action-deny"><&|/l&>Deny</&></label>
+% }
</div>
+% unless ( $inactive ) {
<div>
<input type="radio" class="radio" id="Approval-<%$ticket->Id%>-Action-none" name="Approval-<%$ticket->Id%>-Action" value="none" checked="checked" />
<label for="Approval-<%$ticket->Id%>-Action-none"><&|/l&>No action</&></label>
</div>
+% }
</div>
<div class="notes">
<label for="Approval-<%$ticket->Id%>-Notes"><&|/l&>Notes</&></label>
@@ -92,3 +104,7 @@ $ShowCustomFields => 1
$ShowHistory => 1
$ticket => undef
</%ARGS>
+<%INIT>
+my $status = $ticket->Status;
+my $inactive = $ticket->QueueObj->Lifecycle->IsInactive( $status );
+</%INIT>
diff --git a/share/html/Approvals/index.html b/share/html/Approvals/index.html
index fc04fce..f1002c9 100755
--- a/share/html/Approvals/index.html
+++ b/share/html/Approvals/index.html
@@ -79,11 +79,11 @@ foreach my $arg ( keys %ARGS ) {
}
my ($val, $msg);
- if ( $ARGS{$arg} eq 'deny' ) {
- ( $val, $msg ) = $ticket->SetStatus('rejected');
+ if ( $ARGS{$arg} eq 'deny' && $ticket->Status !~ /^(rejected|deleted)/ ) {
+ ( $val, $msg ) = $ticket->SetStatus('rejected');
}
- elsif ( $ARGS{$arg} eq 'approve' ) {
- ( $val, $msg ) = $ticket->SetStatus('resolved');
+ elsif ( $ARGS{$arg} eq 'approve' && $ticket->Status ne 'resolved') {
+ ( $val, $msg ) = $ticket->SetStatus('resolved');
}
push ( @actions, loc("Approval #[_1]: [_2]",$ticket->id, $msg )) if ($msg);
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list