aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@fury.ukcod.org.uk>2011-04-02 01:44:33 +0100
committerMatthew Somerville <matthew@fury.ukcod.org.uk>2011-04-02 01:44:33 +0100
commit960c1838721cf1f4366fb5c7600aa50b0c9e0c51 (patch)
tree4e5b47c938ddc19d11187223a3f9d9a0142dc686
parentb62f054c6b219973de587b254e534d7df53c39d9 (diff)
Add external columns for problems, and show body if present in preference to council.
-rw-r--r--db/schema.sql5
-rw-r--r--perllib/Page.pm15
-rw-r--r--perllib/Problems.pm2
3 files changed, 16 insertions, 6 deletions
diff --git a/db/schema.sql b/db/schema.sql
index fbff047fb..8ee028289 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -137,6 +137,11 @@ create table problem (
phone text not null,
anonymous boolean not null,
+ -- External information
+ external_id text not null,
+ external_body text not null,
+ external_team text not null,
+
-- Metadata
created timestamp not null default ms_current_timestamp(),
confirmed timestamp,
diff --git a/perllib/Page.pm b/perllib/Page.pm
index 24c52885a..e659c0af5 100644
--- a/perllib/Page.pm
+++ b/perllib/Page.pm
@@ -578,12 +578,17 @@ sub display_problem_meta_line($$) {
$out .= '; ' . _('the map was not used so pin location may be inaccurate') unless ($problem->{used_map});
if ($problem->{council}) {
if ($problem->{whensent}) {
- $problem->{council} =~ s/\|.*//g;
- my @councils = split /,/, $problem->{council};
- my $areas_info = mySociety::MaPit::call('areas', \@councils);
- my $council = join(' and ', map { $areas_info->{$_}->{name} } @councils);
+ my $body;
+ if ($problem->{external_body}) {
+ $body = $problem->{external_body};
+ } else {
+ $problem->{council} =~ s/\|.*//g;
+ my @councils = split /,/, $problem->{council};
+ my $areas_info = mySociety::MaPit::call('areas', \@councils);
+ $body = join(' and ', map { $areas_info->{$_}->{name} } @councils);
+ }
$out .= '<small class="council_sent_info">';
- $out .= $q->br() . sprintf(_('Sent to %s %s later'), $council, prettify_duration($problem->{whensent}, 'minute'));
+ $out .= $q->br() . sprintf(_('Sent to %s %s later'), $body, prettify_duration($problem->{whensent}, 'minute'));
$out .= '</small>';
}
} else {
diff --git a/perllib/Problems.pm b/perllib/Problems.pm
index 3710c3a95..7155aa485 100644
--- a/perllib/Problems.pm
+++ b/perllib/Problems.pm
@@ -226,7 +226,7 @@ sub fetch_problem {
used_map, name, anonymous, extract(epoch from confirmed) as time,
state, extract(epoch from whensent-confirmed) as whensent,
extract(epoch from ms_current_timestamp()-lastupdate) as duration,
- service, cobrand, cobrand_data
+ service, cobrand, cobrand_data, external_body
from problem where id=? and state in ('confirmed','fixed', 'hidden')
$site_restriction", {}, $id
);