aboutsummaryrefslogtreecommitdiffstats
path: root/bin/zurich
diff options
context:
space:
mode:
Diffstat (limited to 'bin/zurich')
-rwxr-xr-xbin/zurich/convert_internal_notes_to_comments8
-rwxr-xr-xbin/zurich/overdue-alert11
2 files changed, 9 insertions, 10 deletions
diff --git a/bin/zurich/convert_internal_notes_to_comments b/bin/zurich/convert_internal_notes_to_comments
index ddf74851f..76db0a45b 100755
--- a/bin/zurich/convert_internal_notes_to_comments
+++ b/bin/zurich/convert_internal_notes_to_comments
@@ -17,15 +17,13 @@ the superuser, or one created just for this purpose?
use strict;
use warnings;
-use FixMyStreet::App;
+use FixMyStreet::DB;
# Because it is not possible to determine the user that last edited the
# internal_notes we need require a user to assign all the comments to.
my $comment_user_id = $ARGV[0]
|| die "Usage: $0 id_of_user_for_comments";
-my $comment_user = FixMyStreet::App #
- ->model('DB::User') #
- ->find($comment_user_id)
+my $comment_user = FixMyStreet::DB->resultset('User')->find($comment_user_id)
|| die "Could not find user with id '$comment_user_id'";
# We use now as the time for the internal note. This is not the time it was
@@ -39,7 +37,7 @@ my $comment_state = 'hidden';
# Load all the comments, more reliable than trying to search on the contents of
# the extra field.
-my $problems = FixMyStreet::App->model('DB::Problem')->search();
+my $problems = FixMyStreet::DB->resultset('Problem')->search();
while ( my $problem = $problems->next() ) {
diff --git a/bin/zurich/overdue-alert b/bin/zurich/overdue-alert
index 03845dddb..0473208c5 100755
--- a/bin/zurich/overdue-alert
+++ b/bin/zurich/overdue-alert
@@ -19,7 +19,8 @@ BEGIN {
use DateTime;
use CronFns;
-use FixMyStreet::App;
+use FixMyStreet::Cobrand;
+use FixMyStreet::DB;
use FixMyStreet::Email;
my ($verbose, $nomail) = CronFns::options();
@@ -29,7 +30,7 @@ my $now = DateTime->now();
exit if FixMyStreet::Cobrand::Zurich::is_public_holiday($now) or FixMyStreet::Cobrand::Zurich::is_weekend($now);
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('zurich')->new();
-my %bodies = map { $_->id => $_ } FixMyStreet::App->model("DB::Body")->all;
+my %bodies = map { $_->id => $_ } FixMyStreet::DB->resultset("Body")->all;
loop_through( 'alert-moderation-overdue.txt', 0, 1, [ 'unconfirmed' ] );
loop_through( 'alert-overdue.txt', 1, 6, 'in progress' );
@@ -37,10 +38,10 @@ loop_through( 'alert-overdue.txt', 0, 6, ['confirmed', 'planned'] );
sub loop_through {
my ( $template, $include_parent, $days, $states ) = @_;
- my $dtf = FixMyStreet::App->model("DB")->storage->datetime_parser;
+ my $dtf = FixMyStreet::DB->storage->datetime_parser;
my $date_threshold = $dtf->format_datetime(FixMyStreet::Cobrand::Zurich::sub_days( $now, $days ));
- my $reports = FixMyStreet::App->model("DB::Problem")->search( {
+ my $reports = FixMyStreet::DB->resultset("Problem")->search( {
state => $states,
created => { '<', $date_threshold },
bodies_str => { '!=', undef },
@@ -78,7 +79,7 @@ sub send_alert {
}
FixMyStreet::Email::send_cron(
- $schema,
+ FixMyStreet::DB->storage->schema,
{
_template_ => $template,
_parameters_ => $h,