Merge pull request #19 from Pear-Trading/TBSliver/Search-Fixes

Fix issue with turning quote_names on with case insensitive search
This commit is contained in:
Tom Bloor 2017-07-25 14:15:10 +01:00 committed by GitHub
commit e32363b41a
2 changed files with 5 additions and 2 deletions

View file

@ -14,6 +14,7 @@ has schema => sub {
$c->app->config->{dsn},
$c->app->config->{user},
$c->app->config->{pass},
{ quote_names => 1 },
);
};

View file

@ -172,12 +172,14 @@ sub post_search {
my $search_name = $validation->param('search_name');
my $search_stmt = [ 'LOWER("name") LIKE ?', '%' . lc $search_name . '%' ];
my $valid_orgs_rs = $c->schema->resultset('Organisation')->search(
{ 'LOWER(name)' => { -like => '%' . lc $search_name . '%' } },
\$search_stmt,
);
my $pending_orgs_rs = $c->stash->{api_user}->pending_organisations->search(
{ 'LOWER(name)' => { -like => '%' . lc $search_name . '%' } },
\$search_stmt,
);
my @valid_orgs = (