aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-05-16 15:47:42 +0100
committerMatthew Somerville <matthew@mysociety.org>2012-05-16 15:47:42 +0100
commit23aa50cd6e1fb77de2d1e3ae8d29a8f8408a7930 (patch)
tree511442f4c72e6d0968171631a0f0305893ac0a53 /perllib
parenta48756f51e0199bf09ce7cbd66c2fcd80acb05ad (diff)
Fixes and improvements for tests.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm10
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm6
2 files changed, 9 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index bbfa8170f..998cb83a8 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -340,7 +340,7 @@ sub update_contacts : Private {
} elsif ( $posted eq 'open311' ) {
$c->forward('check_token');
- my %params = map { $_ => $c->req->param($_) } qw/open311_id endpoint jurisdiction api_key area_id send_method send_comments suppress_alerts comment_user_id/;
+ my %params = map { $_ => $c->req->param($_) || '' } qw/open311_id endpoint jurisdiction api_key area_id send_method send_comments suppress_alerts comment_user_id/;
if ( $params{open311_id} ) {
my $conf = $c->model('DB::Open311Conf')->find( { id => $params{open311_id} } );
@@ -349,8 +349,8 @@ sub update_contacts : Private {
$conf->jurisdiction( $params{jurisdiction} );
$conf->api_key( $params{api_key} );
$conf->send_method( $params{send_method} );
- $conf->send_comments( $params{send_comments} );
- $conf->suppress_alerts( $params{suppress_alerts} );
+ $conf->send_comments( $params{send_comments} || 0);
+ $conf->suppress_alerts( $params{suppress_alerts} || 0);
$conf->comment_user_id( $params{comment_user_id} || undef );
$conf->update();
@@ -363,8 +363,8 @@ sub update_contacts : Private {
$conf->jurisdiction( $params{jurisdiction} );
$conf->api_key( $params{api_key} );
$conf->send_method( $params{send_method} );
- $conf->send_comments( $params{send_comments} );
- $conf->suppress_alerts( $params{suppress_alerts} );
+ $conf->send_comments( $params{send_comments} || 0);
+ $conf->suppress_alerts( $params{suppress_alerts} || 0);
$conf->comment_user_id( $params{comment_user_id} || undef );
$conf->insert();
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index 8be513b08..7542fbe96 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -105,8 +105,10 @@ sub process_user : Private {
my $name = scalar $c->req->param('name');
$user->name( Utils::trim_text( $name ) ) if $name;
my $title = scalar $c->req->param('fms_extra_title');
- $c->log->debug( 'user exists and title is ' . $title );
- $user->title( Utils::trim_text( $title ) ) if $title;
+ if ( $title ) {
+ $c->log->debug( 'user exists and title is ' . $title );
+ $user->title( Utils::trim_text( $title ) );
+ }
$update->user( $user );
return 1;
}