[Rt-commit] rt branch, 4.2/use-in-operator, repushed
Alex Vandiver
alexmv at bestpractical.com
Wed Nov 12 18:09:34 EST 2014
The branch 4.2/use-in-operator was deleted and repushed:
was 5a73f64788bfe3db6384ca9db13db9d435160abf
now e325424b9062dc8040ecbe93cf352bf1b999abc0
1: 5a73f64 ! 1: e325424 When possible, switch to IN or NOT IN rather than multiple OR'd clauses
@@ -12,13 +12,33 @@
Unfortunately, DBIx::SearchBuilder 1.65 does not respect the
CASESENSITIVE => 0 option when passed OPERATOR => 'IN'. This is only an
issue on the limits for Group.Name, which must be case-insensitive. To
- work around this, pass FUNCTION => 'LOWER(?)', CASESENSITIVE => 1. The
- former deals with making the search case-insensitive, while the latter
- quiets the warnings which attempt ot detect case-sensitive searches on
- Group.Name.
+ work around this, pass FUNCTION => 'LOWER(?)', VALUE => [an lc'd list],
+ and CASESENSITIVE => 1. The former two deal with making the search
+ case-insensitive, while the latter quiets the warnings which attempt ot
+ detect case-sensitive searches on Group.Name.
This also rewrites two queries in GetForwardAttachments into one, using
a simple JOIN.
+
+diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm
+--- a/lib/RT/Action/SendEmail.pm
++++ b/lib/RT/Action/SendEmail.pm
+@@
+
+ my $attachs = RT::Attachments->new( $self->TransactionObj->CreatorObj );
+ my $txn_alias = $attachs->TransactionAlias;
+- $attachs->Limit( ALIAS => $txn_alias, FIELD => 'Type', VALUE => 'Create' );
+ $attachs->Limit(
+- ALIAS => $txn_alias,
+- FIELD => 'Type',
+- VALUE => 'Correspond'
++ ALIAS => $txn_alias,
++ FIELD => 'Type',
++ OPERATOR => 'IN',
++ VALUE => [qw(Create Correspond)],
+ );
+ $attachs->LimitByTicket($tid);
+ $attachs->LimitNotEmpty;
diff --git a/lib/RT/Action/SendForward.pm b/lib/RT/Action/SendForward.pm
--- a/lib/RT/Action/SendForward.pm
@@ -74,7 +94,7 @@
+ FIELD => 'Name',
+ FUNCTION => 'LOWER(?)',
+ OPERATOR => 'IN',
-+ VALUE => $list,
++ VALUE => [map {lc $_} @{$list}],
+ CASESENSITIVE => 1,
+ );
} else {
@@ -96,7 +116,7 @@
+ FIELD => 'Name',
+ FUNCTION => 'LOWER(?)',
+ OPERATOR => 'NOT IN',
-+ VALUE => [ @list ],
++ VALUE => [ map {lc $_} @list ],
+ CASESENSITIVE => 1,
+ );
}
@@ -143,7 +163,7 @@
+ FIELD => "Name",
+ FUNCTION => 'LOWER(?)',
+ OPERATOR => "IN",
-+ VALUE => [ $class->Roles ],
++ VALUE => [ map {lc $_} $class->Roles ],
+ CASESENSITIVE => 1,
+ );
} else {
More information about the rt-commit
mailing list