[Rt-commit] rt branch, 4.4/show-hide-custom-fields, created. rt-4.4.1-432-ge4feb68

Jim Brandt jbrandt at bestpractical.com
Tue Jun 27 08:50:30 EDT 2017


The branch, 4.4/show-hide-custom-fields has been created
        at  e4feb68a910ac4152473704146fc1c7846095589 (commit)

- Log -----------------------------------------------------------------
commit 89b56c99f9c2ab706447a53a7ba4b908061eaebd
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Tue Jun 27 08:37:17 2017 -0400

    Add tests to show incorrect unset cf setting

diff --git a/t/web/ticket_display_unset_fields.t b/t/web/ticket_display_unset_fields.t
index 09a7701..89044e2 100644
--- a/t/web/ticket_display_unset_fields.t
+++ b/t/web/ticket_display_unset_fields.t
@@ -34,6 +34,7 @@ my $bar = RT::Test->create_ticket(
 $bar->SetTold;
 
 my ( $baseurl, $m ) = RT::Test->started_ok;
+diag "URL is: $baseurl";
 
 diag "test with root";
 {
@@ -77,5 +78,44 @@ diag "test without ModifyTicket right";
     is $dom->find(qq{tr.DependsOn:not(.unset-field)})->size, 1, "has Depends on as it is set";
 }
 
+diag "Test unset custom fields";
+{
+    my $cf = RT::Test->load_or_create_custom_field(
+        Name        => 'TextArea',
+        Type        => 'Text',
+        Queue       => 0,
+        LookupType  => 'RT::Queue-RT::Ticket',
+    );
+    ok $cf && $cf->id, "Created TextArea CF";
+
+    $m->login( 'root', 'password', logout => 1 );
+    $m->goto_ticket( $foo->id );
+    my $dom = $m->dom;
+    my $cfid = $cf->Id;
+    is $dom->find(qq{tr.custom-field.custom-field-$cfid.unset-field})->size, 1, "found unset custom field";
+
+    # open ticket "Basics" page
+    my $EditUrl = "/Ticket/Modify.html?id=" . $foo->id;
+    $m->get_ok($EditUrl, "Fetched $EditUrl");
+    $m->content_contains('TextArea:');
+
+    my $cf_input = RT::Interface::Web::GetCustomFieldInputName(
+            Object      => $foo,
+            CustomField => $cf,
+        );
+
+    $m->submit_form_ok({
+        with_fields => {
+            $cf_input            => 'some unique content',
+            $cf_input . '-Magic' => "1",
+        },
+    }, 'submitted form to initially set CFs');
+
+    $m->goto_ticket( $foo->id );
+    $dom = $m->dom;
+    $m->content_contains('some unique content');
+    isnt $dom->find(qq{tr.customfield.unset-field})->size, 1, "no unset custom fields";
+}
+
 undef $m;
 done_testing;

commit e4feb68a910ac4152473704146fc1c7846095589
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Tue Jun 27 08:46:48 2017 -0400

    Apply unset-field when cfs do not have a count
    
    In converting a ternary evaluation of $count to an if,
    523fabb1 missed a 'not' to correctly add unset-field to
    cfs with no values, flipping the set/unset visibility logic.

diff --git a/share/html/Elements/ShowCustomFields b/share/html/Elements/ShowCustomFields
index c6df0d3..2f7d2ae 100644
--- a/share/html/Elements/ShowCustomFields
+++ b/share/html/Elements/ShowCustomFields
@@ -58,7 +58,7 @@
 %   'custom-field',
 %   'custom-field-'.$CustomField->id,
 % );
-% push @classes, 'unset-field' if $count;
+% push @classes, 'unset-field' if not $count;
 % $m->callback( CallbackName => 'ModifyFieldClasses', CustomField => $CustomField,
 %               Object => $Object, Classes => \@classes, Grouping => $Grouping );
   <tr class="<% join(' ', @classes) %>" id="CF-<%$CustomField->id%>-ShowRow">

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


More information about the rt-commit mailing list