diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2015-02-19 16:41:22 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2015-10-06 09:09:23 +0100 |
commit | 735536dc5e269f2094d122e49f2c648928db4acb (patch) | |
tree | 5779c470d6f326828f0f587f76bfc0841c03144f /perllib/FixMyStreet/DB/Result/Problem.pm | |
parent | d004b2df0c85615eab6924c35f478b45bdf84b2d (diff) |
[Zurich] Response templates for report admin.
This provides a ResponseTemplate model that an admin/staff
user can choose from when responding to problems.
For mysociety/FixMyStreet-Commercial#671.
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 635c41382..d3a30db4e 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -643,7 +643,28 @@ sub body { return $body; } -# returns true if the external id is the council's ref, i.e., useful to publish it. +=head2 response_templates + +Returns all ResponseTemplates attached to this problem's bodies, in alphabetical +order of title. + +=cut + +sub response_templates { + my $problem = shift; + return FixMyStreet::App->model('DB::ResponseTemplate')->search( + { + body_id => $problem->bodies_str_ids + }, + { + order_by => 'title' + } + ); +} + +# returns true if the external id is the council's ref, i.e., useful to publish it +# (by way of an example, the barnet send method returns a useful reference when +# it succeeds, so that is the ref we should show on the problem report page). # Future: this is installation-dependent so maybe should be using the contact # data to determine if the external id is public on a council-by-council basis. # Note: this only makes sense when called on a problem that has been sent! |