aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Whiteland <dave@mysociety.org>2012-07-12 11:50:58 +0100
committerDave Whiteland <dave@mysociety.org>2012-07-12 11:50:58 +0100
commit8c297f3f178dc8e3678ab28d5d686d2ee542d96c (patch)
treec87d2e91fcfc47969b7ee4dfe382dc65298ca8cd
parent55751b48ca0cd977bf1d58ed600eff22bf5e8e81 (diff)
changed mm_msg_id to external_source_id, and added external_source col
-rw-r--r--db/schema_0021-add_external_source_columns_to_problem.sql8
-rw-r--r--db/schema_0021-add_mm_msg_id_to_problem.sql6
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm15
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm8
-rw-r--r--templates/web/fixmybarangay/around/tabbed_lists.html8
-rw-r--r--templates/web/fixmybarangay/header.html4
6 files changed, 27 insertions, 22 deletions
diff --git a/db/schema_0021-add_external_source_columns_to_problem.sql b/db/schema_0021-add_external_source_columns_to_problem.sql
new file mode 100644
index 000000000..4105ebb39
--- /dev/null
+++ b/db/schema_0021-add_external_source_columns_to_problem.sql
@@ -0,0 +1,8 @@
+begin;
+
+ALTER table problem
+ ADD column external_source TEXT;
+ALTER table problem
+ ADD column external_source_id INTEGER;
+
+commit;
diff --git a/db/schema_0021-add_mm_msg_id_to_problem.sql b/db/schema_0021-add_mm_msg_id_to_problem.sql
deleted file mode 100644
index 12c981ed3..000000000
--- a/db/schema_0021-add_mm_msg_id_to_problem.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-begin;
-
-ALTER table problem
- ADD column mm_msg_id INTEGER;
-
-commit;
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 011e9e4b6..b0b338c69 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -1002,11 +1002,12 @@ sub save_user_and_report : Private {
$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')=~/^\d+$/) {
- $c->stash->{mm_msg_id} = $c->req->param('mm_msg_id');
- $report->mm_msg_id( $c->req->param('mm_msg_id') );
- }
-
+ if ($c->cobrand->moniker eq 'fixmybarangay' && $c->req->param('external_source_id')=~/^\d+$/) {
+ $c->stash->{external_source_id} = $c->req->param('external_source_id');
+ $report->external_source_id( $c->req->param('external_source_id') );
+ $report->external_source( $c->config->{MESSAGE_MANAGER_URL} ) ;
+ }
+
# save the report;
$report->in_storage ? $report->update : $report->insert();
@@ -1071,8 +1072,8 @@ sub redirect_or_confirm_creation : Private {
$c->forward( 'create_reporter_alert' );
my $report_uri;
- if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_council && $c->stash->{mm_msg_id}) {
- $report_uri = $c->uri_for( '/report', $report->id, undef, { mm_msg_id => $c->stash->{mm_msg_id} } );
+ if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_council && $c->stash->{external_source_id}) {
+ $report_uri = $c->uri_for( '/report', $report->id, undef, { external_source_id => $c->stash->{external_source_id} } );
} else {
$report_uri = $c->uri_for( '/report', $report->id );
}
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index bd209368a..4f35e7c94 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -92,7 +92,9 @@ __PACKAGE__->add_columns(
{ data_type => "timestamp", is_nullable => 1 },
"send_method_used",
{ data_type => "text", is_nullable => 1 },
- "mm_msg_id",
+ "external_source",
+ { data_type => "text", is_nullable => 1 },
+ "external_source_id",
{ data_type => "integer", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");
@@ -116,8 +118,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-07-11 18:53:26
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:F1NQHntuovV9YpE5FFr8QA
+# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-07-12 11:05:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sOVQRjsQJUtpzElZvuCp8Q
# Add fake relationship to stored procedure table
__PACKAGE__->has_one(
diff --git a/templates/web/fixmybarangay/around/tabbed_lists.html b/templates/web/fixmybarangay/around/tabbed_lists.html
index d73935a9c..77ca84ee4 100644
--- a/templates/web/fixmybarangay/around/tabbed_lists.html
+++ b/templates/web/fixmybarangay/around/tabbed_lists.html
@@ -61,16 +61,16 @@ $(document).ready(function() {
$('input[name=mm_text]').prop('checked', false); // uncheck all
}
$('#form_detail').val(msg_text);
- $('#mm_msg_id').val(service_id);
+ $('#external_source_id').val(service_id);
}
message_manager.config({url_root: mm_url});
message_manager.setup_click_listener({callback:mm_selected_message});
- // problem form hidden input "mm_msg_id": pass the MM id into FMS, if used
+ // problem form hidden input "external_source_id": pass the MM id into FMS, if used
$('<input type="hidden"/>').attr({
- 'id': 'mm_msg_id',
- 'name': 'mm_msg_id',
+ 'id': 'external_source_id',
+ 'name': 'external_source_id',
}).appendTo($('#problem_form'));
$('#available-submit').click(function(e){
diff --git a/templates/web/fixmybarangay/header.html b/templates/web/fixmybarangay/header.html
index e60e46ab2..052b2dd4d 100644
--- a/templates/web/fixmybarangay/header.html
+++ b/templates/web/fixmybarangay/header.html
@@ -27,10 +27,10 @@
[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %]
[% 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+$') %]
+ [% IF c.req.params.external_source_id && problem && problem.external_source_id.match('^\d+$') %]
<script>
$(document).ready(function() {
- var mm_msg_id ="[% c.req.params.mm_msg_id %]";
+ var mm_msg_id ="[% c.req.params.external_source_id %]";
var fms_id = "[% problem.id %]";
if (mm_msg_id && fms_id) {
message_manager.config({url_root: "[% c.config.MESSAGE_MANAGER_URL %]"});