diff options
author | Dave Arter <davea@mysociety.org> | 2016-07-08 15:38:10 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-07-08 15:38:10 +0100 |
commit | 0c5549a60ef3d86d672926d6e71c00cafff8326b (patch) | |
tree | 94158b497072156c273f442ce19888665a205a2c /perllib/FixMyStreet/DB/Result/Problem.pm | |
parent | 680893b2489830b0c06a6ffdbf8c9f15ddb22487 (diff) | |
parent | 8a8b34b66dbdb9d2ce9c5b2d00318d75ef93d267 (diff) |
Merge branch 'issues/commercial/500-cobrand-reporting-issues-redux'
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index a2167032a..bc72cf9da 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -658,7 +658,12 @@ sub can_display_external_id { sub duration_string { my ( $problem, $c ) = @_; - my $body = $problem->body( $c ); + my $body; + if ( $c->cobrand->can('link_to_council_cobrand') ) { + $body = $c->cobrand->link_to_council_cobrand($problem); + } else { + $body = $problem->body( $c ); + } return sprintf(_('Sent to %s %s later'), $body, Utils::prettify_duration($problem->whensent->epoch - $problem->confirmed->epoch, 'minute') ); @@ -868,4 +873,24 @@ sub get_time_spent { return $admin_logs ? $admin_logs->get_column('sum_time_spent') : 0; } +=head2 get_cobrand_logged + +Get a cobrand object for the cobrand the problem was logged for. + +e.g. if a problem was logged at www.fixmystreet.com, this will be a +FixMyStreet::Cobrand::FixMyStreet object. + +=cut + +has get_cobrand_logged => ( + is => 'ro', + lazy => 1, + default => sub { + my $self = shift; + my $cobrand_class = FixMyStreet::Cobrand->get_class_for_moniker( $self->cobrand ); + return $cobrand_class->new; + }, +); + + 1; |