[Rt-commit] rt branch, 4.4/supress-assets-cf-search-button-for-catalogs-with-no-cfs, created. rt-4.2.12-369-g86cbc84

Todd Wade todd at bestpractical.com
Fri Oct 30 15:02:00 EDT 2015


The branch, 4.4/supress-assets-cf-search-button-for-catalogs-with-no-cfs has been created
        at  86cbc845a6f0d18b076a9c8f8da5f409bfdb2ed8 (commit)

- Log -----------------------------------------------------------------
commit 86cbc845a6f0d18b076a9c8f8da5f409bfdb2ed8
Author: Todd Wade <todd at bestpractical.com>
Date:   Fri Oct 30 14:50:16 2015 -0400

    Asset search with no CFs should not show two search boxes right next to eachother
    
    Do not display the custom fields search button if the catalog does not have
    any custom fields applied to it to show in on the search screen.
    
    fixes [issues#31322]

diff --git a/share/html/Asset/Elements/AssetSearchCFs b/share/html/Asset/Elements/AssetSearchCFs
index 8877df6..9649951 100644
--- a/share/html/Asset/Elements/AssetSearchCFs
+++ b/share/html/Asset/Elements/AssetSearchCFs
@@ -53,6 +53,7 @@
 % if ( $CFs->Count > 0 ){
 <table>
 %   while (my $cf = $CFs->Next) {
+%     $$has_assets_cfs = 1 if $has_assets_cfs;
 %     my $name = "CF.{" . $cf->Name . "}";
 %     my $value  = ref($ARGS{$name}) ? $ARGS{$name}[0] : $ARGS{$name} || '';
 %     my $negval = ref($ARGS{"!$name"}) ? $ARGS{"!$name"}[0] : $ARGS{"!$name"} || '';
@@ -69,4 +70,5 @@
 <%args>
 $Grouping
 $CatalogObj => undef
+$has_assets_cfs => undef
 </%args>
diff --git a/share/html/Asset/Search/index.html b/share/html/Asset/Search/index.html
index 4160f1b..80ada79 100644
--- a/share/html/Asset/Search/index.html
+++ b/share/html/Asset/Search/index.html
@@ -79,11 +79,16 @@ my $title = ( $ARGS{'SearchAssets'} or $ARGS{q} ) ?
 <& /Asset/Elements/AssetSearchPeople, %ARGS, CatalogObj => $catalog_obj &>
 <& /Elements/Submit, Label => loc('Search'), Name => 'SearchAssets' &>
 
+% my $has_assets_cfs = 0;
 % foreach my $group ( 'Dates', 'Links', RT::CustomField->CustomGroupings( "RT::Asset" ), '' ) {
     <& /Asset/Elements/AssetSearchCFs, %ARGS, Grouping => $group,
-       CatalogObj => $catalog_obj &>
+       CatalogObj => $catalog_obj, has_assets_cfs => \$has_assets_cfs &>
 % }
+
+% if ( $has_assets_cfs ) {
 <& /Elements/Submit, Label => loc('Search'), Name => 'SearchAssets' &>
+% }
+
 </&>
 
 <script>

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


More information about the rt-commit mailing list