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

Alex Vandiver alexmv at bestpractical.com
Thu Oct 2 18:19:37 EDT 2014


The branch, global-custom-fields has been created
        at  5d80670ecd398b35eec6a04b635df595d55cb98b (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 dba8b481c111cf257cf872489874d74d1f68d2c1
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Sep 30 12:44:08 2014 -0400

    Include global cfs in the TSV, as well as Basics and People boxes
    
    In all these locations, 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/Elements/AssetSearchBasics b/html/Asset/Elements/AssetSearchBasics
index b9d8e09..ec1742b 100644
--- a/html/Asset/Elements/AssetSearchBasics
+++ b/html/Asset/Elements/AssetSearchBasics
@@ -67,6 +67,7 @@
     <td class="value"><input type="text" id="!Description" name="!Description" value="<% $ARGS{"!Description"} || ''%>" /></td></tr>
 % my $CFs = RT::CustomFields->new( $session{CurrentUser} );
 % $CFs->LimitToCatalog( $CatalogObj->Id );
+% $CFs->LimitToObjectId(0); # LimitToGlobal but no LookupType restriction
 % $CFs->LimitToGrouping( "RT::Asset" => "Basics" );
 % while (my $cf = $CFs->Next) {
 % my $name = "CF.{" . $cf->Name . "}";
diff --git a/html/Asset/Elements/AssetSearchPeople b/html/Asset/Elements/AssetSearchPeople
index f0dcf92..ef4d480 100644
--- a/html/Asset/Elements/AssetSearchPeople
+++ b/html/Asset/Elements/AssetSearchPeople
@@ -63,6 +63,7 @@
 % }
 % my $CFs = RT::CustomFields->new( $session{CurrentUser} );
 % $CFs->LimitToCatalog( $CatalogObj->Id );
+% $CFs->LimitToObjectId(0); # LimitToGlobal but no LookupType restriction
 % $CFs->LimitToGrouping( "RT::Asset" => "People" );
 % while (my $cf = $CFs->Next) {
 % my $name = "CF.{" . $cf->Name . "}";
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 );

commit 5d80670ecd398b35eec6a04b635df595d55cb98b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Oct 2 17:52:40 2014 -0400

    Update documentation which misleads about LimitToGlobal

diff --git a/README b/README
index f649efe..45c99b4 100644
--- a/README
+++ b/README
@@ -274,7 +274,8 @@ METHODS ADDED TO OTHER CLASSES
    LimitToCatalog
     Takes a numeric RT::Catalog ID. Limits the RT::CustomFields collection
     to only those fields applied directly to the specified catalog. This
-    limit is OR'd with other "LimitToCatalog" and "LimitToGlobal" calls.
+    limit is OR'd with other "LimitToCatalog" and "LimitToObjectId" in
+    RT::CustomFields calls.
 
     Note that this will cause the collection to only return asset CFs.
 
diff --git a/lib/RT/Extension/Assets.pm b/lib/RT/Extension/Assets.pm
index b38ba80..f17818f 100644
--- a/lib/RT/Extension/Assets.pm
+++ b/lib/RT/Extension/Assets.pm
@@ -683,7 +683,8 @@ matching the same criteria are found.  Enabled CFs are preferentially loaded.
 
 Takes a numeric L<RT::Catalog> ID.  Limits the L<RT::CustomFields> collection
 to only those fields applied directly to the specified catalog.  This limit is
-OR'd with other L</LimitToCatalog> and C<LimitToGlobal> calls.
+OR'd with other L</LimitToCatalog> and L<RT::CustomFields/LimitToObjectId>
+calls.
 
 Note that this will cause the collection to only return asset CFs.
 

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


More information about the Bps-public-commit mailing list