Hi,
I updated to 4.2.6 (from 3.8.8) in our lab - look fine. Now, I’m going to add some small customizations.
E.g. the simple Search (the search field in the web-ui on the top right) should also search for a custom field.
Therefore, I added an overlay /opt/rt4/local/lib/RT/Search/Simple_Local.pm with the content (1) - but it does not work.
It the file is parsed from RT, but the methods are not be called.
Is there something I missed ?
regards
Danny
(1) /opt/rt4/local/lib/RT/Search/Simple_Local.pm
$_[0] is $self
$_[1] is escaped value without surrounding single quotes
$_[2] is a boolean of “was quoted by the user?”
ensure this is false before you do smart matching like $_[1] eq “me”
$_[3] is escaped subkey, if any (see HandleCf)
sub HandleDefault {
$RT::Logger->debug(“dts-HandleDefault”);
my $fts = RT->Config->Get(‘FullTextSearch’);
if ($fts->{Enable} and $fts->{Indexed}) {
return default => “(Subject LIKE ‘$[1]’ OR Content LIKE '$[1]’ OR ‘CF.{CF-Customer}’ LIKE ‘$[1]’)";
} else {
return default => "(Subject LIKE '$[1]’ OR ‘CF.{CF-Customer}’ LIKE ‘$_[1]’ )”;
}
}
sub HandleSubject {
$RT::Logger->debug(“dts-HandleSubject”);
return subject => “(Subject LIKE ‘$[1]’ OR ‘CF.{CF-Customer}’ LIKE '$[1]’)”;
}
1;
smime.p7s (2.23 KB)
Hi,
add on top of the file this lines:
package RT::Search::Simple;
use strict;
use warnings;
no warnings ‘redefine’;
ChrisAm 15.01.2015 um 16:14 schrieb Daniel Schwager:
Hi,
I updated to 4.2.6 (from 3.8.8) in our lab - look fine. Now, I’m going to add some small customizations.
E.g. the simple Search (the search field in the web-ui on the top right) should also search for a custom field.
Therefore, I added an overlay /opt/rt4/local/lib/RT/Search/Simple_Local.pm with the content (1) - but it does not work.
It the file is parsed from RT, but the methods are not be called.
Is there something I missed ?
regards
Danny
(1) /opt/rt4/local/lib/RT/Search/Simple_Local.pm
$_[0] is $self
$_[1] is escaped value without surrounding single quotes
$_[2] is a boolean of “was quoted by the user?”
ensure this is false before you do smart matching like $_[1] eq “me”
$_[3] is escaped subkey, if any (see HandleCf)
sub HandleDefault {
$RT::Logger->debug(“dts-HandleDefault”);
my $fts = RT->Config->Get(‘FullTextSearch’);
if ($fts->{Enable} and $fts->{Indexed}) {
return default => “(Subject LIKE ‘$[1]’ OR Content LIKE '$[1]’ OR ‘CF.{CF-Customer}’ LIKE ‘$[1]')";
} else {
return default => "(Subject LIKE '$[1]’ OR ‘CF.{CF-Customer}’ LIKE ‘$_[1]’ )”;
}
}
sub HandleSubject {
$RT::Logger->debug(“dts-HandleSubject”);
return subject => “(Subject LIKE ‘$[1]’ OR ‘CF.{CF-Customer}’ LIKE '$[1]’)”;
}
1;
Chris, thank you very much! Now, it work’s like a charm!
Best regards
Danny
smime.p7s (2.23 KB)