aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAndy Lulham <a.lulham@gmail.com>2013-11-20 22:03:08 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2014-03-12 19:55:54 +0000
commit945607838d931f918c1cccb2a3840b85121f3de4 (patch)
tree34914bdf1055a29b5ab87a7a548446ba8539d550 /bin
parentd2ebd056a2bd0484959d47b763dc6918b5b35015 (diff)
Set report->send_questionnaire on report creation
Include a one-off script that sets send_questionnaire to 0 for all available cobrands that have send_questionnaires set to 0.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update-send-questionnaire29
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/update-send-questionnaire b/bin/update-send-questionnaire
new file mode 100755
index 000000000..7a231b919
--- /dev/null
+++ b/bin/update-send-questionnaire
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+
+=head1 DESCRIPTION
+
+Ad hoc script to update the send_questionnaire column on the
+reports in cobrands that don't send questionnaires at all.
+
+=cut
+
+use strict;
+use warnings;
+
+use FixMyStreet::App;
+
+my @cobrands;
+foreach my $cobrand ( FixMyStreet::Cobrand->available_cobrand_classes() ) {
+ next unless $cobrand->{class};
+ my $cls = $cobrand->{class}->new();
+ push @cobrands, $cls->moniker if !$cls->send_questionnaires();
+}
+
+my $problems = FixMyStreet::App->model('DB::Problem')->search({
+ cobrand => \@cobrands,
+ send_questionnaire => 1,
+});
+
+$problems->update( {
+ send_questionnaire => 0
+});