diff options
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 4b738b66c..192e539bd 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -85,11 +85,13 @@ __PACKAGE__->add_columns( "geocode", { data_type => "bytea", is_nullable => 1 }, "send_fail_count", - { data_type => "integer", is_nullable => 1 }, + { data_type => "integer", default_value => 0, is_nullable => 0 }, "send_fail_reason", { data_type => "text", is_nullable => 1 }, "send_fail_timestamp", { data_type => "timestamp", is_nullable => 1 }, + "send_method_used", + { data_type => "text", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->has_many( @@ -112,8 +114,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-16 10:08:56 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VODeZlWk8l/+IzBBlRNV0A +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-05-03 16:05:20 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EvwI91Ot7SioQWqwnXRTBQ # Add fake relationship to stored procedure table __PACKAGE__->has_one( @@ -568,11 +570,25 @@ sub body { return $body; } +# 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! +sub can_display_external_id { + my $self = shift; + if ($self->external_id && $self->send_method_used eq 'barnet') { + return 1; + } + return 0; +} + # TODO Some/much of this could be moved to the template # either: # "sent to council 3 mins later" -# "council ref: XYZ" +# "[Council name] ref: XYZ" # or # "sent to council 3 mins later, their ref: XYZ" # @@ -584,7 +600,7 @@ sub processed_summary_string { if ($problem->whensent) { $duration_clause = $problem->duration_string($c) } - if ($problem->external_id) { + if ($problem->can_display_external_id) { if ($duration_clause) { $external_ref_clause = sprintf(_('their ref: %s'), $problem->external_id); } else { |