[Rt-commit] rt branch, 4.0/modify-queue-lifecycle-in-admin, updated. rt-4.0.4-224-ga116833
? sunnavy
sunnavy at bestpractical.com
Wed Jun 20 21:24:02 EDT 2012
The branch, 4.0/modify-queue-lifecycle-in-admin has been updated
via a1168337e0a6d316f011de35513ec3b355c13e67 (commit)
from 4f9c2589ea618550a5dec51db784202ae6958c5f (commit)
Summary of changes:
lib/RT/Queue.pm | 37 ++++++++---------------------------
share/html/Admin/Queues/Modify.html | 3 +--
2 files changed, 9 insertions(+), 31 deletions(-)
- Log -----------------------------------------------------------------
commit a1168337e0a6d316f011de35513ec3b355c13e67
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Jun 21 09:09:14 2012 +0800
simplify Queue Lifecycle column's logic to avoid empty values
empty values will be automatically converted to "default"
diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index 3aca8c2..72a6ae9 100644
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -268,8 +268,9 @@ sub SetLifecycle {
if ( $value && $value ne 'default' ) {
return (0, $self->loc('[_1] is not valid lifecycle', $value ))
unless $self->ValidateLifecycle( $value );
- } else {
- $value = undef;
+ }
+ else {
+ $value ||= 'default';
}
return $self->_Set( Field => 'Lifecycle', Value => $value, @_ );
@@ -412,8 +413,9 @@ sub Create {
if ( $args{'Lifecycle'} && $args{'Lifecycle'} ne 'default' ) {
return ( 0, $self->loc('Invalid lifecycle name') )
unless $self->ValidateLifecycle( $args{'Lifecycle'} );
- } else {
- $args{'Lifecycle'} = undef;
+ }
+ else {
+ $args{'Lifecycle'} ||= 'default';
}
my %attrs = map {$_ => 1} $self->ReadableAttributes;
@@ -1218,30 +1220,7 @@ sub _Set {
IsSQL => undef,
@_
);
-
- if ( wantarray && $args{Field} && $args{Field} eq 'Lifecycle' ) {
- my $old_val = $self->__Value($args{'Field'}) || 'default';
-
- if ( $old_val eq 'default' && !defined $args{Value} ) {
- return ( 0, $self->loc("That is already the current value") );
- }
-
- my ( $status, $msg ) = $self->SUPER::_Set(@_);
-
- if ($status) {
- my $new_val = $self->__Value($args{'Field'}) || 'default';
- $msg = $self->loc(
- "[_1] changed from [_2] to [_3]",
- $self->loc( $args{'Field'} ),
- qq{"$old_val"}, qq{"$new_val"},
- );
- }
- return ( $status, $msg );
- }
- else {
- return $self->SUPER::_Set(@_);
- }
-
+ return ( $self->SUPER::_Set(@_) );
}
@@ -1554,7 +1533,7 @@ sub _CoreAccessible {
SubjectTag =>
{read => 1, write => 1, sql_type => 12, length => 120, is_blob => 0, is_numeric => 0, type => 'varchar(120)', default => ''},
Lifecycle =>
- {read => 1, write => 1, sql_type => 12, length => 32, is_blob => 0, is_numeric => 0, type => 'varchar(32)', default => ''},
+ {read => 1, write => 1, sql_type => 12, length => 32, is_blob => 0, is_numeric => 0, type => 'varchar(32)', default => 'default'},
InitialPriority =>
{read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
FinalPriority =>
diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index b867d3a..8b9f393 100755
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -200,8 +200,7 @@ if ( $QueueObj->Id ) {
# avoid the result of "already the current value"
delete $ARGS{'Lifecycle'}
if $ARGS{'Lifecycle'}
- && $ARGS{'Lifecycle'} eq
- ( $QueueObj->_Value('Lifecycle') || 'default' );
+ && $ARGS{'Lifecycle'} eq $QueueObj->_Value('Lifecycle');
push @results, UpdateRecordObject(
AttributesRef => \@attribs,
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list