aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Open311.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2015-07-06 17:35:35 +0100
committerMatthew Somerville <matthew@mysociety.org>2015-07-07 14:13:18 +0100
commita978c0a1ad216f7004ef88b8a58b9731242155dc (patch)
tree58ec3daece503b314bb1dfe54ab2d0c0e80cb24e /perllib/FixMyStreet/App/Controller/Open311.pm
parentbeb7e1f345ace940c542d93768ec44bfd6f5dc21 (diff)
Factor out all uses of param()/params.
Use a central get_param and get_param_list functions dependent on whether we're after a scalar or a list (almost always a scalar). This prevents any possibility of confusion where param() could return a list, or params->{} an arrayref.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Open311.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Open311.pm24
1 files changed, 12 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm
index 64b21db6b..96066ca93 100644
--- a/perllib/FixMyStreet/App/Controller/Open311.pm
+++ b/perllib/FixMyStreet/App/Controller/Open311.pm
@@ -155,9 +155,9 @@ sub get_discovery : Private {
sub get_services : Private {
my ( $self, $c ) = @_;
- my $jurisdiction_id = $c->req->param('jurisdiction_id') || '';
- my $lat = $c->req->param('lat') || '';
- my $lon = $c->req->param('long') || '';
+ my $jurisdiction_id = $c->get_param('jurisdiction_id') || '';
+ my $lat = $c->get_param('lat') || '';
+ my $lon = $c->get_param('long') || '';
# Look up categories for this council or councils
my $categories = $c->model('DB::Contact')->not_deleted;
@@ -309,7 +309,7 @@ sub get_requests : Private {
$c->forward( 'is_jurisdiction_id_ok' );
- my $max_requests = $c->req->param('max_requests') || 0;
+ my $max_requests = $c->get_param('max_requests') || 0;
# Only provide access to the published reports
my $states = FixMyStreet::DB::Result::Problem->visible_states();
@@ -327,7 +327,7 @@ sub get_requests : Private {
has_photo => [ '=', 'photo' ],
);
for my $param (keys %rules) {
- my $value = $c->req->param($param);
+ my $value = $c->get_param($param);
next unless $value;
my $op = $rules{$param}[0];
my $key = $rules{$param}[1];
@@ -366,12 +366,12 @@ sub get_requests : Private {
$criteria->{$key} = { $op, $value };
}
- if ( $c->req->param('start_date') and $c->req->param('end_date') ) {
- $criteria->{confirmed} = [ '-and' => { '>=', $c->req->param('start_date') }, { '<', $c->req->param('end_date') } ];
- } elsif ( $c->req->param('start_date') ) {
- $criteria->{confirmed} = { '>=', $c->req->param('start_date') };
- } elsif ( $c->req->param('end_date') ) {
- $criteria->{confirmed} = { '<', $c->req->param('end_date') };
+ if ( $c->get_param('start_date') and $c->get_param('end_date') ) {
+ $criteria->{confirmed} = [ '-and' => { '>=', $c->get_param('start_date') }, { '<', $c->get_param('end_date') } ];
+ } elsif ( $c->get_param('start_date') ) {
+ $criteria->{confirmed} = { '>=', $c->get_param('start_date') };
+ } elsif ( $c->get_param('end_date') ) {
+ $criteria->{confirmed} = { '<', $c->get_param('end_date') };
}
if ('rss' eq $c->stash->{format}) {
@@ -441,7 +441,7 @@ sub format_output : Private {
sub is_jurisdiction_id_ok : Private {
my ( $self, $c ) = @_;
- unless (my $jurisdiction_id = $c->req->param('jurisdiction_id')) {
+ unless (my $jurisdiction_id = $c->get_param('jurisdiction_id')) {
$c->detach( 'error', [ _('Missing jurisdiction_id') ] );
}
}