summaryrefslogtreecommitdiff
path: root/rt/lib/RT/Queue.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-06-04 00:16:28 -0700
committerIvan Kohler <ivan@freeside.biz>2013-06-04 00:16:28 -0700
commit7588a4ac90a9b07c08a3107cd1107d773be1c991 (patch)
tree55b8bedb5f899e705da0ba7f608267943bf89e94 /rt/lib/RT/Queue.pm
parent98d2b25256055abb0dfcb9f586b434474fa97afd (diff)
RT 4.0.13
Diffstat (limited to 'rt/lib/RT/Queue.pm')
-rwxr-xr-xrt/lib/RT/Queue.pm40
1 files changed, 19 insertions, 21 deletions
diff --git a/rt/lib/RT/Queue.pm b/rt/lib/RT/Queue.pm
index a942bb6..ee68b81 100755
--- a/rt/lib/RT/Queue.pm
+++ b/rt/lib/RT/Queue.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -263,14 +263,10 @@ sub Lifecycle {
sub SetLifecycle {
my $self = shift;
- my $value = shift;
+ my $value = shift || 'default';
- if ( $value && $value ne 'default' ) {
- return (0, $self->loc('[_1] is not valid lifecycle', $value ))
- unless $self->ValidateLifecycle( $value );
- } else {
- $value = undef;
- }
+ return ( 0, $self->loc( '[_1] is not a valid lifecycle', $value ) )
+ unless $self->ValidateLifecycle($value);
return $self->_Set( Field => 'Lifecycle', Value => $value, @_ );
}
@@ -410,12 +406,10 @@ sub Create {
return ($val, $msg) unless $val;
}
- if ( $args{'Lifecycle'} && $args{'Lifecycle'} ne 'default' ) {
- return ( 0, $self->loc('Invalid lifecycle name') )
- unless $self->ValidateLifecycle( $args{'Lifecycle'} );
- } else {
- $args{'Lifecycle'} = undef;
- }
+ $args{'Lifecycle'} ||= 'default';
+
+ return ( 0, $self->loc('[_1] is not a valid lifecycle', $args{'Lifecycle'} ) )
+ unless $self->ValidateLifecycle( $args{'Lifecycle'} );
my %attrs = map {$_ => 1} $self->ReadableAttributes;
@@ -871,7 +865,7 @@ PrinicpalId The RT::Principal id of the user or group that's being added as a wa
Email The email address of the new watcher. If a user with this
email address can't be found, a new nonprivileged user will be created.
-If the watcher you\'re trying to set has an RT account, set the Owner parameter to their User Id. Otherwise, set the Email parameter to their Email address.
+If the watcher you're trying to set has an RT account, set the Owner parameter to their User Id. Otherwise, set the Email parameter to their Email address.
Returns a tuple of (status/id, message).
@@ -971,7 +965,8 @@ sub _AddWatcher {
if ( $group->HasMember( $principal)) {
- return ( 0, $self->loc('That principal is already a [_1] for this queue', $args{'Type'}) );
+ return ( 0, $self->loc('[_1] is already a [_2] for this queue',
+ $principal->Object->Name, $args{'Type'}) );
}
@@ -979,7 +974,8 @@ sub _AddWatcher {
unless ($m_id) {
$RT::Logger->error("Failed to add ".$principal->Id." as a member of group ".$group->Id.": ".$m_msg);
- return ( 0, $self->loc('Could not make that principal a [_1] for this queue', $args{'Type'}) );
+ return ( 0, $self->loc('Could not make [_1] a [_2] for this queue',
+ $principal->Object->Name, $args{'Type'}) );
}
return ( 1, $self->loc("Added [_1] to members of [_2] for this queue.", $principal->Object->Name, $args{'Type'} ));
}
@@ -1051,8 +1047,8 @@ sub DeleteWatcher {
# see if this user is already a watcher.
unless ( $group->HasMember($principal)) {
- return ( 0,
- $self->loc('That principal is not a [_1] for this queue', $args{'Type'}) );
+ return ( 0, $self->loc('[_1] is not a [_2] for this queue',
+ $principal->Object->Name, $args{'Type'}) );
}
my ($m_id, $m_msg) = $group->_DeleteMember($principal->Id);
@@ -1060,7 +1056,8 @@ sub DeleteWatcher {
$RT::Logger->error("Failed to delete ".$principal->Id.
" as a member of group ".$group->Id.": ".$m_msg);
- return ( 0, $self->loc('Could not remove that principal as a [_1] for this queue', $args{'Type'}) );
+ return ( 0, $self->loc('Could not remove [_1] as a [_2] for this queue',
+ $principal->Object->Name, $args{'Type'}) );
}
return ( 1, $self->loc("Removed [_1] from members of [_2] for this queue.", $principal->Object->Name, $args{'Type'} ));
@@ -1236,6 +1233,7 @@ sub _Set {
unless ( $self->CurrentUserHasRight('AdminQueue') ) {
return ( 0, $self->loc('Permission Denied') );
}
+ RT->System->QueueCacheNeedsUpdate(1);
return ( $self->SUPER::_Set(@_) );
}
@@ -1560,7 +1558,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 =>