[Rt-commit] rt branch, 4.0/updated-by-ticketsql, created. rt-4.0.10-132-gad250c5
Ruslan Zakirov
ruz at bestpractical.com
Fri Mar 22 08:22:48 EDT 2013
The branch, 4.0/updated-by-ticketsql has been created
at ad250c5211aefa1b15c99e306f2dd7e974eabef0 (commit)
- Log -----------------------------------------------------------------
commit ad250c5211aefa1b15c99e306f2dd7e974eabef0
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Mar 22 16:20:38 2013 +0400
UpdatedBy TicketSQL keyword
Allows to search tickets that were updated by a user at some point.
When combined with Updated also limits by time span.
diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index 39efecd..6ab6abd 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -146,6 +146,7 @@ our %FIELD_METADATA = (
CustomField => [ 'CUSTOMFIELD', ], #loc_left_pair
CF => [ 'CUSTOMFIELD', ], #loc_left_pair
Updated => [ 'TRANSDATE', ], #loc_left_pair
+ UpdatedBy => [ 'TRANSCREATOR', ], #loc_left_pair
RequestorGroup => [ 'MEMBERSHIPFIELD' => 'Requestor', ], #loc_left_pair
CCGroup => [ 'MEMBERSHIPFIELD' => 'Cc', ], #loc_left_pair
AdminCCGroup => [ 'MEMBERSHIPFIELD' => 'AdminCc', ], #loc_left_pair
@@ -175,6 +176,7 @@ our %dispatch = (
TRANSFIELD => \&_TransLimit,
TRANSCONTENT => \&_TransContentLimit,
TRANSDATE => \&_TransDateLimit,
+ TRANSCREATOR => \&_TransCreatorLimit,
WATCHERFIELD => \&_WatcherLimit,
MEMBERSHIPFIELD => \&_WatcherMembershipLimit,
CUSTOMFIELD => \&_CustomFieldLimit,
@@ -695,6 +697,21 @@ sub _TransDateLimit {
$sb->_CloseParen;
}
+sub _TransCreatorLimit {
+ my ( $sb, $field, $op, $value, @rest ) = @_;
+ $op = "!=" if $op eq "<>";
+ die "Invalid Operation: $op for $field" unless $op eq "=" or $op eq "!=";
+
+ # See the comments for TransLimit, they apply here too
+ my $txn_alias = $sb->JoinTransactions;
+ if ( defined $value && $value !~ /^\d+$/ ) {
+ my $u = RT::User->new( $sb->CurrentUser );
+ $u->Load($value);
+ $value = $u->id || 0;
+ }
+ $sb->_SQLLimit( ALIAS => $txn_alias, FIELD => 'Creator', OPERATOR => $op, VALUE => $value, @rest );
+}
+
=head2 _TransLimit
Limit based on the ContentType or the Filename of a transaction.
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list