aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Problem.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-09-22 16:12:40 +0100
committerDave Arter <davea@mysociety.org>2017-02-15 17:27:29 +0000
commit34795d026faf45b0a1bfc103362eb118766c46d7 (patch)
treefc43f5c09c7b4bfe033d99ff3380cb5bcdc771b4 /perllib/FixMyStreet/DB/Result/Problem.pm
parent54af489f0fe985dfc433f0b8a3ab226a470a6023 (diff)
Add cobrand call_hook fn, calls a fn if defined.
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm19
1 files changed, 5 insertions, 14 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 97cb28fe8..f469c4275 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -613,9 +613,7 @@ sub meta_line {
my $meta = '';
my $category = $problem->category;
- if ($c->cobrand->can('change_category_text')) {
- $category = $c->cobrand->change_category_text($category);
- }
+ $category = $c->cobrand->call_hook(change_category_text => $category) || $category;
if ( $problem->anonymous ) {
if ( $problem->service and $category && $category ne _('Other') ) {
@@ -748,17 +746,10 @@ sub can_display_external_id {
sub duration_string {
my ( $problem, $c ) = @_;
- my $body;
- if ( $c->cobrand->can('link_to_council_cobrand') ) {
- $body = $c->cobrand->link_to_council_cobrand($problem);
- } else {
- $body = $problem->body( $c );
- }
- if ( $c->cobrand->can('get_body_handler_for_problem') ) {
- my $handler = $c->cobrand->get_body_handler_for_problem( $problem );
- if ( $handler->can('is_council_with_case_management') && $handler->is_council_with_case_management ) {
- return sprintf(_('Received by %s moments later'), $body);
- }
+ my $body = $c->cobrand->call_hook(link_to_council_cobrand => $problem) || $problem->body($c);
+ my $handler = $c->cobrand->call_hook(get_body_handler_for_problem => $problem);
+ if ( $handler && $handler->call_hook('is_council_with_case_management') ) {
+ return sprintf(_('Received by %s moments later'), $body);
}
return unless $problem->whensent;
return sprintf(_('Sent to %s %s later'), $body,