[Bps-public-commit] rt-extension-assets branch, global-custom-fields, created. 1.01_1-2-g14ca4fb

Kevin Falcone falcone at bestpractical.com
Tue Sep 30 12:46:12 EDT 2014


The branch, global-custom-fields has been created
        at  14ca4fb909a866f1dfd67b75fdd48e235de096e1 (commit)

- Log -----------------------------------------------------------------
commit 731b90d2cd7dce0a3507b31f030e56c74dd880d9
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Sep 30 12:34:43 2014 -0400

    LimitToGlobal brings in Ticket CFs
    
    From the LimitToGlobal docs
    
        Note that this will cause the collection to only return ticket CFs.
    
    That isn't really true, since LimitToLookupType('RT::Queue-RT::Ticket');
    gets ORed together with LimitToLookupType(RT::Asset->CustomFieldLookupType );
    in LimitToCatalog, so you got global Asset and global Ticket CFs on your
    assets search.
    
    We force a limit to Object 0 which is global.  Core LimitToGlobal should
    probably stop specifying a LookupType.

diff --git a/html/Asset/Elements/AssetSearchCFs b/html/Asset/Elements/AssetSearchCFs
index 88451c0..fe1d17e 100644
--- a/html/Asset/Elements/AssetSearchCFs
+++ b/html/Asset/Elements/AssetSearchCFs
@@ -48,7 +48,7 @@
 <&| /Widgets/TitleBox, title => $Grouping ? loc($Grouping) : loc('Custom Fields'), hide_empty => 1, class=>'asset-search-grouping asset-search-cfs'  &>
 % my $CFs = RT::CustomFields->new( $session{CurrentUser} );
 % $CFs->LimitToCatalog( $CatalogObj->Id );
-% $CFs->LimitToGlobal();
+% $CFs->LimitToObjectId(0); # LimitToGlobal but no LookupType restriction
 % $CFs->LimitToGrouping( "RT::Asset" => $Grouping );
 % if ( $CFs->Count > 0 ){
 <table>

commit 14ca4fb909a866f1dfd67b75fdd48e235de096e1
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Sep 30 12:44:08 2014 -0400

    Include global cfs in the TSV
    
    We were only getting CFs applied to this catalog
    Use the same fix from 731b90d2 to also include global Assets CFs.
    
    Fixes issues #30249

diff --git a/html/Asset/Search/Results.tsv b/html/Asset/Search/Results.tsv
index 4451f69..41248b6 100644
--- a/html/Asset/Search/Results.tsv
+++ b/html/Asset/Search/Results.tsv
@@ -60,6 +60,7 @@ $Format .= "$_, " for RT::Asset->Roles;
 
 my $CFs = RT::CustomFields->new( $session{CurrentUser} );
 $CFs->LimitToCatalog( $catalog_obj->Id );
+$CFs->LimitToObjectId( 0 ); # LimitToGlobal but no LookupType restriction
 $Format .= "'__CF.{$_}__/TITLE:$_', " for map {$_ = $_->Name; s/['\\]/\\$1/g; $_} @{$CFs->ItemsArrayRef};
 
 $m->callback(CallbackName => "ModifyFormat", Format => \$Format );

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


More information about the Bps-public-commit mailing list