[Rt-commit] rt branch, 4.0/warn-about-SetFieldsOnce, created. rt-4.0.19-47-g27af6e6

Kevin Falcone falcone at bestpractical.com
Fri Mar 7 16:17:23 EST 2014


The branch, 4.0/warn-about-SetFieldsOnce has been created
        at  27af6e61bdf2b9a0b296ae959adf90bcd32b3d4d (commit)

- Log -----------------------------------------------------------------
commit 27af6e61bdf2b9a0b296ae959adf90bcd32b3d4d
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Mar 7 16:12:44 2014 -0500

    Warn about SetFieldsOnce
    
    This callback was added in d77874ed to allow you to munge the %once
    declared @fields variable.  If you used Default, you would keep
    appending to the global shared variable.  When c07d62ad fixed the bug
    that we were pushing Custom Fields onto the global shared variable by
    switching from a %once to an %init, this callback became useless because
    @fields was redeclared on every request.
    
    The first commit was in 3.7.15, the second was in 3.7.86.  This means no
    released version of RT has had a version of this callback which worked
    properly.  We will remove it in 4.4 and add some dev notes here.
    
    The correct solution is to use the Default callback.
    
    CallbackOnce is still used properly with %once blocks in ColumnMap.

diff --git a/share/html/Search/Elements/BuildFormatString b/share/html/Search/Elements/BuildFormatString
index d944cd8..4981889 100644
--- a/share/html/Search/Elements/BuildFormatString
+++ b/share/html/Search/Elements/BuildFormatString
@@ -99,6 +99,8 @@ my @fields = qw(
     NBSP
 ); # loc_qw
 
+# This callback will only run once and will be removed in 4.4
+# If you want to add a new item to @fields, use the Default callback below.
 $m->callback( CallbackOnce => 1, CallbackName => 'SetFieldsOnce', Fields => \@fields );
 
 my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'});

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


More information about the rt-commit mailing list