[Rt-commit] rt branch, 4.6/txn-query-builder-with-new-themes, repushed
? sunnavy
sunnavy at bestpractical.com
Tue Dec 10 07:00:34 EST 2019
The branch 4.6/txn-query-builder-with-new-themes was deleted and repushed:
was 127c50b88f0ee4540d2b9c890fbd7ea707c19c28
now a896b4d1b268199f2bdc1920164d410425449dcb
1: 457762464c ! 1: 17fde7e07d Initial ticket transaction query builder
@@ -337,6 +337,42 @@
sub Table { 'Transactions'}
+ # {{{ sub _Init
+ sub _Init {
+- my $self = shift;
+-
+- $self->{'table'} = "Transactions";
+- $self->{'primary_key'} = "id";
+-
+- # By default, order by the date of the transaction, rather than ID.
+- $self->OrderByCols( { FIELD => 'Created',
+- ORDER => 'ASC' },
+- { FIELD => 'id',
+- ORDER => 'ASC' } );
++ my $self = shift;
++
++ $self->{'table'} = "Transactions";
++ $self->{'primary_key'} = "id";
++
++ # By default, order by the date of the transaction, rather than ID.
++ $self->OrderByCols( { FIELD => 'Created',
++ ORDER => 'ASC' },
++ { FIELD => 'id',
++ ORDER => 'ASC' } );
+
+- return ( $self->SUPER::_Init(@_));
++ $self->SUPER::_Init(@_);
++ $self->_InitSQL();
++}
++
++sub _InitSQL {
++ my $self = shift;
++ # Private Member Variables (which should get cleaned)
++ $self->{'_sql_query'} = '';
++ $self->{'_sql_looking_at'} = {};
+ }
+
+ =head2 LimitToTicket TICKETID
@@
return $self->SUPER::AddRecord($record);
}
@@ -384,6 +420,7 @@
+ TicketPriority => ['TICKETFIELD'], #loc_left_pair
+ TicketInitialPriority => ['TICKETFIELD'], #loc_left_pair
+ TicketFinalPriority => ['TICKETFIELD'], #loc_left_pair
++ TicketType => ['TICKETFIELD'], #loc_left_pair
+ TicketQueueLifecycle => ['TICKETQUEUEFIELD'], #loc_left_pair
+
+ CustomFieldName => ['CUSTOMFIELDNAME'], #loc_left_pair
@@ -1018,6 +1055,7 @@
+ $value = $user->id if $user->id;
+ }
+
++ $self->{_sql_looking_at}{ lc "ticket$field" } = 1;
+ $self->Limit(
+ %rest,
+ ALIAS => $self->_JoinTickets,
@@ -1072,6 +1110,8 @@
+ $args{SUBCLAUSE} ||= "txnsql"
+ if $self->{parsing_txnsql} and not $args{LEFTJOIN};
+
++ $self->{_sql_looking_at}{ lc $args{FIELD} }{ $args{VALUE} } = 1
++ if $args{FIELD} and ( not $args{ALIAS} or $args{ALIAS} eq "main" );
+ $self->SUPER::Limit(%args);
+}
+
@@ -1242,6 +1282,7 @@
+ my ($self,$query) = @_;
+
+ $self->CleanSlate;
++ $self->_InitSQL;
+
+ return (1, $self->loc("No Query")) unless $query;
+
@@ -1256,14 +1297,22 @@
+ return (0, $error);
+ }
+
-+ $self->Limit( FIELD => 'ObjectType', VALUE => 'RT::Ticket' );
-+ $self->Limit(
-+ ALIAS => $self->_JoinTickets,
-+ FIELD => 'Type',
-+ OPERATOR => '=',
-+ VALUE => 'ticket',
-+ CASESENSITIVE => 0,
-+ );
++ if ( !$self->{_sql_looking_at}{objecttype} ) {
++ $self->Limit( FIELD => 'ObjectType', VALUE => 'RT::Ticket' );
++ $self->{_sql_looking_at}{objecttype}{'RT::Ticket'} = 1;
++ }
++
++ if ( $self->{_sql_looking_at}{objecttype}{'RT::Ticket'} ) {
++ if ( !$self->{_sql_looking_at}{tickettype} ) {
++ $self->Limit(
++ ALIAS => $self->_JoinTickets,
++ FIELD => 'Type',
++ OPERATOR => '=',
++ VALUE => 'ticket',
++ CASESENSITIVE => 0,
++ );
++ }
++ }
+
+ # set SB's dirty flag
+ $self->{'must_redo_search'} = 1;
2: 9a186b1295 = 2: 57dec7ad98 Resolve the inconsistent $Class param in Search and CollectionAsTable
3: 99f4dcdfda = 3: a4ad1d535f Add support to clip long search result columns
4: 1b6abdd28c = 4: 44c48a98d6 Add transaction search tests
5: f6e4814f80 = 5: c5715e5100 Add transaction query builder tests
6: 127c50b88f = 6: a896b4d1b2 Add Transactions to query builder docs
More information about the rt-commit
mailing list