[Rt-commit] rt branch, 4.0/case-sensitive-custom-fields-autocompletion, created. rt-4.0.2-114-g3c283b6
Ruslan Zakirov
ruz at bestpractical.com
Mon Oct 17 14:08:28 EDT 2011
The branch, 4.0/case-sensitive-custom-fields-autocompletion has been created
at 3c283b6a823d0fbd599c61dde3bc55f44238524b (commit)
- Log -----------------------------------------------------------------
commit 3c283b6a823d0fbd599c61dde3bc55f44238524b
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Mon Oct 17 22:07:21 2011 +0400
make sure autocomp. for CF values is case insensitive
diff --git a/share/html/Helpers/Autocomplete/CustomFieldValues b/share/html/Helpers/Autocomplete/CustomFieldValues
index 65e5170..48a2b2b 100644
--- a/share/html/Helpers/Autocomplete/CustomFieldValues
+++ b/share/html/Helpers/Autocomplete/CustomFieldValues
@@ -69,6 +69,7 @@ $values->Limit(
OPERATOR => 'LIKE',
VALUE => $term,
SUBCLAUSE => 'autocomplete',
+ CASESENSITIVE => 0,
);
$values->Limit(
ENTRYAGGREGATOR => 'OR',
@@ -76,6 +77,7 @@ $values->Limit(
OPERATOR => 'LIKE',
VALUE => $term,
SUBCLAUSE => 'autocomplete',
+ CASESENSITIVE => 0,
);
my @suggestions;
diff --git a/t/web/case-sensitivity.t b/t/web/case-sensitivity.t
index 8cf14a1..276b761 100644
--- a/t/web/case-sensitivity.t
+++ b/t/web/case-sensitivity.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 14;
+use RT::Test tests => 18;
my $q = RT::Test->load_or_create_queue( Name => 'General' );
ok $q && $q->id, 'loaded or created queue';
@@ -57,3 +57,29 @@ $m->login;
like $m->uri, qr{\QAdmin/Users/Modify.html?id=$root_id\E};
}
+# create a cf for testing
+my $cf;
+{
+ $cf = RT::CustomField->new(RT->SystemUser);
+ my ($id,$msg) = $cf->Create(
+ Name => 'Test',
+ Type => 'Select',
+ MaxValues => '1',
+ Queue => $q->id,
+ );
+ ok($id,$msg);
+
+ ($id,$msg) = $cf->AddValue(Name => 'Enoch', Description => 'Root');
+ ok($id,$msg);
+}
+
+# test custom field values auto completer
+{
+ $m->get_ok('/Helpers/Autocomplete/CustomFieldValues?term=eNo&Object---CustomField-'. $cf->id .'-Value');
+ require JSON;
+ is_deeply(
+ JSON::from_json( $m->content ),
+ [{"value" => "Enoch","label" => "Enoch (Root)"}]
+ );
+}
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list