[rt-users] Custom Fields won't show up when viewing RT through MediaWiki

Scott Pestana scott.pestana at linguamatics.com
Fri May 11 16:47:59 EDT 2012


Ruslan,
     I was really confused by that too at first.  The code on that page 
must have been from a different version, the current code (which I 
verified we are using) goes like this:

  224                 // Allow use of custom fields
  225                 $searchcustom = '';
  226                 if ( array_key_exists('custom', $args ) ) {
  227                         $searchcustom = trim( $args['custom'] );
  228                         $cfargs = trim( strtolower( 
$args['custom'] ) );
  229                         $ticketquery .= ', customfields cf, 
objectcustomfieldvalues ov';
  230                         $whereclause .= "\nAND ov.objectid = 
t.id\nAND ov.customfield=cf.id\nAND ov.disabled = 0";
  231                         $whereclause .= "\nAND LOWER(cf.name) IN (";
  232                         foreach ( preg_split( '/\s*,\s*/', $cfargs 
) as $word ) {
  233                                 $word = trim( $word );
  234                                 if ( !preg_match( '/^[\w \.-]+$/', 
$word ) ) {
  235                                         die ( wfMsg ( 
'rt-badcfield', $word ) );
  236                                 }
  237                                 $whereclause .= "'$word',";
  238                                 $ticketquery = preg_replace( 
'/COALESCE/', "\nov.content AS custom, COALESCE", $ticketquery);
  239                         }
  240                         $whereclause = preg_replace( '/.$/', ')', 
$whereclause );
  241                 }

     This is in RT_body.php, can be found here:

https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/RT.git;a=tree

-Scott

On 5/11/2012 4:38 PM, Ruslan Zakirov wrote:
> On Fri, May 11, 2012 at 10:44 PM, Scott Pestana
> <scott.pestana at linguamatics.com>  wrote:
>> All,
>>     We're using MediaWiki + RT to allow us to track issues currently open,
>> issues attributed to a customer's company, that kind of thing.  However we
>> aren't able to get Custom Fields to be displayed when we use them:
>>
>> <rt custom=Customer></rt>
>>
>>     We have only 4 Custom Fields, but none of them are displayed when we try
>> to pull them out.  Is anyone else having this experience?  For information,
>> we are using the "replace Postgres with MySQL" hack from this page:
>>
>> http://www.mediawiki.org/wiki/Extension_talk:RT
>>
>>     I'm wondering if the MySQL alternative doesn't have the same way of
>> pulling the Custom Fields out the same way Postgres does.  Thoughts?
> As far as I can see code on the linked page has no any kind of support
> of custom fields. Code linked from the primary page does mention
> custom fields, but it's not to display them, but to filter by them.
>
>> --
>> N. Scott Pestana
>> IT Infrastructure
>> Linguamatics

-- 
N. Scott Pestana
IT Infrastructure
Linguamatics




More information about the rt-users mailing list