RT# 31208 Docs $FS::Record::qsearch_qualify_columns
[freeside.git] / httemplate / elements / select-tiered.html
index e332eef..bdec95c 100644 (file)
@@ -124,15 +124,9 @@ my %opt = @_;
 my $pre = $opt{prefix} || '';
 my $tiers = $opt{tiers} or die "no tiers defined";
 
-#my $json = JSON->new()->canonical(); #sort
-# something super weird and broken going on with JSON's auto-loading, just
-# using JSON alone errors out with
-#   Can't locate object method "new" via package "null" (perhaps you forgot to
-#   load "null"?)
-# yes, "null", not "JSON".  so instead, using JSON::XS explicity...
-use JSON::XS;
-my $json = JSON::XS->new();
+my $json = Cpanel::JSON::XS->new();
 $json->canonical;
+$json->allow_nonref(1);
 
 my $i;
 for( $i = 0; $i < @$tiers; $i++ ) {
@@ -181,6 +175,8 @@ for( $i = 0; $i < @$tiers; $i++ ) {
         $children_of{$key}->{''} = $tier->{empty_label};
       }
     }
+    # ensure that there's always at least one empty label
+    $children_of{''}->{''} = $tier->{empty_label};
   }
   $tier->{by_key} = \%children_of;
 }