[Rt-commit] [rtir] 01/01: Allow reports to be run when Constituency CF is disabled
Jim Brandt
jbrandt at bestpractical.com
Tue Jun 3 15:11:46 EDT 2014
This is an automated email from the git hooks/post-receive script.
jbrandt pushed a commit to branch 3.0/reports-without-constituencies
in repository rtir.
commit 79f55093815d10bf66ab7bab0b0b6b670521630e
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Tue Jun 3 15:09:33 2014 -0400
Allow reports to be run when Constituency CF is disabled
Resolves Issues: 30040
---
html/RTIR/Reporting/Report.html | 3 +++
html/RTIR/Reporting/index.html | 12 ++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/html/RTIR/Reporting/Report.html b/html/RTIR/Reporting/Report.html
index ae492bb..906397e 100644
--- a/html/RTIR/Reporting/Report.html
+++ b/html/RTIR/Reporting/Report.html
@@ -121,6 +121,9 @@ my $filter_by_incident_field = sub {
%$res = %$tickets;
}
+ # No filter on Constituency if that feature isn't being used
+ return $res if $field eq 'Constituency' and not $condition;
+
while( my($id, $t) = each %$res ) {
my $value = $get_incident_field->( $t, $field );
delete $res->{$id} if $value? $value ne $condition: $condition;
diff --git a/html/RTIR/Reporting/index.html b/html/RTIR/Reporting/index.html
index 6de5b82..e2c7b96 100644
--- a/html/RTIR/Reporting/index.html
+++ b/html/RTIR/Reporting/index.html
@@ -50,6 +50,7 @@
<form action="index.html" method="post">
<table>
+% unless ( $ConstituencyDisabled ){
<tr>
<td class="label"><&|/l&>Constituency</&>:</td>
<td class="value">
@@ -61,6 +62,7 @@
&>
</td>
</tr>
+% }
<tr>
<td class="label"><&|/l&>Start Date:</&></td>
<td class="input">
@@ -92,9 +94,15 @@
</form>
<%INIT>
+my $ConstituencyDisabled = 0;
+my $constituency_cf = RT::CustomField->new($session{'CurrentUser'});
+my ($ok, $msg) = $constituency_cf->Load('Constituency');
+if ( not $ok or $constituency_cf->Disabled ){
+ $ConstituencyDisabled = 1;
+}
+
if ( $ARGS{'HTMLReport'} || $ARGS{'TextReport'} || $ARGS{'SpreadsheetReport'} ) {
- unless ( $ARGS{'Constituency'} ) {
- my $constituency_cf = RT::IR::GetCustomField('Constituency');
+ unless ( $ARGS{'Constituency'} or $ConstituencyDisabled ) {
$ARGS{'Constituency'} = delete $ARGS{ 'Object-RT::Ticket--CustomField-'. $constituency_cf->Id .'-Values' };
}
my $ext = 'html';
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list