From 760492437b50e1878c7262f978e157c293161bd8 Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Wed, 18 Sep 2024 13:34:57 +0100 Subject: [PATCH] Fix admin editing of anonymous reports Not submitting the name field would cause a DB error because it would try to set `name` to NULL. And including the other two seemed like a good idea too. --- CHANGELOG.md | 1 + bin/open311-populate-service-list | 4 ++++ templates/web/base/admin/reports/_edit_main.html | 3 +++ 3 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba93a3ac3bf..60b2dc9e4b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ - Cobrands can provide per-category custom distances for duplicate lookup. #4746 #5162 - Add perl 5.38 support. - Add plain text template previews to /_dev/email. #5105 + - Add --exclude option to bin/open311-populate-service-list - Performance improvements: - Reduce database queries on shortlist page. - Provide ResultSet fallback translation in lookup. diff --git a/bin/open311-populate-service-list b/bin/open311-populate-service-list index 966b3ac7343..88d2570c9b0 100755 --- a/bin/open311-populate-service-list +++ b/bin/open311-populate-service-list @@ -17,6 +17,7 @@ use Getopt::Long::Descriptive; my ($opt, $usage) = describe_options( '%c %o', ['body|b:s', "body name to only fetch this body"], + ['exclude|e:s@', 'body name(s) to exclude from fetching' ], ['verbose|v', "print out all services as they are found"], ['warn|w', "output warnings about any issues"], ['help', "print usage message and exit" ], @@ -29,6 +30,9 @@ my $bodies = FixMyStreet::DB->resultset('Body')->search( { if ($opt->body) { $bodies = $bodies->search({ name => $opt->body }); } +if (my $exclude = $opt->exclude) { + $bodies = $bodies->search({ name => { -not_in => $exclude } }); +} my $verbose = 0; $verbose = 1 if $opt->warn; diff --git a/templates/web/base/admin/reports/_edit_main.html b/templates/web/base/admin/reports/_edit_main.html index c46d44cefdc..48d60390732 100644 --- a/templates/web/base/admin/reports/_edit_main.html +++ b/templates/web/base/admin/reports/_edit_main.html @@ -171,6 +171,9 @@
[% IF problem.user.email == cobrand.anonymous_account.email %]

[% loc('User:') %] [% loc('Anonymous user') %]

+ + + [% ELSE %] [% IF allowed_pages.user_edit %]