[Rt-commit] rt branch, 4.0/updated-by-ticketsql, created. rt-4.0.13-49-gb5236ea

Ruslan Zakirov ruz at bestpractical.com
Thu May 30 07:04:15 EDT 2013


The branch, 4.0/updated-by-ticketsql has been created
        at  b5236eaaa5fc42ece2557686f734f37e68028a34 (commit)

- Log -----------------------------------------------------------------
commit b5236eaaa5fc42ece2557686f734f37e68028a34
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 41aa313..8395c53 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,
@@ -699,6 +701,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.
diff --git a/share/html/Search/Elements/PickBasics b/share/html/Search/Elements/PickBasics
index 66cabbe..258ef92 100644
--- a/share/html/Search/Elements/PickBasics
+++ b/share/html/Search/Elements/PickBasics
@@ -114,6 +114,7 @@ my @lines = (
                 Owner => loc('Owner'),
                 Creator => loc('Creator'),
                 LastUpdatedBy => loc('Last updated by'),
+                UpdatedBy => loc('Updated by'),
             ],
         },
         Op => {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list