[Rt-commit] [rtir] 01/01: Handle multiple-select Constituency

Kevin Falcone falcone at bestpractical.com
Tue Oct 28 14:23:49 EDT 2014


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

falcone pushed a commit to branch 3.0/multiple-select-constituency
in repository rtir.

commit 8e52c434fcce673a6d25b2d177662e518909b4f6
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Oct 28 13:06:30 2014 -0400

    Handle multiple-select Constituency
    
    RTIR ships with a "Select One Value" Constituency field and makes a lot
    of assumptions elsewhere that the field will be single valued
    (especially with the special ACL code and propagation).
    
    RT will not pass along the 'default' values of a select multiple CF
    that already has values (the code in EditCustomField explicitly skips
    things with MaxValues that aren't 1) this means that RT and RTIR have
    code which figures out that the Defaults should be pulled from OCFV.
    
    This code would break on Multiple Select for two reasons.  It tried to
    check DefaultConstituency on an empty Queue Object, but even with that
    fixed, it was looking for a single value from EditCustomField so would
    fail because it would be passed several values and could drop them.
---
 html/RTIR/Elements/EditConstituency | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/html/RTIR/Elements/EditConstituency b/html/RTIR/Elements/EditConstituency
index 40ab802..c5aaeb7 100644
--- a/html/RTIR/Elements/EditConstituency
+++ b/html/RTIR/Elements/EditConstituency
@@ -51,7 +51,7 @@
 %       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);
+%       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')%>/NoAuth/js/cascaded.js"></script>
 %#      XXX - Hide this select from w3m?
@@ -78,17 +78,19 @@ if ( $RenderType eq 'Dropdown' ) {
     $Rows = 0;
 }
 
-unless ($Default) {
-    $Default = $PropagationObject->FirstCustomFieldValue('Constituency') if $PropagationObject;
-    $Default ||= RT::IR::DefaultConstituency( $QueueObj );
-    $Default ||= scalar RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'};
+ 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
-$Default => undef
+ at Default => ()
 $Values => undef
 $Multiple => 0
 $Rows => undef

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


More information about the rt-commit mailing list