From 224a88b5e99034c110603f7db2cc17fd2a108679 Mon Sep 17 00:00:00 2001 From: Victoria Mihell-Hale Date: Mon, 9 Sep 2024 13:08:13 +0100 Subject: [PATCH] [Northumberland] Add comment when extra details updated --- perllib/FixMyStreet/App/Controller/Report.pm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 99a169b3e44..9397444ea11 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -460,6 +460,8 @@ sub inspect : Private { if ($permissions->{report_inspect}) { $problem->set_extra_metadata( traffic_information => $c->get_param('traffic_information') ); + my $old_detailed_information + = $problem->get_extra_metadata('detailed_information'); if ( my $info = $c->get_param('detailed_information') ) { $problem->set_extra_metadata( detailed_information => $info ); if ($c->cobrand->max_detailed_info_length && @@ -472,6 +474,21 @@ sub inspect : Private { $c->cobrand->max_detailed_info_length ); } + } elsif ( $c->get_param('detailed_information') eq '' ) { + $problem->unset_extra_metadata('detailed_information'); + } + + my $handler + = $c->cobrand->call_hook( + get_body_handler_for_problem => $problem + ) || $c->cobrand; + my $record_extra + = $handler->call_hook('record_update_extra_fields'); + if ( $record_extra->{detailed_information} + && $problem->get_extra_metadata('detailed_information') ne + $old_detailed_information ) + { + $update_params{extra}{detailed_information} = 1; } if ( $c->get_param('include_update') or $c->get_param('raise_defect') ) { @@ -521,7 +538,7 @@ sub inspect : Private { # If the state has been changed to action scheduled and they've said # they want to raise a defect, consider the report to be inspected. if ($problem->state eq 'action scheduled' && $c->get_param('raise_defect') && !$problem->get_extra_metadata('inspected')) { - $update_params{extra} = { 'defect_raised' => 1 }; + $update_params{extra}{defect_raised} = 1; $problem->set_extra_metadata( inspected => 1 ); $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'inspected' ] ); }