[Rt-commit] rt branch 4.4/cfv-order-by-category created. rt-4.4.5-23-g827b1d47b0

BPS Git Server git at git.bestpractical.com
Tue Jan 25 17:26:04 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 4.4/cfv-order-by-category has been created
        at  827b1d47b088f69bc600d158d8d053e4ceaf0a8a (commit)

- Log -----------------------------------------------------------------
commit 827b1d47b088f69bc600d158d8d053e4ceaf0a8a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jan 26 00:42:53 2022 +0800

    Update tests for the default order change of custom field values

diff --git a/t/customfields/combo_cascade.t b/t/customfields/combo_cascade.t
index fba2fac868..5a044dea98 100644
--- a/t/customfields/combo_cascade.t
+++ b/t/customfields/combo_cascade.t
@@ -29,7 +29,9 @@ add_works('value3', '1.1. A-sub one');
 add_works('value4', '1.2. A-sub two');
 add_works('value5', '');
 
-my $cfv = $cf->Values->First;
+my $cfvs = $cf->Values;
+$cfvs->Limit( FIELD => 'Category', VALUE => '1. Category A' );
+my $cfv = $cfvs->First;
 is($cfv->Category, '1. Category A');
 works($cfv->SetCategory('1. Category AAA'));
 is($cfv->Category, '1. Category AAA');

commit bfb7d8ff49e9a25f07f3d11f91a89a28f25af5fe
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Jan 25 21:28:01 2022 +0800

    Group custom field values by category
    
    Categories are shown as optgroup labels, previously the select input
    could look like:
    
        Bar
          1 bar
        Foo
          1 foo
        Bar
          2 bar
        Foo
          2 foo
    
    With this commit, the UI is like:
    
        Bar
          1 bar
          2 bar
        Foo
          1 foo
          2 foo
    
    It's more compact and less confusing.
    
    This change also gets around the limitation that current cascaded.js
    doesn't support multiple optgroups sharing the same label(only the first
    one is shown).

diff --git a/lib/RT/CustomFieldValues.pm b/lib/RT/CustomFieldValues.pm
index 73cee9e0d9..9066746c4d 100644
--- a/lib/RT/CustomFieldValues.pm
+++ b/lib/RT/CustomFieldValues.pm
@@ -62,6 +62,9 @@ sub _Init {
 
   # By default, order by SortOrder
   $self->OrderByCols(
+         { ALIAS => 'main',
+           FIELD => 'Category',
+           ORDER => 'ASC' },
          { ALIAS => 'main',
            FIELD => 'SortOrder',
            ORDER => 'ASC' },

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list