[Rt-commit] [rtir] 01/01: Remove historical constituencies implementation in preparation for replacing it with a new impelementation which uses regular queues, scrips and queue ACLs to improve performance and flexibility

Jesse Vincent jesse at bestpractical.com
Thu Feb 5 17:00:04 EST 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 490d8e84cc9e1ee16a6757f4c5faeeeda78cba07
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Thu Feb 5 13:48:40 2015 -0800

    Remove historical constituencies implementation
    in preparation for replacing it with a new impelementation
    which uses regular queues, scrips and queue ACLs to improve
    performance and flexibility
    
    This branch is expected to fail all constituency tests,
    which have been left in place to verify the new implementation
---
 MANIFEST                                           |   5 -
 etc/RTIR_Config.pm                                 |  15 -
 etc/initialdata                                    |  41 ---
 .../Elements/EditCustomFields/MassageCustomFields  |   4 -
 .../Elements/QueueSummaryByLifecycle/SQLFilter     |   9 -
 html/RTIR/Create.html                              |  32 ---
 html/RTIR/Edit.html                                |  23 --
 html/RTIR/Elements/EditConstituency                | 160 -----------
 html/RTIR/Elements/MergeWith                       |   2 +-
 html/RTIR/Incident/Create.html                     |  35 ---
 html/RTIR/Incident/Display.html                    |   7 -
 html/RTIR/Incident/Elements/Create                 |  25 --
 html/RTIR/Link/FromIncident/index.html             |   1 -
 html/RTIR/Merge/Refine.html                        |   1 -
 html/RTIR/Merge/index.html                         |  11 +-
 html/RTIR/Reporting/Report.html                    |  20 +-
 html/RTIR/Reporting/index.html                     |  22 --
 lib/RT/Action/RTIR_SetConstituency.pm              | 215 ---------------
 lib/RT/Action/RTIR_SetConstituencyGroup.pm         | 123 ---------
 lib/RT/Condition/RTIR_RequireConstituencyChange.pm |  77 ------
 .../RTIR_RequireConstituencyGroupChange.pm         |  76 ------
 lib/RT/IR.pm                                       | 301 ---------------------
 lib/RT/IR/Config.pm                                |  10 -
 po/rtir.pot                                        |   4 -
 24 files changed, 6 insertions(+), 1213 deletions(-)

diff --git a/MANIFEST b/MANIFEST
index 74bf7e2..780dac1 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -72,7 +72,6 @@ html/RTIR/EditUsername
 html/RTIR/Elements/AddWatchers
 html/RTIR/Elements/AttachReports
 html/RTIR/Elements/DueIncidents
-html/RTIR/Elements/EditConstituency
 html/RTIR/Elements/EditCustomFields
 html/RTIR/Elements/EditPeople
 html/RTIR/Elements/EditRTIRField
@@ -174,8 +173,6 @@ lib/RT/Action/RTIR_MergeIPs.pm
 lib/RT/Action/RTIR_OpenParent.pm
 lib/RT/Action/RTIR_ResolveChildren.pm
 lib/RT/Action/RTIR_SetBlockStatus.pm
-lib/RT/Action/RTIR_SetConstituency.pm
-lib/RT/Action/RTIR_SetConstituencyGroup.pm
 lib/RT/Action/RTIR_SetDueIncident.pm
 lib/RT/Action/RTIR_SetHowReported.pm
 lib/RT/Action/RTIR_SetIncidentResolution.pm
@@ -183,8 +180,6 @@ lib/RT/Condition/RTIR.pm
 lib/RT/Condition/RTIR_CustomerResponse.pm
 lib/RT/Condition/RTIR_LinkingToIncident.pm
 lib/RT/Condition/RTIR_Merge.pm
-lib/RT/Condition/RTIR_RequireConstituencyChange.pm
-lib/RT/Condition/RTIR_RequireConstituencyGroupChange.pm
 lib/RT/Condition/RTIR_RequireDueChange.pm
 lib/RT/Condition/RTIR_RequireReportActivation.pm
 lib/RT/Condition/RTIR_StaffResponse.pm
diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index a7456d7..e71e50d 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -563,22 +563,8 @@ Set(
         resolved => "successfully resolved",
         rejected => "no resolution reached",
     },
-    Constituency => 'EDUNET',
 );
 
-=item C<$_RTIR_Constituency_Propagation>
-
-Set constituency propagation algorithm. Valid values are 'no',
-'inherit' and 'reject', by default 'no' propagation happens.
-
-Read more about constituencies in F<lib/RT/IR/Constituencies.pod>.
-Algorithms are described in
-L<Constituencies/Constituency Propagation Options>.
-
-=cut
-
-Set( $_RTIR_Constituency_Propagation,    'no' );
-
 =item C<%CustomFieldGroupings>
 
 All of the configuration rules for RT CustomFieldGroupings apply and you
@@ -600,7 +586,6 @@ available in all screens in RTIR so may not be the best place for Custom Fields.
 
 Set(%CustomFieldGroupings,
     'RTIR::Ticket' => [
-        'Basics'         => ['Constituency'],
         'Networking'     => ['IP'],
         'Details' => ['How Reported','Reporter Type','Customer',
                       'Description', 'Resolution', 'Function', 'Classification',
diff --git a/etc/initialdata b/etc/initialdata
index 6a7f2ac..fb41a14 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -43,18 +43,6 @@
 
 @CustomFields = (
     {
-        Name        => 'Constituency',
-        Type        => 'SelectSingle',
-        RenderType  => 'Dropdown',
-        Queue       => ['Incidents', 'Incident Reports', 'Investigations', 'Blocks'],
-        Disabled    => 0,
-        Description => 'Constituency for RTIR queues',
-        Values      => [
-            { Name      => "EDUNET", SortOrder => 1 },
-            { Name      => "GOVNET", SortOrder => 2 },
-        ],
-    },
-    {
         Name        => 'Description',
         Type        => 'FreeformSingle',
         Queue       => 'Incidents',
@@ -221,14 +209,6 @@
        Description => 'Merge multiple IPs on ticket merge' ,                                            # loc
        ExecModule  => 'RTIR_MergeIPs',
     },
-    {  Name        => 'RTIR Set Constituency',    # loc
-       Description => 'Set and cascade Constituency custom field' ,                                            # loc
-       ExecModule  => 'RTIR_SetConstituency',
-    },
-    {  Name        => 'RTIR Set Constituency Group',    # loc
-       Description => 'Set group responsible for constituency' ,                                            # loc
-       ExecModule  => 'RTIR_SetConstituencyGroup',
-    },
     {  Name        => 'RTIR Activate Ticket',    # loc
        Description => 'Set status to first active possible',            # loc
        ExecModule  => 'RTIR_Activate',
@@ -264,16 +244,6 @@
        ApplicableTransTypes => 'Any',
        ExecModule => 'RTIR_RequireDueChange',
     },
-    {  Name        => 'RTIR Require Constituency Change',    # loc
-       Description => 'The constituency must be changed',                                            # loc
-       ApplicableTransTypes => 'Any',
-       ExecModule => 'RTIR_RequireConstituencyChange',
-    },
-    {  Name        => 'RTIR Require Constituency Group Change',    # loc
-       Description => 'A group responsible for constituency must be changed',                                            # loc
-       ApplicableTransTypes => 'Any',
-       ExecModule => 'RTIR_RequireConstituencyGroupChange',
-    },
     {  Name        => 'RTIR Linking To Incident',    # loc
        Description => 'Whenever ticket is linked to incident or created with link',                                 # loc
        ApplicableTransTypes => 'Create,AddLink',
@@ -377,17 +347,6 @@
        ScripAction       => 'RTIR merge IPs',
        Template          => 'Blank' },
 
-    {  Description       => "SetConstituency",
-       Queue             => ['Incidents', 'Incident Reports', 'Investigations', 'Blocks'],
-       ScripCondition    => 'RTIR Require Constituency Change',
-       ScripAction       => 'RTIR Set Constituency',
-       Template          => 'Blank' },
-    {  Description       => "SetConstituencyGroup",
-       Queue             => ['Incidents', 'Incident Reports', 'Investigations', 'Blocks'],
-       ScripCondition    => 'RTIR Require Constituency Group Change',
-       ScripAction       => 'RTIR Set Constituency Group',
-       Template          => 'Blank' },
-
 );
 
 # WARNING: If you change content of the templates, don't forget to
diff --git a/html/Callbacks/RTIR/Elements/EditCustomFields/MassageCustomFields b/html/Callbacks/RTIR/Elements/EditCustomFields/MassageCustomFields
index 0da4d80..7d93a5c 100644
--- a/html/Callbacks/RTIR/Elements/EditCustomFields/MassageCustomFields
+++ b/html/Callbacks/RTIR/Elements/EditCustomFields/MassageCustomFields
@@ -63,8 +63,4 @@ if ($Object->Id) {
 }
 return unless RT::IR->OurQueue( $queue );
 
-# We never want to see the RTIR's custom field Constituency in the edity ui
-$CustomFields->_OpenParen('RTIR');
-$CustomFields->Limit( SUBCLAUSE => 'RTIR', ENTRYAGGREGATOR => 'AND', FIELD => 'Name', OPERATOR => '!=', VALUE => 'Constituency', CASESENSITIVE => 0);
-$CustomFields->_CloseParen('RTIR');
 </%init>
diff --git a/html/Callbacks/RTIR/Elements/QueueSummaryByLifecycle/SQLFilter b/html/Callbacks/RTIR/Elements/QueueSummaryByLifecycle/SQLFilter
index 6d1271d..ad4ef4f 100644
--- a/html/Callbacks/RTIR/Elements/QueueSummaryByLifecycle/SQLFilter
+++ b/html/Callbacks/RTIR/Elements/QueueSummaryByLifecycle/SQLFilter
@@ -57,15 +57,6 @@ for my $type (RT::IR->Queues) {
                         ENTRYAGGREGATOR => 'OR',
                         CASESENSITIVE => 0,
                 );
-    } else {
-# anywhere else, skip constituency Queues.  In the if() clause
-# we're hardcoding 4 Queues, so we don't also need to skip the constituency queues.
-        $Queues->Limit( FIELD => 'Name',
-                        OPERATOR => 'NOT STARTSWITH',
-                        VALUE => "$type - ",
-                        SUBCLAUSE => 'Constituencies',
-                        CASESENSITIVE => 0,
-                );
     }
 
 }
diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 990f64d..644dec3 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -124,26 +124,6 @@
     ],
   &>
 
-% if ( $constituency_cf ) {
-  <tr>
-    <td class="label"><&|/l&>Constituency</&>:</td>
-    <td class="value">
-% if ( !$Incident[0] || RT->Config->Get('_RTIR_Constituency_Propagation') eq 'no' ) {
-      <& /RTIR/Elements/EditRTIRField, 
-         QueueObj => $QueueObj, 
-         Name     => 'Constituency',
-         ($Incident[0] ? (PropagationObject => $IncidentObj[0]) : ()),
-       &>
-% } else {
-% #TODO: hacks, we need way to define CF value on Create, but don't allow user to change it
-      <input type="hidden" class="hidden" name="<% $constituency_field %>-Magic" value="1" />
-      <input type="hidden" class="hidden" name="<% $constituency_field %>" value="<% $IncidentObj[0]->FirstCustomFieldValue('Constituency') %>" />
-      <& /RTIR/Elements/ShowRTIRField, Ticket => $IncidentObj[0], Name => 'Constituency' &>
-% }
-    </td>
-  </tr>
-% }
-
   <& /RTIR/Elements/EditCustomFields, 
     %ARGS,
     TicketObj => $ticket,
@@ -362,12 +342,6 @@ $name ||= $Type;
 my (@results, $checks_failure, $skip_create);
 $skip_create = !$ARGS{'Create'};
 
-my $constituency_cf = RT::IR->CustomFields( 'Constituency', Queue => $Queue );
-my $constituency_field;
-$constituency_field =
-    'Object-RT::Ticket--CustomField-' . $constituency_cf->id .'-Values'
-        if $constituency_cf;
-
 my $SplitObj;
 if ( $Split ) {
     $SplitObj = LoadTicket( $Split );
@@ -391,12 +365,6 @@ foreach my $id ( grep $_, @Incident ) {
     elsif ( $inc->QueueObj->Name ne 'Incidents' ) {
         push @results, loc('Ticket #[_1] is not an Incident', $id );
     }
-    elsif ( !$skip_create && $constituency_field 
-        && RT->Config->Get('_RTIR_Constituency_Propagation') eq 'reject'
-        && lc $ARGS{$constituency_field} ne lc $inc->FirstCustomFieldValue('Constituency') )
-    {
-        push @results, loc('Incident #[_1] has constituency [_2], choose the same value for a new ticket or use another Incident', $id, $inc->FirstCustomFieldValue('Constituency') );
-    }
     else {
         push @IncidentObj, $inc;
         $error = 0;
diff --git a/html/RTIR/Edit.html b/html/RTIR/Edit.html
index 4dd8f70..4b84b0e 100644
--- a/html/RTIR/Edit.html
+++ b/html/RTIR/Edit.html
@@ -112,18 +112,6 @@
     <td class="value"><&/Elements/SelectPriority, Name => 'Priority', Default => $ARGS{'Priority'} || $Ticket->Priority &></td>
   </tr>
 % }
-% if ( $constituency_cf && ( $constituency_propagation ne 'reject' || !$is_linked ) ) {
-  <tr>
-    <td class="label"><&|/l&>Constituency</&>:</td>
-    <td class="value">
-      <& /RTIR/Elements/EditRTIRField, 
-         TicketObj => $Ticket,
-         Name => 'Constituency',
-      &>
-    </td>
-  </tr>
-% }
-
   <& /RTIR/Elements/EditCustomFields, %ARGS, TicketObj => $Ticket &>
 </table>
 
@@ -248,17 +236,6 @@ if ($Type eq 'Report') {
     $name = $Type;
 }
 
-my $constituency_cf = RT::IR->CustomFields( Constituency => Ticket => $Ticket );
-my $constituency_propagation = RT->Config->Get('_RTIR_Constituency_Propagation');
-
-my $is_linked = 0;
-if ( $constituency_cf && $constituency_propagation eq 'reject' ) {
-    $is_linked = $Type eq 'Incident'
-        ? RT::IR->IncidentChildren( $Ticket )->Count
-        : RT::IR->Incidents( $Ticket )->Count
-    ;
-}
-
 # If they've gone and moved the ticket to somewhere they can't see, etc...
 # TODO: display the results, even if we can't display the ticket.
 
diff --git a/html/RTIR/Elements/EditConstituency b/html/RTIR/Elements/EditConstituency
deleted file mode 100644
index d204c89..0000000
--- a/html/RTIR/Elements/EditConstituency
+++ /dev/null
@@ -1,160 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
-%#                                          <sales at bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-%# Build up the set of cascading select boxes as "guides"
-%# each one limits the options of the final one a bit
-%# (perhaps by tweaking the .display style?)
-%       my $selected = 0;
-%       my @category;
-%       my $id = $NamePrefix . $CustomField->Id;
-%       my $out = $m->scomp('SELF:options', %ARGS, SelectedRef => \$selected, CategoryRef => \@category, Object => $Object, Default => \@Default);
-%       if (@category) {
-<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/static/js/cascaded.js"></script>
-%#      XXX - Hide this select from w3m?
-      <select onchange="filter_cascade('<% $id %>-Values', this.value)" name="<% $id %>-Category">
-        <option value="" <% !$selected && 'selected' %>><&|/l&>-</&></option>
-%           foreach my $cat (@category) {
-%               my ($depth, $name) = @$cat;
-        <option value="<% $name %>"><% ' ' x $depth |n %><% $name %></option>
-%           }
-      </select><br />
-%       }
-      <select name="<%$id%>-Values" id="<%$id%>-Values"
-%       if ( $Rows && ( $Multiple || !@category ) ) {
-        size="<% $Rows %>"
-%       }
-        <% $Multiple && 'multiple' %> >
-%       $m->out($out);
-      </select>
-<%INIT>
-# Handle render types
-$RenderType ||= $CustomField->RenderType;
-if ( $RenderType eq 'Dropdown' ) {
-    # Turn it into a dropdown
-    $Rows = 0;
-}
-
- at Default = grep defined && length, @Default;
-unless (@Default) {
-    my $default = $PropagationObject->FirstCustomFieldValue('Constituency') if $PropagationObject;
-    $default ||= RT::IR::DefaultConstituency( $QueueObj ) if $QueueObj;
-    $default ||= scalar RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
-    push @Default, $default;
-}
-</%INIT>
-<%ARGS>
-$Object => undef
-$CustomField => undef
-$NamePrefix => undef
- at Default => ()
-$Values => undef
-$Multiple => 0
-$Rows => undef
-$RenderType => undef
-$PropagationObject => undef
-$QueueObj => undef
-</%ARGS>
-
-<%METHOD options>
-<%INIT>
-my $selected;
-my $CFVs = $CustomField->Values;
-my @levels;
-
-my $main_queue = RT::Queue->new($session{'CurrentUser'});
-if ( $Object ) {
-    $main_queue->Load( $Object->Queue );
-} else {
-    $main_queue->Load( $m->request_args->{'Queue'} || 'Incidents' );
-}
-$main_queue->{'disable_constituency_right_check'} = 1;
-my $show_all = $main_queue->CurrentUserHasRight('OwnTicket') ? 1 : 0;
-</%INIT>
-
-% while ( my $value = $CFVs->Next ) {
-%       my $name = $value->Name;
-% my $subqueue = RT::Queue->new($session{'CurrentUser'});
-%  next unless ($show_all || ($subqueue->LoadByCols(Name => $main_queue->Name . " - ".$name) && $subqueue->id && $subqueue->CurrentUserHasRight('OwnTicket')));
-%       my $category = $value->Category || '';
-%       my $level = (split /:/, $category, 2)[0] || '';
-%       while (@levels) {
-%           if ($levels[-1] eq $level) {
-%               $level = '';
-%               last;
-%           } elsif (index($level, $levels[-1]) != 0) {
-%               $m->out('</optgroup>');
-%               pop @levels;
-%           } else {
-%               last;
-%           }
-%       }
-%       if ( length $level ) {
-%           push @$CategoryRef, [0+ at levels, $level];
-            <optgroup style="padding-left: <% @levels/2 %>em" label="<% $category %>">
-%           push @levels, $level;
-%       }
-        <option value="<% $name %>"
-%       if ( grep( ( $_ || '') eq ( $name || '') , @Default )
-%            || ( $Values && $Values->HasEntry( $name ) ) )
-%       {
-%           $$SelectedRef = 1;
-            selected
-%       }
-        ><% $name %></option>
-% }
-% for (@levels) {
-            </optgroup>
-% }
-<%ARGS>
-$CustomField => undef
- at Default => ()
-$Values => undef
-$SelectedRef => undef
-$CategoryRef => undef
-$Object => undef
-</%ARGS>
-</%METHOD>
diff --git a/html/RTIR/Elements/MergeWith b/html/RTIR/Elements/MergeWith
index 9809907..ae68e1a 100644
--- a/html/RTIR/Elements/MergeWith
+++ b/html/RTIR/Elements/MergeWith
@@ -64,7 +64,7 @@ my $Type = RT::IR::TicketType( Queue => $Queue );
 $Title ||= $Type .'s';
 
 $Query ||= RT::IR->ActiveQuery( Queue => $Queue );
-$BaseQuery ||= RT::IR->Query( Queue => $Queue, Exclude => $id, Constituency => $Ticket );
+$BaseQuery ||= RT::IR->Query( Queue => $Queue, Exclude => $id );
 
 </%INIT>
       
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 552fadc..7b7f1d7 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -130,26 +130,6 @@ if ( $ChildObj && !$ChildObj->CurrentUserHasRight('ModifyTicket') ) {
 % }
 </tr>
 
-% if ( my $constituency_cf = RT::IR->CustomFields( 'Constituency', Queue => $QueueObj->Name ) ) {
-<tr><td class="label"><&|/l&>Constituency</&>:</td>
-<td class="value">
-% if ( !$ChildObj || RT->Config->Get('_RTIR_Constituency_Propagation') eq 'no' ) {
-<& /RTIR/Elements/EditRTIRField,
-    %ARGS,
-    QueueObj => $QueueObj,
-    Name     => 'Constituency',
-    PropagationObject => $ChildObj,
-&>
-% } else {
-% #TODO: hacks, we need way to define CF value on Create, but don't allow user to change it
-<input type="hidden" class="hidden" name="Constituency" value="Object-RT::Ticket--CustomField-<% $constituency_cf->id %>-Values" />
-<input type="hidden" class="hidden" name="Object-RT::Ticket--CustomField-<% $constituency_cf->id %>-Values-Magic" value="1" />
-<input type="hidden" class="hidden" name="Object-RT::Ticket--CustomField-<% $constituency_cf->id %>-Values" value="<% $ChildObj->FirstCustomFieldValue('Constituency') %>" />
-<& /RTIR/Elements/ShowRTIRField, Ticket => $ChildObj, Name => 'Constituency' &>
-% }
-</td></tr>
-% }
-
 <& /RTIR/Elements/EditCustomFields, 
     %ARGS,
     TicketObj    => $ticket,
@@ -380,21 +360,6 @@ if ( $CreateIncident ) {
         $checks_failure = 1;
     }
 
-    if ( $ChildObj
-        and RT->Config->Get('_RTIR_Constituency_Propagation') eq 'reject'
-        and my $constituency_cf = RT::IR->CustomFields(
-            'Constituency', Queue => 'Incidents'
-        )
-    ) {
-        my $constituency_field =
-            'Object-RT::Ticket--CustomField-' . $constituency_cf->id .'-Values';
-        unless ( lc $ARGS{ $constituency_field }
-            eq lc $ChildObj->FirstCustomFieldValue('Constituency') )
-        {
-            push @results, loc( "New incident and its child #[_1] must have the same constituency", $ChildObj->id );
-            $checks_failure = 1;
-        }
-    }
 }
 
 if ( !$checks_failure && $CreateIncident ) {
diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index 3646d64..a692742 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -175,13 +175,6 @@ my $deleted_links = 0;
 my $DoLinks = sub {
     my ($child, $parent) = @_;
 
-    if ( RT->Config->Get('_RTIR_Constituency_Propagation') eq 'reject' ) {
-        return loc("Couldn't link tickets with different constituencies")
-            if lc $child->FirstCustomFieldValue('Constituency') 
-                ne lc $parent->FirstCustomFieldValue('Constituency')
-                && RT::IR->CustomFields('Constituency');
-    }
-
     my %args = ();
 
     # Blocks or Incedent Reports can have multiple incidents
diff --git a/html/RTIR/Incident/Elements/Create b/html/RTIR/Incident/Elements/Create
index 76191ef..1b8474b 100644
--- a/html/RTIR/Incident/Elements/Create
+++ b/html/RTIR/Incident/Elements/Create
@@ -45,30 +45,6 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-% if ( my $constituency_cf = RT::IR->CustomFields( 'Constituency', Queue => $QueueObj->Name ) ) {
-<tr><td class="label"><&|/l&>Constituency</&>:</td>
-<td class="value">
-% if ( !$ChildObj || RT->Config->Get('_RTIR_Constituency_Propagation') eq 'no' ) {
-% my $default;
-% $default = $ChildObj->FirstCustomFieldValue('Constituency') if $ChildObj;
-% $default ||= RT::IR::DefaultConstituency( $QueueObj );
-% $default ||= scalar RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
-<& /RTIR/Elements/EditRTIRField,
-    QueueObj => $QueueObj,
-    Name     => 'Constituency',
-    Default  => $default,
-    Rows     => 1,
-&>
-% } else {
-% #TODO: hacks, we need way to define CF value on Create, but don't allow user to change it
-<input type="hidden" class="hidden" name="Constituency" value="Object-RT::Ticket--CustomField-<% $constituency_cf->id %>-Values" />
-<input type="hidden" class="hidden" name="Object-RT::Ticket--CustomField-<% $constituency_cf->id %>-Values-Magic" value="1" />
-<input type="hidden" class="hidden" name="Object-RT::Ticket--CustomField-<% $constituency_cf->id %>-Values" value="<% $ChildObj->FirstCustomFieldValue('Constituency') %>" />
-<& /RTIR/Elements/ShowRTIRField, Ticket => $ChildObj, Name => 'Constituency' &>
-% }
-</td></tr>
-% }
-
 <& /RTIR/Elements/EditCustomFields,
     %ARGS,
     TicketObj    => $ticket,
@@ -78,7 +54,6 @@
 &>
 
 <%INIT>
-my $constituency_cf = RT::IR->CustomFields( 'Constituency', Queue => $QueueObj->Name );
 my $ticket = RT::Ticket->new($session{'CurrentUser'}); # empty object for EditCustomFields
 </%INIT>
 <%ARGS>
diff --git a/html/RTIR/Link/FromIncident/index.html b/html/RTIR/Link/FromIncident/index.html
index c5905ea..cf1a21f 100644
--- a/html/RTIR/Link/FromIncident/index.html
+++ b/html/RTIR/Link/FromIncident/index.html
@@ -97,7 +97,6 @@ my $title = loc("Link selected [_1] to Incident #[_2]", $Type, $id);
 my $BaseQuery = RT::IR->Query(
     Queue => $Queue,
     NotMemberOf => $id,
-    Constituency => $IncidentObj,
 );
 
 my $base_url = 'RTIR/Link/FromIncident/?'
diff --git a/html/RTIR/Merge/Refine.html b/html/RTIR/Merge/Refine.html
index 24407ac..afb92e0 100644
--- a/html/RTIR/Merge/Refine.html
+++ b/html/RTIR/Merge/Refine.html
@@ -55,7 +55,6 @@ return $m->comp(
     BaseQuery => RT::IR->Query(
         Queue        => $ARGS{'Queue'},
         Exclude      => $ARGS{'id'},
-        Constituency => $ARGS{'id'},
     ),
 );
 </%INIT>
diff --git a/html/RTIR/Merge/index.html b/html/RTIR/Merge/index.html
index 5ea1a48..3132ea3 100644
--- a/html/RTIR/Merge/index.html
+++ b/html/RTIR/Merge/index.html
@@ -99,15 +99,6 @@ if ( $MergeTicket ) {
     }
 }
 
-if ( $MergeTicket && RT->Config->Get('_RTIR_Constituency_Propagation') eq 'reject' ) {
-    if ( lc $MergeTicket->FirstCustomFieldValue('Constituency')
-        ne lc $Ticket->FirstCustomFieldValue('Constituency')
-    ) {
-        push @results, loc("Merge failed: Tickets have different constituencies" );
-        $checks_failure = 1;
-    }
-}
-
 if ( $MergeTicket && !$checks_failure ) {
 
     my @queues = sort map $_->Name, $Ticket->QueueObj, $MergeTicket->QueueObj;
@@ -143,7 +134,7 @@ my $Queue = $Ticket->QueueObj->Name;
 my $title = loc("Merge [_1] #[_2]: [_3]", $Type, $id, $Ticket->Subject);
 
 $Query      ||= RT::IR->ActiveQuery( Queue => $Queue );
-my $BaseQuery = RT::IR->Query( Queue => $Queue, Exclude => $id, Constituency => $Ticket );
+my $BaseQuery = RT::IR->Query( Queue => $Queue, Exclude => $id);
 
 my %defaults = (
     Format  => $Format,
diff --git a/html/RTIR/Reporting/Report.html b/html/RTIR/Reporting/Report.html
index 85969b2..327c873 100644
--- a/html/RTIR/Reporting/Report.html
+++ b/html/RTIR/Reporting/Report.html
@@ -46,12 +46,7 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <%PERL>
-if ( $Constituency ){
-    $m->comp("SELF:Heading$ReportAs", Text => loc('RTIR Periodic Report for [_1]', $Constituency) );
-}
-else{
     $m->comp("SELF:Heading$ReportAs", Text => loc('RTIR Periodic Report') );
-}
 
 $m->comp("SELF:TwoColumnsTable$ReportAs",
     Body => [
@@ -81,11 +76,7 @@ foreach my $incident_type( @functions ) {
         $tix_created->GotoFirstItem();
         my $filtered = $filter_by_incident_field->(
             $filter_by_incident_field->(
-                $filter_by_incident_field->(
                     $tix_created,
-                    'Constituency',
-                    $Constituency
-                ),
                 'Function',
                 $incident_type,
             ),
@@ -127,8 +118,6 @@ 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 );
@@ -174,12 +163,12 @@ my @classifications;
 # of new reports outstanding at start of the period
 my $outstanding = RT::Tickets->new( $session{'CurrentUser'} );
 $outstanding->FromSQL("Queue = 'Incident Reports' AND Created < '$start' AND (Resolved = '1970-01-01 00:00:01' OR Resolved > '$start')");
-my $outstanding_pruned = $filter_by_incident_field->($outstanding, 'Constituency', $Constituency);
+my $outstanding_pruned = $outstanding;
 
 # of new reports created during the period
 my $tix_created = RT::Tickets->new( $session{'CurrentUser'} );
 $tix_created->FromSQL("Queue = 'Incident Reports' AND Created > '$start' AND Created < '$end'");
-my $tix_created_pruned = $filter_by_incident_field->( $tix_created, 'Constituency', $Constituency );
+my $tix_created_pruned = $tix_created_pruned;
 
 # of new reports resolved/closed/deleted during the period
 # this means "number of reports created during the period that were 
@@ -187,7 +176,7 @@ my $tix_created_pruned = $filter_by_incident_field->( $tix_created, 'Constituenc
 
 my $tix_resolved = RT::Tickets->new( $session{'CurrentUser'} );
 $tix_resolved->FromSQL("Queue = 'Incident Reports' AND Created > '$start' AND Created < '$end' AND (Resolved > '1970-01-01 00:00:01' AND Resolved < '$end')");
-my $tix_resolved_pruned = $filter_by_incident_field->($tix_resolved, 'Constituency', $Constituency);
+my $tix_resolved_pruned = $tix_resolved;
 
 # of new reports oustanding at end of the period
 # this is "number of reports created during the period that were also 
@@ -195,7 +184,7 @@ my $tix_resolved_pruned = $filter_by_incident_field->($tix_resolved, 'Constituen
 
 my $tix_unresolved = RT::Tickets->new( $session{'CurrentUser'} );
 $tix_unresolved->FromSQL("Queue = 'Incident Reports' AND Created > '$start' AND Created < '$end' AND ( Resolved = '1970-01-01 00:00:01' OR Resolved > '$end' )");
-my $tix_unresolved_pruned = $filter_by_incident_field->($tix_unresolved, 'Constituency', $Constituency);
+my $tix_unresolved_pruned = $tix_unresolved;
 
 if ( $TextReport ) {
     $r->content_type('text/plain');
@@ -207,7 +196,6 @@ if ( $TextReport ) {
 <%ARGS>
 $StartDate         => undef
 $EndDate           => undef
-$Constituency      => undef
 $HTMLReport        => 1
 $TextReport        => !$HTMLReport
 $SpreadsheetReport => !($HTMLReport || $TextReport)
diff --git a/html/RTIR/Reporting/index.html b/html/RTIR/Reporting/index.html
index 1766923..fd23a34 100644
--- a/html/RTIR/Reporting/index.html
+++ b/html/RTIR/Reporting/index.html
@@ -50,19 +50,6 @@
 
 <form action="index.html" method="post">
 <table>
-% unless ( $ConstituencyDisabled ){
-  <tr>
-    <td class="label"><&|/l&>Constituency</&>:</td>
-    <td class="value">
-      <& /RTIR/Elements/EditRTIRField, 
-         QueueObj => $QueueObj, 
-	     Name     => 'Constituency',
-	     Default  => RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'},
-	     Rows     => 1
-      &>
-    </td>
-  </tr>
-% }
   <tr>
     <td class="label"><&|/l&>Start Date:</&></td>
     <td class="input">
@@ -98,17 +85,8 @@ my $QueueObj = RT::Queue->new($session{'CurrentUser'});
 $QueueObj->Load('Incidents');
 RT::Logger->error('Unable to load Incidents queue') unless $QueueObj->Id;
 
-my $ConstituencyDisabled = 0;
-my $constituency_cf = RT::CustomField->new($session{'CurrentUser'});
-my ($ok, $msg) = $constituency_cf->LoadByName(Queue => $QueueObj->Id, Name => 'Constituency');
-if ( not $ok or $constituency_cf->Disabled ){
-    $ConstituencyDisabled = 1;
-}
 
 if ( $ARGS{'HTMLReport'} || $ARGS{'TextReport'} || $ARGS{'SpreadsheetReport'} ) {
-    unless ( $ARGS{'Constituency'} or $ConstituencyDisabled ) {
-        $ARGS{'Constituency'} = delete $ARGS{ 'Object-RT::Ticket--CustomField-'. $constituency_cf->Id .'-Values' };
-    }
     my $ext = 'html';
     $ext = 'txt' if $ARGS{'TextReport'};
     $ext = 'tsv' if $ARGS{'SpreadsheetReport'};
diff --git a/lib/RT/Action/RTIR_SetConstituency.pm b/lib/RT/Action/RTIR_SetConstituency.pm
deleted file mode 100644
index c68e16d..0000000
--- a/lib/RT/Action/RTIR_SetConstituency.pm
+++ /dev/null
@@ -1,215 +0,0 @@
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
-#                                          <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-package RT::Action::RTIR_SetConstituency;
-use strict;
-use warnings;
-use base 'RT::Action::RTIR';
-
-=head2 Commit
-
-Set the Constituency custom field.
-
-=cut
-
-sub Commit {
-    my $self = shift;
-    my $ticket = $self->TicketObj;
-
-    my $type = $self->TransactionObj->Type;
-    if ( $type eq 'Create' ) {
-        my $status = $self->SetConstituencyOnCreate;
-        return $status if defined $status;
-    }
-
-    my $propagation = lc RT->Config->Get('_RTIR_Constituency_Propagation');
-    if ( $type eq 'AddLink' && $propagation eq 'reject' ) {
-        #XXX: check here that linked tickets have the same constituency
-    }
-
-    return $self->InheritConstituency if $propagation eq 'inherit';
-
-    return 1;
-
-}
-
-sub InheritConstituency {
-    my $self = shift;
-    my $ticket = $self->TicketObj;
-
-    my $query =  "( Queue = 'Incidents'"
-        ." OR Queue = 'Incident Reports'"
-        ." OR Queue = 'Investigations'"
-        ." OR Queue = 'Blocks'"
-        .")";
-
-    my $constituency = $ticket->FirstCustomFieldValue('Constituency');
-    if ( $constituency ) {
-        $query .= " AND CF.{Constituency} != '$constituency'";
-    } else {
-        $query .= " AND CF.{Constituency} IS NOT NULL";
-    }
-
-    my $type = $self->TransactionObj->Type;
-    if ( $type eq 'AddLink' ) {
-        # inherit from parent on linking
-        my $tickets = RT::Tickets->new( RT->SystemUser );
-        $tickets->FromSQL( $query ." AND HasMember = ". $ticket->Id );
-        $tickets->RowsPerPage( 1 );
-        if ( my $parent = $tickets->First ) {
-            RT->Logger->debug( "Ticket #". $ticket->id ." inherits constituency from ticket #". $parent->id );
-            my ($res, $msg) = $ticket->AddCustomFieldValue(
-                Field => 'Constituency',
-                Value => $constituency,
-            );
-            RT->Logger->warning( "Couldn't set CF: $msg" ) unless $res;
-            return 1;
-        }
-    }
-
-    # propagate to members
-    foreach my $link_type (qw(MemberOf HasMember)) {
-        my $tickets = RT::Tickets->new( RT->SystemUser );
-        $tickets->FromSQL( $query ." AND $link_type = ". $ticket->Id );
-        while ( my $t = $tickets->Next ) {
-            RT->Logger->debug(
-                "Ticket #". $t->id ." inherits constituency"
-                ." from ticket #". $ticket->id
-            );
-            my ($res, $msg) = $t->AddCustomFieldValue(
-                Field => 'Constituency',
-                Value => $constituency,
-            );
-            RT->Logger->warning( "Couldn't set CF: $msg" ) unless $res;
-        }
-    }
-    return 1;
-}
-
-sub SetConstituencyOnCreate {
-    my $self = shift;
-    my $ticket = $self->TicketObj;
-
-    my ($current, $value);
-    $current = $value = $ticket->FirstCustomFieldValue('Constituency');
-    if ( my $tmp = $self->GetConstituencyFromParent ) {
-        my $propagation = lc RT->Config->Get('_RTIR_Constituency_Propagation');
-        if ( $propagation eq 'inherit' ) {
-            $value = $tmp;
-        } elsif ( $propagation eq 'reject' && ($current||'') ne $tmp ) {
-            RT->Logger->error(
-                "Constituency propagation algorithm is 'reject', but "
-                . "ticket ". $ticket->id ." has constituency '$current'"
-                . " when its parent incident has '$tmp'"
-            );
-        }
-    }
-    $value ||= $self->GetConstituencyFromAttachment;
-    $value ||= RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
-    return undef if ($current||'') eq ($value||'');
-
-    my ($status, $msg) = $ticket->AddCustomFieldValue(
-        Field => 'Constituency',
-        Value => $value,
-    );
-    RT->Logger->warning( "Couldn't set CF: $msg" ) unless $status;
-    return $status || 0;
-}
-
-sub GetConstituencyFromAttachment {
-    my $self = shift;
-
-    # fetch value from X-RT-Mail-Extension field
-    my $attachments = $self->TransactionObj->Attachments;
-    $attachments->OrderByCols(
-        { FIELD => 'Created', ORDER => 'ASC' },
-        { FIELD => 'id',      ORDER => 'ASC' },
-    );
-    $attachments->Columns( qw(id Parent TransactionId ContentType ContentEncoding Headers Subject Created) );
-    my $attachment = $attachments->First;
-    return undef unless $attachment;
-
-    my $value = $attachment->GetHeader('X-RT-Mail-Extension');
-    return undef unless $self->IsValidConstituency( $value );
-    RT->Logger->debug( "Got constituency from attachment". ($value||'(no value)') );
-    return $value;
-}
-
-sub GetConstituencyFromParent {
-    my $self = shift;
-    my $parents = RT::Tickets->new( RT->SystemUser );
-    $parents->FromSQL( "HasMember = ". $self->TicketObj->id );
-    $parents->OrderByCols( { FIELD => 'LastUpdated', ORDER => 'DESC' } );
-    $parents->RowsPerPage(1);
-    return unless my $parent = $parents->First;
-    my $value = $parent->FirstCustomFieldValue('Constituency');
-    RT->Logger->debug( "Got constituency from parent: ". ($value||'(no value)') );
-    return $value;
-}
-
-{ my %constituency;
-
-sub IsValidConstituency {
-    my $self = shift;
-    my $value = shift or return 0;
-    unless ( keys %constituency ) {
-        my $cf = RT::CustomField->new( RT->SystemUser );
-        $cf->Load('Constituency');
-        unless ( $cf->id ) {
-            RT->Logger->crit("Couldn't load constituency field");
-            return 0;
-        }
-        %constituency = map { lc $_->Name => $_->Name } @{ $cf->Values->ItemsArrayRef };
-    }
-    return $constituency{ lc $value };
-}
-
-}
-
-RT::IR->ImportOverlays;
-
-1;
diff --git a/lib/RT/Action/RTIR_SetConstituencyGroup.pm b/lib/RT/Action/RTIR_SetConstituencyGroup.pm
deleted file mode 100644
index 62e03c6..0000000
--- a/lib/RT/Action/RTIR_SetConstituencyGroup.pm
+++ /dev/null
@@ -1,123 +0,0 @@
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
-#                                          <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-package RT::Action::RTIR_SetConstituencyGroup;
-use strict;
-use warnings;
-use base 'RT::Action::RTIR';
-
-=head2 Commit
-
-Set the Constituency custom field.
-
-=cut
-
-sub Commit {
-    my $self = shift;
-    my $ticket = $self->TicketObj;
-    my $admincc_group = $ticket->AdminCc;
-    unless ( $admincc_group && $admincc_group->id ) {
-        RT->Logger->crit("Couldn't load AdminCc group of ticket #". $ticket->id);
-        return 0;
-    }
-    my $groups = $admincc_group->GroupMembersObj( Recursively => 0 );
-    $groups->LimitToUserDefinedGroups;
-    $groups->Limit( FIELD => 'Name', OPERATOR => 'STARTSWITH', VALUE => 'DutyTeam ', CASESENSITIVE => 0 );
-
-    my $constituency = $ticket->FirstCustomFieldValue('Constituency') || '';
-    my $required_group_there = 0;
-    while ( my $group = $groups->Next ) {
-        if ( lc $group->Name eq lc "dutyteam $constituency" ) {
-            $required_group_there = 1;
-        } elsif ( $group->Name =~ /^DutyTeam\s+\S.*$/ ) {
-            my ($status, $msg) = $ticket->DeleteWatcher(
-                Type        => 'AdminCc',
-                PrincipalId => $group->id,
-            );
-            RT->Logger->error("Couldn't delete admin cc: $msg") unless $status;
-        }
-    }
-    if ( !$required_group_there && $constituency ) {
-        my $group = RT::Group->new( RT->SystemUser );
-        $group->LoadUserDefinedGroup("DutyTeam $constituency");
-        unless ( $group->id ) {
-            RT->Logger->warning("Couldn't load group 'DutyTeam $constituency'");
-            # return success as if there is no custom group for the constituency
-            # then it means that no custom ACLs should be applied
-            return 1;
-        }
-        my ($status, $msg) = $ticket->AddWatcher(
-            Type        => 'AdminCc',
-            PrincipalId => $group->id,
-        );
-        RT->Logger->error("Couldn't add admin cc: $msg") unless $status;
-    }
-    return 1;
-}
-
-{ my @constituencies;
-
-sub ConstituencyValues {
-    my $self = shift;
-    my $value = shift or return 0;
-    unless ( @constituencies ) {
-        my $cf = RT::CustomField->new( RT->SystemUser );
-        $cf->Load('Constituency');
-        unless ( $cf->id ) {
-            RT->Logger->crit("Couldn't load constituency field");
-            return 0;
-        }
-        @constituencies = map { $_->Name } @{ $cf->Values->ItemsArrayRef };
-    }
-    return @constituencies;
-}
-
-}
-
-RT::IR->ImportOverlays;
-
-1;
diff --git a/lib/RT/Condition/RTIR_RequireConstituencyChange.pm b/lib/RT/Condition/RTIR_RequireConstituencyChange.pm
deleted file mode 100644
index 192aa88..0000000
--- a/lib/RT/Condition/RTIR_RequireConstituencyChange.pm
+++ /dev/null
@@ -1,77 +0,0 @@
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
-#                                          <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-package RT::Condition::RTIR_RequireConstituencyChange;
-use strict;
-use warnings;
-use base 'RT::Condition::RTIR';
-
-=head2 IsApplicable
-
-Applies to tickets being created, linked to other tickets or when
-the Constituency Custom Field is changed
-
-=cut
-
-sub IsApplicable {
-    my $self = shift;
-
-    my $ticket = $self->TicketObj;
-    my $cf = $ticket->LoadCustomFieldByIdentifier('Constituency');
-    return 0 unless $cf && $cf->id;
-
-    my $txn = $self->TransactionObj;
-    my $type = $txn->Type;
-    return 1 if $type eq 'Create';
-    return 1 if $type eq 'AddLink';
-    return 1 if $type eq 'CustomField' && $cf->id == $txn->Field;
-    return 0;
-}
-
-RT::IR->ImportOverlays;
-
-1;
diff --git a/lib/RT/Condition/RTIR_RequireConstituencyGroupChange.pm b/lib/RT/Condition/RTIR_RequireConstituencyGroupChange.pm
deleted file mode 100644
index 03b10eb..0000000
--- a/lib/RT/Condition/RTIR_RequireConstituencyGroupChange.pm
+++ /dev/null
@@ -1,76 +0,0 @@
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
-#                                          <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-package RT::Condition::RTIR_RequireConstituencyGroupChange;
-use strict;
-use warnings;
-use base 'RT::Condition::RTIR';
-
-=head2 IsApplicable
-
-Applies to Ticket Creation and Constituency changes
-
-=cut
-
-sub IsApplicable {
-    my $self = shift;
-
-    my $ticket = $self->TicketObj;
-    my $cf = $ticket->LoadCustomFieldByIdentifier('Constituency');
-    # no constituency
-    return 0 unless $cf && $cf->id;
-
-    my $txn = $self->TransactionObj;
-    my $type = $txn->Type;
-    return 1 if $type eq 'Create';
-    return 1 if $type eq 'CustomField' && $cf->id == $txn->Field;
-    return 0;
-}
-
-RT::IR->ImportOverlays;
-
-1;
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 0b1ca85..81b315e 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -253,7 +253,6 @@ sub Query {
         HasNoMember  => undef,
         MemberOf     => undef,
         NotMemberOf  => undef,
-        Constituency => undef,
         And          => undef,
         @_
     );
@@ -284,17 +283,6 @@ sub Query {
     if ( my $t = $args{'NotMemberOf'} ) {
         push @res, join ' AND ', map "MemberOf != $_", map int $_, $flat->( $t, 'id' );
     }
-    if (
-        my $t = $args{'Constituency'}
-        and RT->Config->Get('_RTIR_Constituency_Propagation') eq 'reject'
-    ) {
-        unless ( ref $t ) {
-            my $tmp = RT::Ticket->new( RT->SystemUser );
-            $tmp->Load( $t );
-            $t = $tmp;
-        }
-        push @res, "CustomField.{Constituency} = '". $t->FirstCustomFieldValue('Constituency') ."'";
-    }
     if ( my $c = $args{'And'} ) {
         push @res, ref $c? @$c : ($c);
     }
@@ -624,125 +612,6 @@ sub FilterRTAddresses {
     return $found;
 }
 
-{ my $cache;
-sub HasConstituency {
-    return $cache if defined $cache;
-
-    my $self = shift;
-    return $cache = $self->CustomFields('Constituency');
-}
-sub _FlushHasConstituencyCache {
-    undef $cache;
-} }
-
-sub DefaultConstituency {
-    my $queue = shift;
-    my $name = $queue->Name;
-
-    my @values;
-
-    my $queues = RT::Queues->new( RT->SystemUser );
-    $queues->Limit( FIELD => 'Name', OPERATOR => 'STARTSWITH', VALUE => "$name - ", CASESENSITIVE => 0 );
-    while ( my $pqueue = $queues->Next ) {
-        next unless $pqueue->HasRight( Principal => $queue->CurrentUser, Right => "ShowTicket" );
-        push @values, substr $pqueue->__Value('Name'), length("$name - ");
-    }
-    my $default = RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'} || '';
-    return $default if grep { lc $_ eq lc $default } @values;
-    return shift @values;
-}
-
-
-if ( RT::IR->HasConstituency ) {
-
-    # lots of wrapping going on
-    no warnings 'redefine';
-
-    # flush constituency caches on each request
-    require RT::Interface::Web::Handler;
-    my $orig_CleanupRequest = RT::Interface::Web::Handler->can('CleanupRequest');
-    *RT::Interface::Web::Handler::CleanupRequest = sub {
-        %RT::IR::ConstituencyCache = ();
-        %RT::IR::HasNoQueueCache = ();
-        RT::Queue::_FlushQueueHasRightCache();
-        RT::IR::FlushCustomFieldsCache();
-        RT::IR::_FlushHasConstituencyCache();
-        $orig_CleanupRequest->();
-    };
-
-    require RT::Ticket;
-    # flush constituency cache for a ticket when the Constituency CF is updated
-    # RT::Ticket currently uses RT::Record::_AddCustomFieldValue so we just insert not wrap
-    # I wonder what happens when you Delete an OCFV, since it doesn't hit this code path.
-    # This also clears the constituency cache when updating the IP Custom Field, intentional?
-    sub RT::Ticket::_AddCustomFieldValue {
-        my $self = shift;
-        $RT::IR::ConstituencyCache{$self->id}  = undef;
-        return $self->RT::Record::_AddCustomFieldValue(@_);
-    };
-
-    # Tickets with Constituencies CF values that point to a Constituency
-    # Queue such as Incidents - EDUNET should return multiple Queues as
-    # EquivalenceObjects for checking rights. Constituency DutyTeams
-    # have their rights granted on the relevant Constituency Queues, so
-    # RT needs to know to check in both places for the combination of
-    # their rights.
-    my $orig_ACLEquivaluenceObjects = RT::Ticket->can('ACLEquivalenceObjects');
-    *RT::Ticket::ACLEquivalenceObjects = sub {
-        my $self = shift;
-
-        my $queue = RT::Queue->new(RT->SystemUser);
-        $queue->Load($self->__Value('Queue'));
-
-        # For historical reasons, the System just returned a System Queue on this Ticket
-        # rather than delve into the overridden QueueObj.  It's possible this is no longer needed.
-        # The biggest thing that $self->QueueObj would do is return a queue with _for_ticket set
-        # which causes a lot of code to skip Constituency checks, so we'd need to duplicate that.
-        # We punt early on non-IR queues because otherwise we try to look for constituency Queues
-        # and the negative cache (_none) is disabled, leading to perf problems.
-        # It's also somewhat concerning that we return a SystemUser queue outside IR queues.
-        if ( ( $self->CurrentUser->id == RT->SystemUser->id ) ||
-             ( ! RT::IR->OurQueue( $queue ) ) ) {
-            return $queue;
-        }
-
-        # Old old bulletproofing, can probably delete.
-        unless ( UNIVERSAL::isa( $self, 'RT::Ticket' ) ) {
-            RT->Logger->crit("$self is not a ticket object like I expected");
-            return;
-        }
-
-        # We check both uncached constituencies and those explicitly negatively cached
-        # The commit that introduced this doesn't say what bug it was fixing, but it's definitely
-        # a perf hit.
-        my $const = $RT::IR::ConstituencyCache{ $self->id };
-        if (!$const || $const eq '_none' ) {
-            my $systicket = RT::Ticket->new(RT->SystemUser);
-            $systicket->Load( $self->id );
-            $const = $RT::IR::ConstituencyCache{ $self->id } =
-                $systicket->FirstCustomFieldValue('Constituency') || '_none';
-        }
-
-        # If this ticket still has no constituency, or the constituency it is assigned
-        # doesn't have a corresponding Constituency queue, return the default Queue.
-        if ( $const eq '_none' || $RT::IR::HasNoQueueCache{ $const } ) {
-            return $orig_ACLEquivaluenceObjects->($self, at _);
-        }
-
-        # Track that there is no Constituency queue for the Constituency recorded in the CF on this ticket.
-        my $constituency_queue = RT::Queue->new(RT->SystemUser);
-        $constituency_queue->LoadByCols( Name => $queue->Name . " - " . $const );
-        unless ( $constituency_queue->id ) {
-            $RT::IR::HasNoQueueCache{$const} = 1;
-            return $orig_ACLEquivaluenceObjects->($self, at _);
-        }
-
-        # If a constituency queue such as 'Incidents - EDUNET' exists, we want to check
-        # ACLs on both of them.
-        return $queue, $constituency_queue;
-    };
-}
-
 # Skip the global AutoOpen and AutoOpenInactive scrip on Blocks and Incident Reports
 # This points to RTIR wanting to muck with the global scrips using the 4.2 scrips
 # organization, although it possibly messes with Admins expectations of 'contained Queues'
@@ -817,176 +686,6 @@ require RT::CustomField;
     };
 }
 
-if ( RT::IR->HasConstituency ) {
-    # Queue {Comment,Correspond}Address for multiple constituencies
-
-    no warnings 'redefine';
-
-    # returns an RT::Queue that has _for_ticket set to indicate
-    # that we're using this Queue to check something about a ticket
-    # that may have a Constituency.
-    require RT::Ticket;
-    my $orig_QueueObj = RT::Ticket->can('QueueObj');
-    *RT::Ticket::QueueObj = sub {
-        my $self = shift;
-        # RT::Ticket::QueueObj uses a cache
-        my $queue = $orig_QueueObj->($self, at _);
-        # used to know that this Queue was retrieved from a ticket
-        # so we can skip a bunch of constituency checks...
-        $queue->{'_for_ticket'} = $self->id;
-        return $queue;
-    };
-
-    require RT::Queue;
-    package RT::Queue;
-
-    { my $queue_cache = {};
-    # RT 4.2 removed RT::Queue's HasRight, meaning we can just stub one in
-    sub HasRight {
-        my $self = shift;
-        my %args = @_;
-
-        return $self->SUPER::HasRight(@_) unless $self->id;
-        # currently only obviously used so that one right can be checked
-        # on Incidents not Incidents - EDUNET during Constituency CF
-        # editing.
-        return $self->SUPER::HasRight(@_) if $self->{'disable_constituency_right_check'};
-        # Not really convinced this is right, since it gets set on $ticket->QueueObj
-        # commit messages that add it are vague about why it was added.
-        return $self->SUPER::HasRight(@_) if $self->{'_for_ticket'};
-
-        my $name = $self->__Value('Name');
-        return $self->SUPER::HasRight(@_) unless $name =~
-            /^(Incidents|Incident Reports|Investigations|Blocks)$/i;
-
-        $args{'Principal'} ||= $self->CurrentUser->PrincipalObj;
-
-        # Avoid going to the database on every Queue->HasRight('ModifyCustomField') or any
-        # other Queue right, but in RTIR, CF rights checks at the Queue level are very heavy.
-        my $equiv_objects;
-        if ( $queue_cache->{$name} ) {
-            $equiv_objects = $queue_cache->{$name};
-        } else {
-            my $queues = RT::Queues->new( RT->SystemUser );
-            $queues->Limit( FIELD => 'Name', OPERATOR => 'STARTSWITH', VALUE => "$name - ", CASESENSITIVE => 0 );
-            $equiv_objects = $queues->ItemsArrayRef;
-            $queue_cache->{$name} = $equiv_objects;
-        }
-
-        my $has_right = $args{'Principal'}->HasRight(
-            %args,
-            Object => $self,
-            EquivObjects => $equiv_objects,
-        );
-        return $has_right;
-    };
-    sub _FlushQueueHasRightCache { undef $queue_cache  };
-    }
-
-
-
-    # TODO SubjectTag and Encryption Keys need overriding also
-    sub CorrespondAddress { return GetQueueAttribute(shift, 'CorrespondAddress') }
-    sub CommentAddress { return GetQueueAttribute(shift, 'CommentAddress') }
-
-    # dive down to get Queue Attributes from Incidents - EDUNET rather than Incidents
-    # Populates ConstituencyCache and HasNoQueueCache, but has the same
-    # bug around always over-checking the Constituency CF if we've
-    # cached that a ticket has no Constituency.
-    sub GetQueueAttribute {
-        my $queue = shift;
-        my $attr  = shift;
-
-        if ( RT::IR->OurQueue($queue) ) {
-            if ( ( my $id = $queue->{'_for_ticket'} ) ) {
-                my $const = $RT::IR::ConstituencyCache{$id};
-                if (!$const || $const eq '_none' ) {
-                    my $ticket = RT::Ticket->new(RT->SystemUser);
-                    $ticket->Load($id);
-                    $const = $RT::IR::ConstituencyCache{$ticket->id}
-                        = $ticket->FirstCustomFieldValue('Constituency') || '_none';
-                }
-                if ($const ne '_none' && !$RT::IR::HasNoQueueCache{$const} ) {
-                    my $new_queue = RT::Queue->new(RT->SystemUser);
-                    $new_queue->LoadByCols( Name => $queue->Name . " - " . $const );
-                    if ( $new_queue->id && !$new_queue->Disabled ) {
-                        my $val = $new_queue->_Value($attr) || $queue->_Value($attr);
-                        RT->Logger->debug("Overriden $attr is $val for ticket #$id according to constituency $const");
-                        return $val;
-                    } else {
-                        $RT::IR::HasNoQueueCache{$const} = 1;
-                    }
-                }
-            }
-        }
-        return $queue->_Value($attr);
-    }
-}
-
-
-if ( RT::IR->HasConstituency ) {
-    # Set Constituency on Create
-
-    no warnings 'redefine';
-
-    require RT::Ticket;
-    my $orig_Create = RT::Ticket->can('Create');
-    *RT::Ticket::Create = sub {
-        my $self = shift;
-        my %args = @_;
-
-        # get out if there is constituency value in arguments
-        my $cf = GetCustomField( 'Constituency' );
-        unless ($cf && $cf->id) {
-            return $orig_Create->($self,%args);
-        }
-        if ($args{ 'CustomField-'. $cf->id }) {
-            return $orig_Create->($self,%args);
-        }
-
-        # get out of here if it's not RTIR queue
-        my $QueueObj = RT::Queue->new( RT->SystemUser );
-        if ( ref $args{'Queue'} eq 'RT::Queue' ) {
-            $QueueObj->Load( $args{'Queue'}->Id );
-        }
-        elsif ( $args{'Queue'} ) {
-            $QueueObj->Load( $args{'Queue'} );
-        }
-        else {
-            return $orig_Create->($self,%args);
-        }
-        unless ( $QueueObj->id &&
-                 $QueueObj->Name =~ /^(Incidents|Incident Reports|Investigations|Blocks)$/i ) {
-            return $orig_Create->($self,%args);
-        }
-
-        
-        # fetch value
-        my $value;
-        if ( $args{'MIMEObj'} ) {
-            my $tmp = $args{'MIMEObj'}->head->get('X-RT-Mail-Extension');
-            if ( $tmp ) {
-                chomp $tmp;
-                $tmp = undef unless
-                    grep { lc $_->Name eq lc $tmp } @{ $cf->Values->ItemsArrayRef };
-            }
-            $value = $tmp;
-            RT->Logger->debug("Found Constituency '$tmp' in email") if $tmp;
-        }
-        $value ||= RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
-        unless ($value) {
-            return $orig_Create->($self,%args);
-        }
-
-        my @res = $orig_Create->(
-            $self,
-            %args,
-            'CustomField-'. $cf->id => $value,
-        );
-        return @res;
-    };
-}
-
 require RT::Search::Simple;
 package RT::Search::Simple;
 
diff --git a/lib/RT/IR/Config.pm b/lib/RT/IR/Config.pm
index c0de127..326e6be 100644
--- a/lib/RT/IR/Config.pm
+++ b/lib/RT/IR/Config.pm
@@ -94,16 +94,6 @@ sub Init {
 
     RT->Config->Set(HomepageComponents => \@homepage_components);
 
-    $RT::Config::META{UseSQLForACLChecks}{PostLoadCheck} = sub {
-        my ($self,$value) = @_;
-        if ( RT::IR->HasConstituency ) {
-            if ( $value ) {
-                $self->Set('UseSQLForACLChecks',0);
-                RT->Logger->info('Disabling UseSQLForACLChecks because Constituencies are in use.  If you are not using Constituencies, you can disable that Custom Field.');
-            }
-        }
-    };
-
     return;
 }
 
diff --git a/po/rtir.pot b/po/rtir.pot
index 293b770..61eac76 100644
--- a/po/rtir.pot
+++ b/po/rtir.pot
@@ -82,10 +82,6 @@ msgstr ""
 msgid "(no name)"
 msgstr ""
 
-#: html/RTIR/Elements/EditConstituency:59
-msgid "-"
-msgstr ""
-
 #: html/RTIR/Tools/Elements/ToolResultsIframe:48
 msgid "<%$research_tools->{$ResearchTool}->{FriendlyName}%>"
 msgstr ""

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


More information about the rt-commit mailing list