[Rt-commit] [rtir] 07/09: Add constituency limits to the dueincidents and newreports portlets

Jesse Vincent jesse at bestpractical.com
Mon Mar 16 02:41:35 EDT 2015


This is an automated email from the git hooks/post-receive script.

jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.

commit 129ccb38f81722dafe7047ec3423ae21d698a98f
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Sun Mar 15 23:37:15 2015 -0700

    Add constituency limits to the dueincidents and newreports portlets
---
 html/RTIR/Elements/DueIncidents | 4 ++--
 html/RTIR/Elements/NewReports   | 6 ++----
 lib/RT/IR.pm                    | 4 ++++
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/html/RTIR/Elements/DueIncidents b/html/RTIR/Elements/DueIncidents
index 7cbcc73..9942727 100644
--- a/html/RTIR/Elements/DueIncidents
+++ b/html/RTIR/Elements/DueIncidents
@@ -86,8 +86,8 @@ my $QueryString = $m->comp('/Elements/QueryString',
 </%INIT>
 <%ARGS>
 $Title           => loc("Most due incidents")
-$BaseQuery       => RT::IR->Query( Lifecycle => 'incidents' )
-$Query           => RT::IR->ActiveQuery( Lifecycle => 'incidents' )
+$BaseQuery       => RT::IR->Query( Lifecycle => 'incidents', ($m->{'RTIR_ConstituencyFilter'} ? (Constituency => $m->{'RTIR_ConstituencyFilter'}) : () ))
+$Query           => RT::IR->ActiveQuery( Lifecycle => 'incidents',  ($m->{'RTIR_ConstituencyFilter'} ? (Constituency => $m->{'RTIR_ConstituencyFilter'}) : ()  ))
 $Format          => RT->Config->Get('RTIRSearchResultFormats')->{'DueIncidents'}
 $Rows            => undef
 $Page            => 1
diff --git a/html/RTIR/Elements/NewReports b/html/RTIR/Elements/NewReports
index 73960ba..e2ac237 100644
--- a/html/RTIR/Elements/NewReports
+++ b/html/RTIR/Elements/NewReports
@@ -69,8 +69,6 @@
 <%INIT>
 my $title = loc("New unlinked Incident Reports...");
 
-$Query ||= RT::IR->Query( Lifecycle => $Lifecycle, Initial => 1 );
-
 $Rows = $session{'CurrentUser'}->UserObj->Preferences(
     'SummaryRows',
     ( RT->Config->Get('DefaultSummaryRows') || 10 ),
@@ -97,8 +95,8 @@ my $BulkQS = $m->comp('/Elements/QueryString',
 
 <%ARGS>
 $Lifecycle     =>  RT::IR->lifecycle_report
-$BaseQuery => RT::IR->Query( Lifecycle => $Lifecycle )
-$Query     => undef
+$BaseQuery => RT::IR->Query( Lifecycle => $Lifecycle, ($m->{'RTIR_ConstituencyFilter'} ? (Constituency => $m->{'RTIR_ConstituencyFilter'}) : () ) )
+$Query     => RT::IR->Query( Lifecycle => $Lifecycle, ($m->{'RTIR_ConstituencyFilter'} ? (Constituency => $m->{'RTIR_ConstituencyFilter'}) : () ), Initial => 1 )
 $Format    => RT->Config->Get('RTIRSearchResultFormats')->{'NewReports'}
 $Rows      => undef
 $Page      => 1
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 206f72f..1ff8054 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -334,6 +334,7 @@ sub Query {
         MemberOf     => undef,
         NotMemberOf  => undef,
         And          => undef,
+        Constituency => undef,
         @_
     );
 
@@ -363,6 +364,9 @@ sub Query {
     if ( my $t = $args{'NotMemberOf'} ) {
         push @res, join ' AND ', map "MemberOf != $_", map int $_, $flat->( $t, 'id' );
     }
+    if ( my $t = $args{'Constituency'} ) {
+        push @res, "'QueueCF.{RTIR Constituency}' = '$t'";
+    }
     if ( my $c = $args{'And'} ) {
         push @res, ref $c? @$c : ($c);
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list