diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 10 | ||||
-rw-r--r-- | templates/web/fixmybarangay/header.html | 26 |
2 files changed, 18 insertions, 18 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index c09b721b9..08d0addb9 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -801,6 +801,9 @@ sub process_report : Private { # set these straight from the params $report->category( _ $params{category} ) if $params{category}; + # if there is a Message Manager message ID, save it + $report->mm_msg_id( $params{mm_msg_id} ) if $params{mm_msg_id}=~/^\d+$/; + my $areas = $c->stash->{all_areas}; $report->areas( ',' . join( ',', sort keys %$areas ) . ',' ); @@ -1001,12 +1004,6 @@ sub save_user_and_report : Private { # Set unknown to DB unknown $report->council( undef ) if $report->council eq '-1'; - # if there is a Message Manager message ID, pass it back to the client view - if ($c->req->param('mm_msg_id')) { - $c->stash->{mm_msg_id} = $c->req->param('mm_msg_id'); - $report->service( $c->req->param('mm_msg_id') ); - } - # save the report; $report->in_storage ? $report->update : $report->insert(); @@ -1077,6 +1074,7 @@ sub redirect_or_confirm_creation : Private { $report_uri = $c->uri_for( '/report', $report->id ); } $c->log->info($report->user->id . ' was logged in, redirecting to /report/' . $report->id); + XXXX $c->res->redirect($report_uri); $c->detach; } diff --git a/templates/web/fixmybarangay/header.html b/templates/web/fixmybarangay/header.html index 55cf47789..e60e46ab2 100644 --- a/templates/web/fixmybarangay/header.html +++ b/templates/web/fixmybarangay/header.html @@ -23,20 +23,22 @@ [% INCLUDE 'common_header_tags.html', js_override = '/cobrands/fixmystreet/fixmystreet.js' %] <script src="[% version('/js/fancybox/jquery.fancybox-1.3.4.pack.js') %]" charset="utf-8"></script> - <script src="[% version('/cobrands/fixmybarangay/message_manager_client.js') %]" charset="utf-8"></script> [% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %] - [%IF allow_creation && problem.service %] - <script> - $(document).ready(function() { - var mm_msg_id ="[% problem.service %]".match(/\d+$/); - var fms_id = "[% problem.id %]"; - if (mm_msg_id && fms_id) { - message_manager.config({url_root: "[% c.config.MESSAGE_MANAGER_URL %]"}); - message_manager.assign_fms_id(mm_msg_id, fms_id); - } - }); - </script> + [% IF allow_creation %] + <script src="[% version('/cobrands/fixmybarangay/message_manager_client.js') %]" charset="utf-8"></script> + [% IF c.req.params.mm_msg_id && problem && problem.mm_msg_id.match('^\d+$') %] + <script> + $(document).ready(function() { + var mm_msg_id ="[% c.req.params.mm_msg_id %]"; + var fms_id = "[% problem.id %]"; + if (mm_msg_id && fms_id) { + message_manager.config({url_root: "[% c.config.MESSAGE_MANAGER_URL %]"}); + message_manager.assign_fms_id(mm_msg_id, fms_id); + } + }); + </script> + [% END %] [% END %] </head> <body class="[% bodyclass | html IF bodyclass %]"> |