1 # BEGIN BPS TAGGED BLOCK {{{
5 # This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
6 # <sales@bestpractical.com>
8 # (Except where explicitly superseded by other copyright notices)
13 # This work is made available to you under the terms of Version 2 of
14 # the GNU General Public License. A copy of that license should have
15 # been provided with this software, but in any event can be snarfed
18 # This work is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 # General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 # 02110-1301 or visit their web page on the internet at
27 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
30 # CONTRIBUTION SUBMISSION POLICY:
32 # (The following paragraph is not intended to limit the rights granted
33 # to you to modify and distribute this software under the terms of
34 # the GNU General Public License and is only of importance to you if
35 # you choose to contribute your changes and enhancements to the
36 # community by submitting them to Best Practical Solutions, LLC.)
38 # By intentionally submitting any modifications, corrections or
39 # derivatives to this work, or any other work intended for use with
40 # Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 # you are the copyright holder for those contributions and you grant
42 # Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43 # royalty-free, perpetual, license to use, copy, create derivative
44 # works based on those contributions, and sublicense and distribute
45 # those contributions and any derivatives thereof.
47 # END BPS TAGGED BLOCK }}}
51 RT::Queue - an RT Queue object
70 use base 'RT::Record';
72 use Role::Basic 'with';
73 with "RT::Record::Role::Lifecycle",
74 "RT::Record::Role::Links" => { -excludes => ["_AddLinksOnCreate"] },
75 "RT::Record::Role::Roles",
76 "RT::Record::Role::Rights";
80 sub LifecycleType { "ticket" }
82 sub ModifyLinkRight { "AdminQueue" }
85 RT::ACE->RegisterCacheHandler(sub {
92 return unless $args{Action} =~ /^(Grant|Revoke)$/i
93 and $args{RightName} =~ /^(SeeQueue|CreateTicket)$/;
95 RT->System->QueueCacheNeedsUpdate(1);
100 use RT::Interface::Email;
102 __PACKAGE__->AddRight( General => SeeQueue => 'View queue' ); # loc
103 __PACKAGE__->AddRight( Admin => AdminQueue => 'Create, modify and delete queue' ); # loc
104 __PACKAGE__->AddRight( Admin => ShowACL => 'Display Access Control List' ); # loc
105 __PACKAGE__->AddRight( Admin => ModifyACL => 'Create, modify and delete Access Control List entries' ); # loc
106 __PACKAGE__->AddRight( Admin => ModifyQueueWatchers => 'Modify queue watchers' ); # loc
107 __PACKAGE__->AddRight( General => SeeCustomField => 'View custom field values' ); # loc
108 __PACKAGE__->AddRight( Staff => ModifyCustomField => 'Modify custom field values' ); # loc
109 __PACKAGE__->AddRight( Admin => AssignCustomFields => 'Assign and remove queue custom fields' ); # loc
110 __PACKAGE__->AddRight( Admin => ModifyTemplate => 'Modify Scrip templates' ); # loc
111 __PACKAGE__->AddRight( Admin => ShowTemplate => 'View Scrip templates' ); # loc
113 __PACKAGE__->AddRight( Admin => ModifyScrips => 'Modify Scrips' ); # loc
114 __PACKAGE__->AddRight( Admin => ShowScrips => 'View Scrips' ); # loc
116 __PACKAGE__->AddRight( General => ShowTicket => 'View ticket summaries' ); # loc
117 __PACKAGE__->AddRight( Staff => ShowTicketComments => 'View ticket private commentary' ); # loc
118 __PACKAGE__->AddRight( Staff => ShowOutgoingEmail => 'View exact outgoing email messages and their recipients' ); # loc
120 __PACKAGE__->AddRight( General => Watch => 'Sign up as a ticket Requestor or ticket or queue Cc' ); # loc
121 __PACKAGE__->AddRight( Staff => WatchAsAdminCc => 'Sign up as a ticket or queue AdminCc' ); # loc
122 __PACKAGE__->AddRight( General => CreateTicket => 'Create tickets' ); # loc
123 __PACKAGE__->AddRight( General => ReplyToTicket => 'Reply to tickets' ); # loc
124 __PACKAGE__->AddRight( General => CommentOnTicket => 'Comment on tickets' ); # loc
125 __PACKAGE__->AddRight( Staff => OwnTicket => 'Own tickets' ); # loc
126 __PACKAGE__->AddRight( Staff => ModifyTicket => 'Modify tickets' ); # loc
127 __PACKAGE__->AddRight( Staff => DeleteTicket => 'Delete tickets' ); # loc
128 __PACKAGE__->AddRight( Staff => TakeTicket => 'Take tickets' ); # loc
129 __PACKAGE__->AddRight( Staff => StealTicket => 'Steal tickets' ); # loc
130 __PACKAGE__->AddRight( Staff => ReassignTicket => 'Modify ticket owner on owned tickets' ); # loc
132 __PACKAGE__->AddRight( Staff => ForwardMessage => 'Forward messages outside of RT' ); # loc
136 Arguments: ARGS is a hash of named parameters. Valid parameters are:
146 If you pass the ACL check, it creates the queue and returns its queue id.
156 CorrespondAddress => '',
157 CommentAddress => '',
158 Lifecycle => 'default',
160 InitialPriority => 0,
166 _RecordTransaction => 1,
170 unless ( $self->CurrentUser->HasRight(Right => 'AdminQueue', Object => $RT::System) )
172 return ( 0, $self->loc("No permission to create queues") );
176 my ($val, $msg) = $self->_ValidateName( $args{'Name'} );
177 return ($val, $msg) unless $val;
180 $args{'Lifecycle'} ||= 'default';
182 return ( 0, $self->loc('[_1] is not a valid lifecycle', $args{'Lifecycle'} ) )
183 unless $self->ValidateLifecycle( $args{'Lifecycle'} );
185 my %attrs = map {$_ => 1} $self->ReadableAttributes;
187 #TODO better input validation
188 $RT::Handle->BeginTransaction();
189 my $id = $self->SUPER::Create( map { $_ => $args{$_} } grep exists $args{$_}, keys %attrs );
191 $RT::Handle->Rollback();
192 return ( 0, $self->loc('Queue could not be created') );
195 my $create_ret = $self->_CreateRoleGroups();
196 unless ($create_ret) {
197 $RT::Handle->Rollback();
198 return ( 0, $self->loc('Queue could not be created') );
200 if ( $args{'_RecordTransaction'} ) {
201 $self->_NewTransaction( Type => "Create" );
205 for my $attr (qw/Sign SignAuto Encrypt/) {
206 next unless defined $args{$attr};
207 my $set = "Set" . $attr;
208 my ($status, $msg) = $self->$set( $args{$attr} );
209 $RT::Logger->error("Couldn't set attribute '$attr': $msg")
213 RT->System->QueueCacheNeedsUpdate(1);
215 return ( $id, $self->loc("Queue created") );
223 $self->loc('Deleting this object would break referential integrity') );
231 1 will cause this queue to no longer be available for tickets.
232 0 will re-enable this queue.
240 $RT::Handle->BeginTransaction();
241 my ($ok, $msg) = $self->_Set( Field =>'Disabled', Value => $val);
243 $RT::Handle->Rollback();
244 $RT::Logger->warning("Couldn't ".(($val == 0) ? "enable" : "disable")." queue ".$self->Name.": $msg");
247 $self->_NewTransaction( Type => ($val == 0) ? "Enabled" : "Disabled" );
249 $RT::Handle->Commit();
251 RT->System->QueueCacheNeedsUpdate(1);
254 return (1, $self->loc("Queue enabled"));
256 return (1, $self->loc("Queue disabled"));
265 Takes either a numerical id or a textual Name and loads the specified queue.
272 my $identifier = shift;
273 if ( !$identifier ) {
277 if ( $identifier =~ /^(\d+)$/ ) {
278 $self->SUPER::LoadById($identifier);
281 $self->LoadByCols( Name => $identifier );
284 return ( $self->Id );
290 =head2 ValidateName NAME
292 Takes a queue name. Returns true if it's an ok name for
293 a new queue. Returns undef if there's already a queue by that name.
301 my ($ok, $msg) = $self->_ValidateName($name);
310 return (undef, "Queue name is required") unless length $name;
312 # Validate via the superclass first
313 # Case: short circuit if it's an integer so we don't have
314 # fale negatives when loading a temp queue
315 unless ( my $q = $self->SUPER::ValidateName($name) ) {
316 return ($q, $self->loc("'[_1]' is not a valid name.", $name));
319 my $tempqueue = RT::Queue->new(RT->SystemUser);
320 $tempqueue->Load($name);
322 #If this queue exists, return undef
323 if ( $tempqueue->Name() && $tempqueue->id != $self->id) {
324 return (undef, $self->loc("Queue already exists") );
339 return undef unless $self->CurrentUserHasRight('SeeQueue');
340 my $attr = $self->FirstAttribute('Sign') or return 0;
341 return $attr->Content;
348 return ( 0, $self->loc('Permission Denied') )
349 unless $self->CurrentUserHasRight('AdminQueue');
351 my ($status, $msg) = $self->SetAttribute(
353 Description => 'Sign outgoing messages by default',
356 return ($status, $msg) unless $status;
357 return ($status, $self->loc('Signing enabled')) if $value;
358 return ($status, $self->loc('Signing disabled'));
365 return undef unless $self->CurrentUserHasRight('SeeQueue');
366 my $attr = $self->FirstAttribute('SignAuto') or return 0;
367 return $attr->Content;
374 return ( 0, $self->loc('Permission Denied') )
375 unless $self->CurrentUserHasRight('AdminQueue');
377 my ($status, $msg) = $self->SetAttribute(
379 Description => 'Sign auto-generated outgoing messages',
382 return ($status, $msg) unless $status;
383 return ($status, $self->loc('Signing enabled')) if $value;
384 return ($status, $self->loc('Signing disabled'));
391 return undef unless $self->CurrentUserHasRight('SeeQueue');
392 my $attr = $self->FirstAttribute('Encrypt') or return 0;
393 return $attr->Content;
400 return ( 0, $self->loc('Permission Denied') )
401 unless $self->CurrentUserHasRight('AdminQueue');
403 my ($status, $msg) = $self->SetAttribute(
405 Description => 'Encrypt outgoing messages by default',
408 return ($status, $msg) unless $status;
409 return ($status, $self->loc('Encrypting enabled')) if $value;
410 return ($status, $self->loc('Encrypting disabled'));
415 Returns an RT::Templates object of all of this queue's templates.
422 my $templates = RT::Templates->new( $self->CurrentUser );
424 if ( $self->CurrentUserHasRight('ShowTemplate') ) {
425 $templates->LimitToQueue( $self->id );
434 =head2 CustomField NAME
436 Load the Ticket Custom Field applied to this Queue named NAME.
437 Does not load Global custom fields.
444 my $cf = RT::CustomField->new($self->CurrentUser);
447 LookupType => RT::Ticket->CustomFieldLookupType,
448 ObjectId => $self->id,
455 =head2 TicketCustomFields
457 Returns an L<RT::CustomFields> object containing all global and
458 queue-specific B<ticket> custom fields.
462 sub TicketCustomFields {
465 my $cfs = RT::CustomFields->new( $self->CurrentUser );
466 if ( $self->CurrentUserHasRight('SeeQueue') ) {
467 $cfs->SetContextObject( $self );
468 $cfs->LimitToGlobalOrObjectId( $self->Id );
469 $cfs->LimitToLookupType( 'RT::Queue-RT::Ticket' );
470 $cfs->ApplySortOrder;
477 =head2 TicketTransactionCustomFields
479 Returns an L<RT::CustomFields> object containing all global and
480 queue-specific B<transaction> custom fields.
484 sub TicketTransactionCustomFields {
487 my $cfs = RT::CustomFields->new( $self->CurrentUser );
488 if ( $self->CurrentUserHasRight('SeeQueue') ) {
489 $cfs->SetContextObject( $self );
490 $cfs->LimitToGlobalOrObjectId( $self->Id );
491 $cfs->LimitToLookupType( 'RT::Queue-RT::Ticket-RT::Transaction' );
492 $cfs->ApplySortOrder;
501 =head2 AllRoleGroupTypes
503 B<DEPRECATED> and will be removed in a future release. Use L</Roles>
506 Returns a list of the names of the various role group types for Queues,
507 including roles used only for ACLs like Requestor and Owner. If you don't want
508 them, see L</ManageableRoleGroupTypes>.
512 sub AllRoleGroupTypes {
515 Instead => "RT::Queue->Roles",
520 =head2 IsRoleGroupType
522 B<DEPRECATED> and will be removed in a future release. Use L</HasRole> instead.
524 Returns whether the passed-in type is a role group type.
528 sub IsRoleGroupType {
531 Instead => "RT::Queue->HasRole",
536 =head2 ManageableRoleGroupTypes
538 Returns a list of the names of the various role group types for Queues,
539 excluding ones used only for ACLs such as Requestor and Owner. If you want
544 sub ManageableRoleGroupTypes {
545 shift->Roles( ACLOnly => 0 )
548 =head2 IsManageableRoleGroupType
550 Returns whether the passed-in type is a manageable role group type.
554 sub IsManageableRoleGroupType {
557 return( $self->HasRole($type) and not $self->Role($type)->{ACLOnly} );
561 sub _HasModifyWatcherRight {
563 my ($type, $principal) = @_;
565 # ModifyQueueWatchers works in any case
566 return 1 if $self->CurrentUserHasRight('ModifyQueueWatchers');
567 # If the watcher isn't the current user then the current user has no right
568 return 0 unless $self->CurrentUser->PrincipalId == $principal->id;
569 # If it's an AdminCc and they don't have 'WatchAsAdminCc', bail
570 return 0 if $type eq 'AdminCc' and not $self->CurrentUserHasRight('WatchAsAdminCc');
571 # If it's a Requestor or Cc and they don't have 'Watch', bail
572 return 0 if ($type eq "Cc" or $type eq 'Requestor')
573 and not $self->CurrentUserHasRight('Watch');
580 Applies access control checking, then calls
581 L<RT::Record::Role::Roles/AddRoleMember>. Additionally, C<Email> is
582 accepted as an alternative argument name for C<User>.
584 Returns a tuple of (status, message).
592 PrincipalId => undef,
597 $args{ACL} = sub { $self->_HasModifyWatcherRight( @_ ) };
598 $args{User} ||= delete $args{Email};
599 my ($principal, $msg) = $self->AddRoleMember( %args );
600 return ( 0, $msg) unless $principal;
602 return ( 1, $self->loc("Added [_1] to members of [_2] for this queue.",
603 $principal->Object->Name, $self->loc($args{'Type'}) ));
609 Applies access control checking, then calls
610 L<RT::Record::Role::Roles/DeleteRoleMember>. Additionally, C<Email> is
611 accepted as an alternative argument name for C<User>.
613 Returns a tuple of (status, message).
622 PrincipalId => undef,
627 $args{ACL} = sub { $self->_HasModifyWatcherRight( @_ ) };
628 $args{User} ||= delete $args{Email};
629 my ($principal, $msg) = $self->DeleteRoleMember( %args );
630 return ( 0, $msg) unless $principal;
632 return ( 1, $self->loc("Removed [_1] from members of [_2] for this queue.",
633 $principal->Object->Name, $self->loc($args{'Type'}) ));
638 =head2 AdminCcAddresses
640 returns String: All queue AdminCc email addresses as a string
644 sub AdminCcAddresses {
647 unless ( $self->CurrentUserHasRight('SeeQueue') ) {
651 return ( $self->AdminCc->MemberEmailAddressesAsString )
659 returns String: All queue Ccs as a string of email addresses
666 unless ( $self->CurrentUserHasRight('SeeQueue') ) {
670 return ( $self->Cc->MemberEmailAddressesAsString);
679 Returns an RT::Group object which contains this Queue's Ccs.
680 If the user doesn't have "ShowQueue" permission, returns an empty group
687 return RT::Group->new($self->CurrentUser)
688 unless $self->CurrentUserHasRight('SeeQueue');
689 return $self->RoleGroup( 'Cc' );
697 Returns an RT::Group object which contains this Queue's AdminCcs.
698 If the user doesn't have "ShowQueue" permission, returns an empty group
705 return RT::Group->new($self->CurrentUser)
706 unless $self->CurrentUserHasRight('SeeQueue');
707 return $self->RoleGroup( 'AdminCc' );
712 # a generic routine to be called by IsRequestor, IsCc and IsAdminCc
714 =head2 IsWatcher { Type => TYPE, PrincipalId => PRINCIPAL_ID }
716 Takes a param hash with the attributes Type and PrincipalId
718 Type is one of Requestor, Cc, AdminCc and Owner
720 PrincipalId is an RT::Principal id
722 Returns true if that principal is a member of the group Type for this queue
730 my %args = ( Type => 'Cc',
731 PrincipalId => undef,
735 # Load the relevant group.
736 my $group = $self->RoleGroup( $args{'Type'} );
737 # Ask if it has the member in question
739 my $principal = RT::Principal->new($self->CurrentUser);
740 $principal->Load($args{'PrincipalId'});
741 unless ($principal->Id) {
745 return ($group->HasMemberRecursively($principal));
751 =head2 IsCc PRINCIPAL_ID
753 Takes an RT::Principal id.
754 Returns true if the principal is a requestor of the current queue.
763 return ( $self->IsWatcher( Type => 'Cc', PrincipalId => $cc ) );
769 =head2 IsAdminCc PRINCIPAL_ID
771 Takes an RT::Principal id.
772 Returns true if the principal is a requestor of the current queue.
780 return ( $self->IsWatcher( Type => 'AdminCc', PrincipalId => $person ) );
796 unless ( $self->CurrentUserHasRight('AdminQueue') ) {
797 return ( 0, $self->loc('Permission Denied') );
799 RT->System->QueueCacheNeedsUpdate(1);
800 return ( $self->SUPER::_Set(@_) );
808 unless ( $self->CurrentUserHasRight('SeeQueue') ) {
812 return ( $self->__Value(@_) );
815 =head2 CurrentUserCanSee
817 Returns true if the current user can see the queue, using SeeQueue
821 sub CurrentUserCanSee {
824 return $self->CurrentUserHasRight('SeeQueue');
829 Returns the current value of id.
830 (In the database, id is stored as int(11).)
838 Returns the current value of Name.
839 (In the database, Name is stored as varchar(200).)
847 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
848 (In the database, Name will be stored as a varchar(200).)
856 Returns the current value of Description.
857 (In the database, Description is stored as varchar(255).)
861 =head2 SetDescription VALUE
864 Set Description to VALUE.
865 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
866 (In the database, Description will be stored as a varchar(255).)
872 =head2 CorrespondAddress
874 Returns the current value of CorrespondAddress.
875 (In the database, CorrespondAddress is stored as varchar(120).)
879 =head2 SetCorrespondAddress VALUE
882 Set CorrespondAddress to VALUE.
883 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
884 (In the database, CorrespondAddress will be stored as a varchar(120).)
890 =head2 CommentAddress
892 Returns the current value of CommentAddress.
893 (In the database, CommentAddress is stored as varchar(120).)
897 =head2 SetCommentAddress VALUE
900 Set CommentAddress to VALUE.
901 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
902 (In the database, CommentAddress will be stored as a varchar(120).)
910 Returns the current value of Lifecycle.
911 (In the database, Lifecycle is stored as varchar(32).)
915 =head2 SetLifecycle VALUE
918 Set Lifecycle to VALUE.
919 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
920 (In the database, Lifecycle will be stored as a varchar(32).)
927 Returns the current value of SubjectTag.
928 (In the database, SubjectTag is stored as varchar(120).)
932 =head2 SetSubjectTag VALUE
935 Set SubjectTag to VALUE.
936 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
937 (In the database, SubjectTag will be stored as a varchar(120).)
943 =head2 InitialPriority
945 Returns the current value of InitialPriority.
946 (In the database, InitialPriority is stored as int(11).)
950 =head2 SetInitialPriority VALUE
953 Set InitialPriority to VALUE.
954 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
955 (In the database, InitialPriority will be stored as a int(11).)
963 Returns the current value of FinalPriority.
964 (In the database, FinalPriority is stored as int(11).)
968 =head2 SetFinalPriority VALUE
971 Set FinalPriority to VALUE.
972 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
973 (In the database, FinalPriority will be stored as a int(11).)
981 Returns the current value of DefaultDueIn.
982 (In the database, DefaultDueIn is stored as int(11).)
986 =head2 SetDefaultDueIn VALUE
989 Set DefaultDueIn to VALUE.
990 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
991 (In the database, DefaultDueIn will be stored as a int(11).)
999 Returns the current value of Creator.
1000 (In the database, Creator is stored as int(11).)
1008 Returns the current value of Created.
1009 (In the database, Created is stored as datetime.)
1015 =head2 LastUpdatedBy
1017 Returns the current value of LastUpdatedBy.
1018 (In the database, LastUpdatedBy is stored as int(11).)
1026 Returns the current value of LastUpdated.
1027 (In the database, LastUpdated is stored as datetime.)
1035 Returns the current value of Disabled.
1036 (In the database, Disabled is stored as smallint(6).)
1040 =head2 SetDisabled VALUE
1043 Set Disabled to VALUE.
1044 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
1045 (In the database, Disabled will be stored as a smallint(6).)
1052 sub _CoreAccessible {
1056 {read => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''},
1058 {read => 1, write => 1, sql_type => 12, length => 200, is_blob => 0, is_numeric => 0, type => 'varchar(200)', default => ''},
1060 {read => 1, write => 1, sql_type => 12, length => 255, is_blob => 0, is_numeric => 0, type => 'varchar(255)', default => ''},
1061 CorrespondAddress =>
1062 {read => 1, write => 1, sql_type => 12, length => 120, is_blob => 0, is_numeric => 0, type => 'varchar(120)', default => ''},
1064 {read => 1, write => 1, sql_type => 12, length => 120, is_blob => 0, is_numeric => 0, type => 'varchar(120)', default => ''},
1066 {read => 1, write => 1, sql_type => 12, length => 120, is_blob => 0, is_numeric => 0, type => 'varchar(120)', default => ''},
1068 {read => 1, write => 1, sql_type => 12, length => 32, is_blob => 0, is_numeric => 0, type => 'varchar(32)', default => 'default'},
1070 {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
1072 {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
1074 {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
1076 {read => 1, auto => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
1078 {read => 1, auto => 1, sql_type => 11, length => 0, is_blob => 0, is_numeric => 0, type => 'datetime', default => ''},
1080 {read => 1, auto => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
1082 {read => 1, auto => 1, sql_type => 11, length => 0, is_blob => 0, is_numeric => 0, type => 'datetime', default => ''},
1084 {read => 1, write => 1, sql_type => 5, length => 6, is_blob => 0, is_numeric => 1, type => 'smallint(6)', default => '0'},
1089 sub FindDependencies {
1091 my ($walker, $deps) = @_;
1093 $self->SUPER::FindDependencies($walker, $deps);
1095 # Queue role groups( Cc, AdminCc )
1096 my $objs = RT::Groups->new( $self->CurrentUser );
1097 $objs->Limit( FIELD => 'Domain', VALUE => 'RT::Queue-Role', CASESENSITIVE => 0 );
1098 $objs->Limit( FIELD => 'Instance', VALUE => $self->Id );
1099 $deps->Add( in => $objs );
1102 $objs = RT::ObjectScrips->new( $self->CurrentUser );
1103 $objs->Limit( FIELD => 'ObjectId',
1106 ENTRYAGGREGATOR => 'OR' );
1107 $objs->Limit( FIELD => 'ObjectId',
1110 ENTRYAGGREGATOR => 'OR' );
1111 $deps->Add( in => $objs );
1113 # Templates (global ones have already been dealt with)
1114 $objs = RT::Templates->new( $self->CurrentUser );
1115 $objs->Limit( FIELD => 'Queue', VALUE => $self->Id);
1116 $deps->Add( in => $objs );
1118 # Custom Fields on things _in_ this queue (CFs on the queue itself
1119 # have already been dealt with)
1120 $objs = RT::ObjectCustomFields->new( $self->CurrentUser );
1121 $objs->Limit( FIELD => 'ObjectId',
1124 ENTRYAGGREGATOR => 'OR' );
1125 $objs->Limit( FIELD => 'ObjectId',
1128 ENTRYAGGREGATOR => 'OR' );
1129 my $cfs = $objs->Join(
1131 FIELD1 => 'CustomField',
1132 TABLE2 => 'CustomFields',
1135 $objs->Limit( ALIAS => $cfs,
1136 FIELD => 'LookupType',
1137 OPERATOR => 'STARTSWITH',
1138 VALUE => 'RT::Queue-' );
1139 $deps->Add( in => $objs );
1142 $objs = RT::Tickets->new( $self->CurrentUser );
1143 $objs->Limit( FIELD => "Queue", VALUE => $self->Id );
1144 $objs->{allow_deleted_search} = 1;
1145 $deps->Add( in => $objs );
1152 Dependencies => undef,
1155 my $deps = $args{'Dependencies'};
1159 my $objs = RT::Tickets->new( $self->CurrentUser );
1160 $objs->{'allow_deleted_search'} = 1;
1161 $objs->Limit( FIELD => 'Queue', VALUE => $self->Id );
1162 push( @$list, $objs );
1164 # Queue role groups( Cc, AdminCc )
1165 $objs = RT::Groups->new( $self->CurrentUser );
1166 $objs->Limit( FIELD => 'Domain', VALUE => 'RT::Queue-Role', CASESENSITIVE => 0 );
1167 $objs->Limit( FIELD => 'Instance', VALUE => $self->Id );
1168 push( @$list, $objs );
1171 $objs = RT::Scrips->new( $self->CurrentUser );
1172 $objs->LimitToQueue( $self->id );
1173 push( @$list, $objs );
1176 $objs = $self->Templates;
1177 push( @$list, $objs );
1180 $objs = RT::CustomFields->new( $self->CurrentUser );
1181 $objs->SetContextObject( $self );
1182 $objs->LimitToQueue( $self->id );
1183 push( @$list, $objs );
1185 $deps->_PushDependencies(
1186 BaseObject => $self,
1187 Flags => RT::Shredder::Constants::DEPENDS_ON,
1188 TargetObjects => $list,
1189 Shredder => $args{'Shredder'}
1191 return $self->SUPER::__DependsOn( %args );
1197 my ($importer, $uid, $data) = @_;
1199 $class->SUPER::PreInflate( $importer, $uid, $data );
1201 $data->{Name} = $importer->Qualify($data->{Name})
1202 if $data->{Name} ne "___Approvals";
1204 return if $importer->MergeBy( "Name", $class, $uid, $data );
1211 RT::Base->_ImportOverlays();