aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2019-03-27 14:21:55 +0000
committerStruan Donald <struan@exo.org.uk>2019-03-27 15:18:56 +0000
commitcd8a570266a09a2d5bff072a757585fa9563df25 (patch)
tree0f66da1ff74b22f3d4e17ed1c905bc42c710bcfc /perllib
parentd5e9f16bbb90e0cac154371d098c3124fc843c97 (diff)
make sure the archive report script sets up lang etc
Previously if no reports were closed with an email this meant that the lang setup never ran and you got an error when _ was called in close_problems. So, we call the lang setup in close_problems too.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/Script/ArchiveOldEnquiries.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Script/ArchiveOldEnquiries.pm b/perllib/FixMyStreet/Script/ArchiveOldEnquiries.pm
index dd44b9651..ce32b0d93 100644
--- a/perllib/FixMyStreet/Script/ArchiveOldEnquiries.pm
+++ b/perllib/FixMyStreet/Script/ArchiveOldEnquiries.pm
@@ -138,9 +138,17 @@ sub close_problems {
return unless $opts->{commit};
my $problems = shift;
+
+ return unless $problems->count;
+
my $extra = { auto_closed_by_script => 1 };
$extra->{is_superuser} = 1 if !$opts->{user_name};
+ # need to do this again in case no reports were closed with an
+ # email in which case we won't have set the lang and domain
+ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($opts->{cobrand})->new();
+ $cobrand->set_lang_and_domain($problems->first->lang, 1);
+
while (my $problem = $problems->next) {
my $timestamp = \'current_timestamp';
my $comment = $problem->add_to_comments( {