diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-04-16 18:08:43 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-04-23 15:39:50 +0100 |
commit | 8ca1681a0c9e3627b1b4c6ed8599e9b4c6d276a1 (patch) | |
tree | 551dd62b1511b47a45c87260ee64bd3ec164f23c | |
parent | 86eae502d494090430f3076f25331df797b9172b (diff) |
Add new report hooks for cobrand report munging.
One to alter the category after initially set, one to change
any details of the report before saving to the database.
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 3 | ||||
-rw-r--r-- | t/Mock/MapIt.pm | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 7b4f1abad..7468b0041 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -918,6 +918,7 @@ sub process_report : Private { # set these straight from the params $report->category( _ $params{category} ) if $params{category}; + $c->cobrand->call_hook(report_new_munge_category => $report); $report->subcategory( $params{subcategory} ); my $areas = $c->stash->{all_areas_mapit}; @@ -1351,6 +1352,8 @@ sub save_user_and_report : Private { $c->log->info($report->user->id . ' exists, but is not logged in for this report'); } + $c->cobrand->call_hook(report_new_munge_before_insert => $report); + $report->update_or_insert; # tidy up diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm index 1e94bb3e6..c57f7e0ed 100644 --- a/t/Mock/MapIt.pm +++ b/t/Mock/MapIt.pm @@ -23,6 +23,7 @@ sub output { } my @PLACES = ( + [ '?', 53.387402, -2.943997, 2527, 'Liverpool City Council', 'MTD' ], [ 'EH1 1BB', 55.952055, -3.189579, 2651, 'Edinburgh City Council', 'UTA', 20728, 'City Centre', 'UTE' ], [ 'BS10 5EE', 51.494885, -2.602237, 2561, 'Bristol City Council', 'UTA', 148646, 'Bedminster', 'UTW' ], [ 'SW1A 1AA', 51.501009, -0.141588, 2504, 'Westminster City Council', 'LBO' ], |