diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 27 | ||||
-rw-r--r-- | templates/web/default/js/validation_strings.html | 20 |
2 files changed, 24 insertions, 23 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 55372afb5..198acade6 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -485,7 +485,7 @@ sub search_reports : Path('search_reports') { ]; } elsif ($search =~ /^area:(\d+)$/) { $query = [ - 'me.areas' => { like => ",$1," } + 'me.areas' => { like => "%,$1,%" } ]; } else { $query = [ @@ -540,19 +540,20 @@ sub search_reports : Path('search_reports') { %{ $site_restriction }, ]; } - my $updates; - $updates = $c->model('DB::Comment')->search( - { - -or => $query, - }, - { - -select => [ 'me.*', qw/problem.council problem.state/ ], - prefetch => [qw/user problem/], - order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created'] - } - ) if @$query; - $c->stash->{updates} = [ $updates->all ]; + if (@$query) { + my $updates = $c->model('DB::Comment')->search( + { + -or => $query, + }, + { + -select => [ 'me.*', qw/problem.council problem.state/ ], + prefetch => [qw/user problem/], + order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created'] + } + ); + $c->stash->{updates} = [ $updates->all ]; + } # Switch quoting back off. See above for explanation of this. $c->model('DB')->schema->storage->sql_maker->quote_char( '' ); diff --git a/templates/web/default/js/validation_strings.html b/templates/web/default/js/validation_strings.html index 70a0ed41c..718d10d56 100644 --- a/templates/web/default/js/validation_strings.html +++ b/templates/web/default/js/validation_strings.html @@ -1,18 +1,18 @@ validation_strings = { - update: '[% loc('Please enter a message') %]', - title: '[% loc('Please enter a subject') %]', - detail: '[% loc('Please enter some details') %]', + update: '[% loc('Please enter a message') | replace("'", "\\'") %]', + title: '[% loc('Please enter a subject') | replace("'", "\\'") %]', + detail: '[% loc('Please enter some details') | replace("'", "\\'") %]', name: { - required: '[% loc('Please enter your name') %]', - validName: '[% loc('Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below') %]' + required: '[% loc('Please enter your name') | replace("'", "\\'") %]', + validName: '[% loc('Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below') | replace("'", "\\'") %]' }, - category: '[% loc('Please choose a category') %]', + category: '[% loc('Please choose a category') | replace("'", "\\'") %]', rznvy: { - required: '[% loc('Please enter your email') %]', - email: '[% loc('Please enter a valid email') %]' + required: '[% loc('Please enter your email') | replace("'", "\\'") %]', + email: '[% loc('Please enter a valid email') | replace("'", "\\'") %]' }, email: { - required: '[% loc('Please enter your email') %]', - email: '[% loc('Please enter a valid email') %]' + required: '[% loc('Please enter your email') | replace("'", "\\'") %]', + email: '[% loc('Please enter a valid email') | replace("'", "\\'") %]' } }; |