aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/SendReport
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2015-09-25 22:35:39 +0100
committerMatthew Somerville <matthew@mysociety.org>2015-12-02 17:41:35 +0000
commit55412b79394ff1b1cabe368aed67fa8f68680ecc (patch)
tree33657093517818b8ba60f156484ec540f9c4af17 /perllib/FixMyStreet/SendReport
parent0c2a792b154e1b28528db887bbde80b19268b9fe (diff)
Reduce use of FixMyStreet::App.
Command line scripts don't need a full blown app, just database.
Diffstat (limited to 'perllib/FixMyStreet/SendReport')
-rw-r--r--perllib/FixMyStreet/SendReport/Email.pm6
-rw-r--r--perllib/FixMyStreet/SendReport/EmptyHomes.pm2
-rw-r--r--perllib/FixMyStreet/SendReport/Open311.pm3
-rw-r--r--perllib/FixMyStreet/SendReport/Zurich.pm6
4 files changed, 7 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm
index 95c460006..bc526ded2 100644
--- a/perllib/FixMyStreet/SendReport/Email.pm
+++ b/perllib/FixMyStreet/SendReport/Email.pm
@@ -11,7 +11,7 @@ sub build_recipient_list {
my $all_confirmed = 1;
foreach my $body ( @{ $self->bodies } ) {
- my $contact = FixMyStreet::App->model("DB::Contact")->find( {
+ my $contact = $row->result_source->schema->resultset("Contact")->find( {
deleted => 0,
body_id => $body->id,
category => $row->category
@@ -94,9 +94,7 @@ sub send {
From => $self->send_from( $row ),
};
- my $app = FixMyStreet::App->new( cobrand => $cobrand );
-
- $cobrand->munge_sendreport_params($app, $row, $h, $params) if $cobrand->can('munge_sendreport_params');
+ $cobrand->munge_sendreport_params($row, $h, $params) if $cobrand->can('munge_sendreport_params');
$params->{Bcc} = $self->bcc if @{$self->bcc};
diff --git a/perllib/FixMyStreet/SendReport/EmptyHomes.pm b/perllib/FixMyStreet/SendReport/EmptyHomes.pm
index ce69aaac3..bf7164e21 100644
--- a/perllib/FixMyStreet/SendReport/EmptyHomes.pm
+++ b/perllib/FixMyStreet/SendReport/EmptyHomes.pm
@@ -12,7 +12,7 @@ sub build_recipient_list {
my $all_confirmed = 1;
foreach my $body ( @{ $self->bodies } ) {
- my $contact = FixMyStreet::App->model("DB::Contact")->find( {
+ my $contact = $row->result_source->schema->resultset("Contact")->find( {
deleted => 0,
body_id => $body->id,
category => 'Empty property',
diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm
index fa216466e..14dd65fa6 100644
--- a/perllib/FixMyStreet/SendReport/Open311.pm
+++ b/perllib/FixMyStreet/SendReport/Open311.pm
@@ -5,7 +5,6 @@ use namespace::autoclean;
BEGIN { extends 'FixMyStreet::SendReport'; }
-use FixMyStreet::App;
use mySociety::Config;
use DateTime::Format::W3CDTF;
use Open311;
@@ -85,7 +84,7 @@ sub send {
}
# FIXME: we've already looked this up before
- my $contact = FixMyStreet::App->model("DB::Contact")->find( {
+ my $contact = $row->result_source->schema->resultset("Contact")->find( {
deleted => 0,
body_id => $body->id,
category => $row->category
diff --git a/perllib/FixMyStreet/SendReport/Zurich.pm b/perllib/FixMyStreet/SendReport/Zurich.pm
index 2838440cb..7af4cf4f5 100644
--- a/perllib/FixMyStreet/SendReport/Zurich.pm
+++ b/perllib/FixMyStreet/SendReport/Zurich.pm
@@ -14,7 +14,7 @@ sub build_recipient_list {
# Wunsch set, but external_message hasn't yet been filled in. TODO should
# we instead be holding off sending?)
if ( $row->external_body ) {
- $body = FixMyStreet::App->model("DB::Body")->find( { id => $row->external_body } );
+ $body = $row->result_source->schema->resultset("Body")->find( { id => $row->external_body } );
$h->{bodies_name} = $body->name;
$h->{external_message} = $row->get_extra_metadata('external_message') || '';
}
@@ -29,7 +29,7 @@ sub build_recipient_list {
my $parent = $body->parent;
if ($parent && !$parent->parent) {
# Division, might have an individual contact email address
- my $contact = FixMyStreet::App->model("DB::Contact")->find( {
+ my $contact = $row->result_source->schema->resultset("Contact")->find( {
body_id => $body->id,
category => $row->category
} );
@@ -72,7 +72,7 @@ sub send_from {
if ( $row->external_body ) {
my $body = @{ $self->bodies }[0];
my $body_email = $body->endpoint;
- my $contact = FixMyStreet::App->model("DB::Contact")->find( {
+ my $contact = $body->result_source->schema->resultset("Contact")->find( {
body_id => $body->id,
category => $row->category
} );