[Rt-commit] rt branch, 4.0/display-queue-name-in-set-queue-txn-brief-description, updated. rt-4.0.9-17-g90dcf23
Jim Brandt
jbrandt at bestpractical.com
Wed Jan 30 11:18:05 EST 2013
The branch, 4.0/display-queue-name-in-set-queue-txn-brief-description has been updated
via 90dcf23a2f7b5bf79bc07289c9cadd57786e2a0a (commit)
from 621c427c4accb162f4e41881579d82728537d5fb (commit)
Summary of changes:
lib/RT/Transaction.pm | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
- Log -----------------------------------------------------------------
commit 90dcf23a2f7b5bf79bc07289c9cadd57786e2a0a
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Wed Jan 30 11:12:39 2013 -0500
Display string for NewValue in set queue txn Brief Description
Handle both OldValue and NewValue for set queue. For clarity,
explicitly check $q->Id when checking for a loaded queue.
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index 2c663b8..088904a 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -867,20 +867,22 @@ sub BriefDescription {
return $self->loc('Password changed');
}
elsif ( $self->Field eq 'Queue' ) {
- my $q1 = RT::Queue->new( $self->CurrentUser );
- my $old_queue_name;
- if( $q1->Load( $self->OldValue ) ){
- $old_queue_name = $q1->Name;
- }
- else{
- # Allow string name for migrations where the old queue may
- # not be available in this instance.
- $old_queue_name = $self->OldValue;
+ my %values;
+ foreach my $field (qw(OldValue NewValue)){
+ my $q = RT::Queue->new( $self->CurrentUser );
+ $q->Load( $self->$field );
+ if( $q->Id ) {
+ $values{$field} = $q->Name;
+ }
+ else{
+ # Allow string name for migrations where the old queue may
+ # not be available in this instance.
+ $values{$field} = $self->$field;
+ }
}
- my $q2 = RT::Queue->new( $self->CurrentUser );
- $q2->Load( $self->NewValue );
+
return $self->loc("[_1] changed from [_2] to [_3]",
- $self->loc($self->Field) , $old_queue_name, $q2->Name);
+ $self->loc($self->Field) , $values{OldValue}, $values{NewValue});
}
# Write the date/time change at local time:
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list