Skip to content

Commit

Permalink
[Waste] Avoid external call viewing bulky report.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Oct 6, 2023
1 parent f61474d commit b0684a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions perllib/FixMyStreet/App/Controller/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
7 changes: 4 additions & 3 deletions perllib/FixMyStreet/App/Controller/Waste/Bulky.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down

0 comments on commit b0684a4

Please sign in to comment.