[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-176-g683e744
Shawn Moore
sartak at bestpractical.com
Fri Jul 16 16:57:13 EDT 2010
The branch, 3.9-trunk has been updated
via 683e7442f3f11f33346778ca47274b995e27b32c (commit)
via 4e3a3598e897746814929f192e1e88fad7e6ea78 (commit)
from 03fd1f57f6042cbcfe7c5e9bd3eb74f1c40fc875 (commit)
Summary of changes:
lib/RT/CustomFields_Overlay.pm | 49 ++++++++++++++++++++++++++++++++-------
1 files changed, 40 insertions(+), 9 deletions(-)
- Log -----------------------------------------------------------------
commit 4e3a3598e897746814929f192e1e88fad7e6ea78
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Fri Jul 16 16:52:49 2010 -0400
Add CustomFields->LimitToApplied
diff --git a/lib/RT/CustomFields_Overlay.pm b/lib/RT/CustomFields_Overlay.pm
index b876c6f..68f896f 100755
--- a/lib/RT/CustomFields_Overlay.pm
+++ b/lib/RT/CustomFields_Overlay.pm
@@ -189,6 +189,41 @@ sub LimitToNotApplied {
);
}
+=head2 LimitToApplied
+
+Limits collection to custom fields to listed objects or any corespondingly. Use
+zero to mean global.
+
+=cut
+
+sub LimitToApplied {
+ my $self = shift;
+ my @ids = @_;
+
+ my $ocfs_alias = $self->_OCFAlias( New => 1, Left => 1 );
+ if ( @ids ) {
+ # XXX: we need different EA in join clause, but DBIx::SB
+ # doesn't support them, use IN (X) instead
+ my $dbh = $self->_Handle->dbh;
+ $self->Limit(
+ LEFTJOIN => $ocfs_alias,
+ ALIAS => $ocfs_alias,
+ FIELD => 'ObjectId',
+ OPERATOR => 'IN',
+ QUOTEVALUE => 0,
+ VALUE => "(". join( ',', map $dbh->quote($_), @ids ) .")",
+ );
+ }
+
+ $self->Limit(
+ ENTRYAGGREGATOR => 'AND',
+ ALIAS => $ocfs_alias,
+ FIELD => 'id',
+ OPERATOR => 'IS NOT',
+ VALUE => 'NULL',
+ );
+}
+
=head2 LimitToGlobalOrQueue QUEUEID
DEPRECATED since CFs are applicable not only to tickets these days.
commit 683e7442f3f11f33346778ca47274b995e27b32c
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Fri Jul 16 16:54:43 2010 -0400
Factor out the commonality between CFs->LimitToNotApplied and LimitToApplied
diff --git a/lib/RT/CustomFields_Overlay.pm b/lib/RT/CustomFields_Overlay.pm
index 68f896f..26e6b5e 100755
--- a/lib/RT/CustomFields_Overlay.pm
+++ b/lib/RT/CustomFields_Overlay.pm
@@ -153,15 +153,7 @@ sub LimitToGlobalOrObjectId {
ENTRYAGGREGATOR => 'OR' ) unless $global_only;
}
-=head2 LimitToNotApplied
-
-Takes either list of object ids or nothing. Limits collection
-to custom fields to listed objects or any corespondingly. Use
-zero to mean global.
-
-=cut
-
-sub LimitToNotApplied {
+sub _LimitToOCFs {
my $self = shift;
my @ids = @_;
@@ -180,6 +172,23 @@ sub LimitToNotApplied {
);
}
+ return $ocfs_alias;
+}
+
+=head2 LimitToNotApplied
+
+Takes either list of object ids or nothing. Limits collection
+to custom fields to listed objects or any corespondingly. Use
+zero to mean global.
+
+=cut
+
+sub LimitToNotApplied {
+ my $self = shift;
+ my @ids = @_;
+
+ my $ocfs_alias = $self->_LimitToOCFs(@ids);
+
$self->Limit(
ENTRYAGGREGATOR => 'AND',
ALIAS => $ocfs_alias,
@@ -200,20 +209,7 @@ sub LimitToApplied {
my $self = shift;
my @ids = @_;
- my $ocfs_alias = $self->_OCFAlias( New => 1, Left => 1 );
- if ( @ids ) {
- # XXX: we need different EA in join clause, but DBIx::SB
- # doesn't support them, use IN (X) instead
- my $dbh = $self->_Handle->dbh;
- $self->Limit(
- LEFTJOIN => $ocfs_alias,
- ALIAS => $ocfs_alias,
- FIELD => 'ObjectId',
- OPERATOR => 'IN',
- QUOTEVALUE => 0,
- VALUE => "(". join( ',', map $dbh->quote($_), @ids ) .")",
- );
- }
+ my $ocfs_alias = $self->_LimitToOCFs(@ids);
$self->Limit(
ENTRYAGGREGATOR => 'AND',
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list