RT 5.0.6 Documentation


Go to latest version →


  RT::SearchBuilder - a baseclass for RT collection objects





Only find items that haven't been disabled


Only find items that have been deleted.


Find all matching rows, regardless of whether they are disabled or not


Takes a paramhash of key/value pairs with the following keys:

CUSTOMFIELD - CustomField id. Optional
OPERATOR - The usual Limit operators
VALUE - The value to compare against


Returns class name of records in this collection. This generic implementation just strips trailing 's'.


Returns report class name of this collection. E.g. report class of RT::Tickets is RT::Report::Tickets


Takes a pair of arguments, the first a class name and the second a callback function. The class will be used to call "CustomFieldLookupType" in RT::Record. The callback will be called when limiting a collection of the caller's class by a CF of the passed class's lookup type.

The callback is passed a single argument, the current collection object ($self).

An example from RT::Tickets:

        "RT::Transaction" => sub { $_[0]->JoinTransactions }

Returns true on success, undef on failure.


Takes an RT::CustomField LookupType and joins this collection as appropriate to reach the object records to which LookupType applies. The object records will be of the class returned by "ObjectTypeFromLookupType" in RT::CustomField.

Returns the join alias suitable for further limiting against object properties.

Returns undef on failure.

Used by "_CustomFieldJoin".


Factor out the Join of custom fields so we can use it for sorting too


This Limit sub calls SUPER::Limit, but defaults "CASESENSITIVE" to 1, thus making sure that by default lots of things don't do extra work trying to match lower(colname) against lc($val);

We also force VALUE to NULL when the OPERATOR is IS or IS NOT. This ensures that we don't pass invalid SQL to the database or allow SQL injection attacks when we pass through user specified values.


If it has a SortOrder attribute, sort the array by SortOrder. Otherwise, if it has a "Name" attribute, sort alphabetically by Name Otherwise, just give up and return it in the order it came from the db.


Return this object's ItemsArray, in the order that ItemsOrderBy sorts it.


ColumnMap needs a Collection name to load the correct list display. Depluralization is hard, so provide an easy way to correct the naive algorithm that this code uses.


Returns a new item based on "RecordClass" using the current user.


Takes a paramhash with an optional FIELD key whose value is the name of a date column. If no FIELD is provided, a literal ? placeholder is used so the caller can fill in the field later.

Returns a SQL function which evaluates to NULL if the FIELD is set to the Unix epoch; otherwise it evaluates to FIELD. This is useful because RT currently stores unset dates as a Unix epoch timestamp instead of NULL, but NULLs are often more desireable.

← Back to index