[Rt-commit] rt branch, 4.2/cf-autocomplete-grouping-name, created. rt-4.2.1rc1-4-gaf6c059

Jim Brandt jbrandt at bestpractical.com
Fri Nov 15 11:58:41 EST 2013


The branch, 4.2/cf-autocomplete-grouping-name has been created
        at  af6c059546be77e7b948ec4d169f5c5b010ee482 (commit)

- Log -----------------------------------------------------------------
commit ee1274a0b5f2825bec4ba5c7fa2c737f4c8a67c0
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Nov 15 10:56:51 2013 -0500

    Update NamePrefix regex to match CF grouping when provided
    
    8d87f2ce added a grouping string to the NamePrefix. Update
    the autocomplete helper to handle it. Use
    _ParseObjectCustomFieldArgs to avoid duplicating the regex.

diff --git a/share/html/Helpers/Autocomplete/CustomFieldValues b/share/html/Helpers/Autocomplete/CustomFieldValues
index a5ba1fc..505d24b 100644
--- a/share/html/Helpers/Autocomplete/CustomFieldValues
+++ b/share/html/Helpers/Autocomplete/CustomFieldValues
@@ -63,11 +63,17 @@ unless ( exists $ARGS{ContextType} and exists $ARGS{ContextId} ) {
     $abort->();
 }
 
+# Use _ParseObjectCustomFieldArgs to avoid duplicating the regex.
+# See the docs for _ParseObjectCustomFieldArgs for details on the data
+# structure returned. There will be only one CF, so drill down 2 layers
+# to get the cf id, if one is there.
+
+my %custom_fields = _ParseObjectCustomFieldArgs(\%ARGS);
 my $CustomField;
-for my $k ( keys %ARGS ) {
-    next unless $k =~ /^Object-.*?-\d*-CustomField-(\d+)-Values?$/;
-    $CustomField = $1;
-    last;
+foreach my $class ( keys %custom_fields ){
+    foreach my $id ( keys %{$custom_fields{$class}} ){
+        ($CustomField) = keys %{$custom_fields{$class}{$id}};
+    }
 }
 
 unless ( $CustomField ) {

commit af6c059546be77e7b948ec4d169f5c5b010ee482
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Nov 15 11:54:54 2013 -0500

    Update autocomplete call to include object type
    
    The previous autocomplete query was successful with the old
    autocomplete cf regex, but object type (i.e., RT::Ticket) is
    correctly required by the regex in _ParseObjectCustomFieldArgs.

diff --git a/t/web/case-sensitivity.t b/t/web/case-sensitivity.t
index 5220bbd..7599371 100644
--- a/t/web/case-sensitivity.t
+++ b/t/web/case-sensitivity.t
@@ -73,7 +73,7 @@ my $cf;
 
 # test custom field values auto completer
 {
-    $m->get_ok('/Helpers/Autocomplete/CustomFieldValues?term=eNo&Object---CustomField-'. $cf->id .'-Value&ContextId=1&ContextType=RT::Queue');
+    $m->get_ok('/Helpers/Autocomplete/CustomFieldValues?term=eNo&Object-RT::Ticket--CustomField-'. $cf->id .'-Value&ContextId=1&ContextType=RT::Queue');
     require JSON;
     is_deeply(
         JSON::from_json( $m->content ),

-----------------------------------------------------------------------


More information about the rt-commit mailing list