TT#155600 use trailing wildcard in datatable search

Change-Id: I7b8fe1240b12f66363e7a9f15dec36d7fa860a3b
mr11.0
Rene Krenn 4 years ago
parent 43d41c0fdf
commit e1f48f0fba

@ -94,9 +94,9 @@ sub sub_list :Chained('/') :PathPart('subscriber') :CaptureArgs(0) {
{ name => "id", int_search => 1, title => $c->loc('#') },
{ name => "contract_id", int_search => 1, title => $c->loc('Contract #') },
{ name => "contract.contact.email", search => 0, title => $c->loc('Contact Email') },
{ name => "username", strict_search => 1, title => $c->loc('Username') },
{ name => "username", strict_search => 0, title => $c->loc('Username') },
{ name => "domain.domain", search => 0, title => $c->loc('Domain') },
{ name => "uuid", strict_search => 1, title => $c->loc('UUID') },
{ name => "uuid", strict_search => 0, title => $c->loc('UUID') },
{ name => "status", search => 0, title => $c->loc('Status') },
{ name => "number", search => 0, title => $c->loc('Number'), literal_sql => "concat(primary_number.cc, primary_number.ac, primary_number.sn)" },
#{ name => "provisioning_voip_subscriber.voip_dbaliases.username", search => 1, 'no_column' => 1 },

@ -238,9 +238,10 @@ sub _resolve_joins {
sub get_search_string_pattern {
my $c = shift;
my ($c,$no_pattern) = @_;
my $searchString = $c->request->params->{sSearch} // "";
my $is_pattern = 0;
return ($searchString,$is_pattern) if $no_pattern;
my $searchString_escaped = join('',map {
my $token = $_;
if ($token ne '\\\\') {
@ -253,6 +254,10 @@ sub get_search_string_pattern {
}
$token;
} split(/(\\\\)/,$searchString,-1));
if (not $is_pattern and not $no_pattern) {
$searchString_escaped .= '%';
$is_pattern = 1;
}
return ($searchString_escaped,$is_pattern);
}
@ -272,7 +277,9 @@ sub _apply_search_filters {
# avoid amigious column names if we have the same column in different joined tables
if($col->{search} or $col->{strict_search} or $col->{int_search}){
my $is_pattern = 0;
(my $searchString_escaped, $is_pattern) = get_search_string_pattern($c);
(my $searchString_escaped, $is_pattern) = get_search_string_pattern($c,(
$col->{strict_search} || $col->{int_search}
));
if ($is_pattern) {
$op = 'like';
$search_value = $searchString_escaped;

Loading…
Cancel
Save