From b0684a489aceafd9c45144c48fa9dc7c89eba9fc Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 5 Oct 2023 10:03:31 +0100 Subject: [PATCH] [Waste] Avoid external call viewing bulky report. --- perllib/FixMyStreet/App/Controller/Waste.pm | 9 +++++---- perllib/FixMyStreet/App/Controller/Waste/Bulky.pm | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/perllib/FixMyStreet/App/Controller/Waste.pm b/perllib/FixMyStreet/App/Controller/Waste.pm index adbbbd520c1..f6bd9c43c76 100644 --- a/perllib/FixMyStreet/App/Controller/Waste.pm +++ b/perllib/FixMyStreet/App/Controller/Waste.pm @@ -1511,27 +1511,28 @@ sub add_report : Private { $c->forward('setup_categories_and_bodies') unless $c->stash->{contacts}; $c->forward('/report/new/non_map_creation', [['/waste/remove_name_errors']]) or return; + my $report = $c->stash->{report}; + # store photos foreach (grep { /^(item|location)_photo/ } keys %$data) { next unless $data->{$_}; my $k = $_; $k =~ s/^(.+)_fileid$/$1/; - $c->stash->{report}->set_extra_metadata($k => $data->{$_}); + $report->set_extra_metadata($k => $data->{$_}); } + $report->set_extra_metadata(property_address => $c->stash->{property}{address}); $c->cobrand->call_hook('save_item_names_to_report' => $data); - $c->stash->{report}->update; + $report->update; # we don't want to confirm reports that are for things that require a payment because # we need to get the payment to confirm them. if ( $no_confirm ) { - my $report = $c->stash->{report}; $report->state('unconfirmed'); $report->confirmed(undef); $report->update; } else { if ($c->cobrand->call_hook('waste_never_confirm_reports')) { - my $report = $c->stash->{report}; $report->confirm; $report->update; } diff --git a/perllib/FixMyStreet/App/Controller/Waste/Bulky.pm b/perllib/FixMyStreet/App/Controller/Waste/Bulky.pm index a10f07fcca8..9902aad86fe 100644 --- a/perllib/FixMyStreet/App/Controller/Waste/Bulky.pm +++ b/perllib/FixMyStreet/App/Controller/Waste/Bulky.pm @@ -151,9 +151,10 @@ sub view : Private { my $p = $c->stash->{problem}; - if (!$c->stash->{property}) { - $c->stash->{property} = $c->cobrand->call_hook(look_up_property => $p->get_extra_field_value('property_id')); - } + $c->stash->{property} = { + id => $p->get_extra_field_value('property_id'), + address => $p->get_extra_metadata('property_address'), + }; $c->stash->{template} = 'waste/bulky/summary.html';