aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/ResultSet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet')
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/AlertType.pm6
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm10
2 files changed, 8 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
index 468df2654..be1f6578b 100644
--- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
@@ -89,7 +89,7 @@ sub email_alerts ($) {
}
my $url = $cobrand->base_url( $row->{alert_cobrand_data} );
- if ( $hashref_restriction && $hashref_restriction->{council} && $row->{council} ne $hashref_restriction->{council} ) {
+ if ( $hashref_restriction && $hashref_restriction->{bodies_str} && $row->{bodies_str} ne $hashref_restriction->{bodies_str} ) {
$url = mySociety::Config::get('BASE_URL');
}
# this is currently only for new_updates
@@ -166,7 +166,7 @@ sub email_alerts ($) {
};
my $states = "'" . join( "', '", FixMyStreet::DB::Result::Problem::visible_states() ) . "'";
my %data = ( template => $template, data => '', alert_id => $alert->id, alert_email => $alert->user->email, lang => $alert->lang, cobrand => $alert->cobrand, cobrand_data => $alert->cobrand_data );
- my $q = "select problem.id, problem.council, problem.postcode, problem.geocode, problem.title from problem_find_nearby(?, ?, ?) as nearby, problem, users
+ my $q = "select problem.id, problem.bodies_str, problem.postcode, problem.geocode, problem.title from problem_find_nearby(?, ?, ?) as nearby, problem, users
where nearby.problem_id = problem.id
and problem.user_id = users.id
and problem.state in ($states)
@@ -183,7 +183,7 @@ sub email_alerts ($) {
parameter => $row->{id},
} );
my $url = $cobrand->base_url( $alert->cobrand_data );
- if ( $hashref_restriction && $hashref_restriction->{council} && $row->{council} ne $hashref_restriction->{council} ) {
+ if ( $hashref_restriction && $hashref_restriction->{bodies_str} && $row->{bodies_str} ne $hashref_restriction->{bodies_str} ) {
$url = mySociety::Config::get('BASE_URL');
}
$data{data} .= $url . "/report/" . $row->{id} . " - $row->{title}\n\n";
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index 4d8004024..16eca144d 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -228,7 +228,7 @@ sub send_reports {
my $unsent = FixMyStreet::App->model("DB::Problem")->search( {
state => [ 'confirmed', 'fixed' ],
whensent => undef,
- bodies => { '!=', undef },
+ bodies_str => { '!=', undef },
} );
my (%notgot, %note);
@@ -292,7 +292,7 @@ sub send_reports {
my ( $sender_count );
if ($site eq 'emptyhomes') {
- my $body = $row->bodies;
+ my $body = $row->bodies_str;
$body = FixMyStreet::App->model("DB::Body")->find($body);
my $sender = "FixMyStreet::SendReport::EmptyHomes";
$reporters{ $sender } = $sender->new() unless $reporters{$sender};
@@ -302,7 +302,7 @@ sub send_reports {
# XXX Needs locks!
# XXX Only copes with at most one missing body
- my ($bodies, $missing) = $row->bodies =~ /^([\d,]+)(?:\|(\d+))?/;
+ my ($bodies, $missing) = $row->bodies_str =~ /^([\d,]+)(?:\|(\d+))?/;
my @bodies = split(/,/, $bodies);
$bodies = FixMyStreet::App->model("DB::Body")->search({ id => \@bodies });
$missing = FixMyStreet::App->model("DB::Body")->find($missing);
@@ -362,7 +362,7 @@ sub send_reports {
if (mySociety::Config::get('STAGING_SITE')) {
# on a staging server send emails to ourselves rather than the bodies
my @testing_bodies = split( '\|', mySociety::Config::get('TESTING_COUNCILS') );
- unless ( grep { $row->bodies eq $_ } @testing_bodies ) {
+ unless ( grep { $row->bodies_str eq $_ } @testing_bodies ) {
%reporters = map { $_ => $reporters{$_} } grep { /FixMyStreet::SendReport::(Email|NI)/ } keys %reporters;
unless (%reporters) {
%reporters = ( 'FixMyStreet::SendReport::Email' => FixMyStreet::SendReport::Email->new() );
@@ -424,7 +424,7 @@ sub send_reports {
my $unsent = FixMyStreet::App->model("DB::Problem")->search( {
state => [ 'confirmed', 'fixed' ],
whensent => undef,
- bodies => { '!=', undef },
+ bodies_str => { '!=', undef },
send_fail_count => { '>', 0 }
} );
while (my $row = $unsent->next) {