X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FQueue.pm;h=ee68b819518d3df7f6f086779f6c076807913330;hp=a942bb6d74b8d08d877d375f3ac7ad74923213e2;hb=7588a4ac90a9b07c08a3107cd1107d773be1c991;hpb=98d2b25256055abb0dfcb9f586b434474fa97afd diff --git a/rt/lib/RT/Queue.pm b/rt/lib/RT/Queue.pm index a942bb6d7..ee68b8195 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 # # # (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 =>