aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Contact.pm
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-08-23 17:28:11 +0100
committerDave Arter <davea@mysociety.org>2016-09-08 09:45:58 +0100
commit1444841970096122c9aeb5e86c82bede01b1bee6 (patch)
tree79b96fda21ce35037d05065644a1043077bf1717 /perllib/FixMyStreet/DB/Result/Contact.pm
parent80a01c11f656f19d6df4c2e4294f613db14689b1 (diff)
Extend response templates to work across all cobrands
This builds on the response templates in the Zürich cobrand: - Allow response templates to be assigned to categories - Also adds a auto_response flag, which will be used to automatically create updates when reports are made. - Include response templates select box on update form For mysociety/fixmystreetforcouncils#31
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Contact.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Contact.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm
index 58d8e58de..ea9b656aa 100644
--- a/perllib/FixMyStreet/DB/Result/Contact.pm
+++ b/perllib/FixMyStreet/DB/Result/Contact.pm
@@ -55,10 +55,16 @@ __PACKAGE__->belongs_to(
{ id => "body_id" },
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
);
+__PACKAGE__->has_many(
+ "contact_response_templates",
+ "FixMyStreet::DB::Result::ContactResponseTemplate",
+ { "foreign.contact_id" => "self.id" },
+ { cascade_copy => 0, cascade_delete => 0 },
+);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-09-10 17:11:54
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hq/BFHDEu4OUI4MSy3OyHg
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-08-24 11:29:04
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CXUabm3Yd11OoIYJceSPag
__PACKAGE__->load_components("+FixMyStreet::DB::RABXColumn");
__PACKAGE__->rabx_column('extra');
@@ -68,6 +74,8 @@ use namespace::clean -except => [ 'meta' ];
with 'FixMyStreet::Roles::Extra';
+__PACKAGE__->many_to_many( response_templates => 'contact_response_templates', 'response_template' );
+
sub get_metadata_for_input {
my $self = shift;
my $id_field = $self->id_field;