[Rt-commit] rt branch, 4.0/changing-custom-field-value-case, created. rt-4.0.13-85-gf4ca661

Thomas Sibley trs at bestpractical.com
Mon Jul 1 17:13:47 EDT 2013


The branch, 4.0/changing-custom-field-value-case has been created
        at  f4ca6619e8b3576f6ae44d257f8ac2c2c423d872 (commit)

- Log -----------------------------------------------------------------
commit 891a2fb35943b6e95fb69821593833ad1055a2f2
Author: Christian Loos <cloos at netcologne.de>
Date:   Fri Jun 21 14:49:11 2013 +0200

    fix change custom field value case
    
    Comparing the lowercased version of the old and new value prevents
    changing the case of a custom field value.

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 61b66d5..a58979e 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -1719,7 +1719,7 @@ sub _AddCustomFieldValue {
             my $is_the_same = 1;
             if ( defined $args{'Value'} ) {
                 $is_the_same = 0 unless defined $old_content
-                    && lc $old_content eq lc $args{'Value'};
+                    && $old_content eq $args{'Value'};
             } else {
                 $is_the_same = 0 if defined $old_content;
             }

commit f4ca6619e8b3576f6ae44d257f8ac2c2c423d872
Author: Christian Loos <cloos at netcologne.de>
Date:   Mon Jul 1 10:02:24 2013 +0200

    add test for CF enter one value case change

diff --git a/t/customfields/enter_one.t b/t/customfields/enter_one.t
new file mode 100644
index 0000000..b67b066
--- /dev/null
+++ b/t/customfields/enter_one.t
@@ -0,0 +1,23 @@
+use strict;
+use warnings;
+
+use RT::Test nodata => 1, tests => undef;
+
+my $q = RT::Test->load_or_create_queue(Name => 'General');
+ok $q && $q->id, "loaded or created queue 'General'";
+
+my $cf = RT::CustomField->new(RT->SystemUser);
+my ($id,$msg) = $cf->Create(Name => 'Enter-One', Type => 'Freeform', MaxValues => '1', Queue => $q->id);
+ok $id, $msg;
+
+my $t = RT::Ticket->new(RT->SystemUser);
+($id,undef,$msg) = $t->Create(Queue => $q->id, Subject => 'CF Enter-One Test');
+ok $id, $msg;
+
+$t->AddCustomFieldValue(Field => $cf->id, Value => 'LOWER');
+is $t->FirstCustomFieldValue($cf->id), "LOWER", "CF value is 'LOWER'";
+
+$t->AddCustomFieldValue(Field => $cf->id, Value => 'lower');
+is $t->FirstCustomFieldValue($cf->id), "lower", "CF value changed from 'LOWER' to 'lower'";
+
+done_testing();

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


More information about the Rt-commit mailing list