[Rt-commit] rt branch, 4.2/allow-category-basedon-for-external-cfs, created. rt-4.2.3-11-ge369b1b

Jim Brandt jbrandt at bestpractical.com
Mon Mar 3 15:01:37 EST 2014

The branch, 4.2/allow-category-basedon-for-external-cfs has been created
        at  e369b1bab5a0ee45f0087d5c0db64ee2df0ce93a (commit)

- Log -----------------------------------------------------------------
commit fe7e13ad6fed463b219f4aa7417be5d451e1b8e2
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Mon Mar 3 14:16:20 2014 -0500

    Allow users to set a "based on" category for external CFVs
    The based on option was specifically not shown if the CF being
    edited was flagged as an external CF, however it was still
    possible to set it if you set the Field Value Source and the
    based on option in the same edit. Regardless, categories appear
    to work fine with external custom fields.

diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index 78995f3..a39b0af 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -122,7 +122,7 @@
 <i><&|/l&>Some browsers may only load content from the same domain as your RT server.</&></i>
-% if ( $CustomFieldObj->Id && $CustomFieldObj->IsSelectionType && !$CustomFieldObj->IsExternalValues ) {
+% if ( $CustomFieldObj->Id && $CustomFieldObj->IsSelectionType ) {
 <tr class="categoriesbasedon"><td class="label"><&|/l&>Categories are based on</&></td><td>
 <& /Admin/Elements/SelectCustomField,
     Name => "BasedOn",

commit e369b1bab5a0ee45f0087d5c0db64ee2df0ce93a
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Mon Mar 3 14:37:39 2014 -0500

    Add docs for setting category in external CFV

diff --git a/docs/extending/external_custom_fields.pod b/docs/extending/external_custom_fields.pod
index f32bda7..5e70d3e 100644
--- a/docs/extending/external_custom_fields.pod
+++ b/docs/extending/external_custom_fields.pod
@@ -57,6 +57,10 @@ web interface. See L</Configuration>.
 This method should return an array reference of hash references.  The
 hash references should contain keys for C<name>, C<description>, and
 C<sortorder>. C<name> is most important one; the others are optional.
+You can also optionally provide a key for C<category> and use the
+"Categories are based on" option on the custom field configuration
+page to make the values displayed for this custom field vary based
+on the value selected in the "based on" custom field.
@@ -77,9 +81,9 @@ Here's a simple static example:
       # return reference to array ([])
       return [
           # each element of the array is a reference to hash that describe a value
-          # possible keys are name, description and sortorder
-          { name => 'value1', description => 'external value', sortorder => 1 },
-          { name => 'value2', description => 'another external value', sortorder => 2 },
+          # possible keys are name, description, sortorder, and category
+          { name => 'value1', description => 'external value', sortorder => 1, category => 'Other CF' },
+          { name => 'value2', description => 'another external value', sortorder => 2, category => 'Other CF' },
           # values without description are also valid, the default description is empty string
           { name => 'value3', sortorder => 3 },
           # you can skip sortorder too, but note that the default sortorder is 0 (zero)
diff --git a/lib/RT/CustomFieldValues/External.pm b/lib/RT/CustomFieldValues/External.pm
index 96ffc00..52ca1a5 100644
--- a/lib/RT/CustomFieldValues/External.pm
+++ b/lib/RT/CustomFieldValues/External.pm
@@ -77,8 +77,10 @@ the identifier by which the user will see the dropdown.
 =head2 ExternalValues
 This method should return an array reference of hash references.  The
-hash references should contain keys for C<name>, C<description>, and
+hash references must contain a key for C<name> and can optionally contain
+keys for C<description>, C<sortorder>, and C<category>. If supplying a
+category, you must also set the category the custom field is based on in
+the custom field configuration page.
 =head1 SEE ALSO


More information about the rt-commit mailing list