aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB/Result')
-rw-r--r--perllib/FixMyStreet/DB/Result/Body.pm2
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm9
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm113
3 files changed, 103 insertions, 21 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Body.pm b/perllib/FixMyStreet/DB/Result/Body.pm
index 27ea1897e..83704563a 100644
--- a/perllib/FixMyStreet/DB/Result/Body.pm
+++ b/perllib/FixMyStreet/DB/Result/Body.pm
@@ -36,6 +36,8 @@ __PACKAGE__->add_columns(
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
"can_be_devolved",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
+ "send_extended_statuses",
+ { data_type => "boolean", default_value => \"false", is_nullable => 0 },
"parent",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
);
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index 2098a6495..33fbb9356 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -147,6 +147,11 @@ sub check_for_errors {
$errors{update} = _('Please enter a message')
unless $self->text =~ m/\S/;
+ if ( $self->text && $self->problem && $self->problem->bodies_str
+ && $self->problem->bodies_str eq '2482' && length($self->text) > 2000 ) {
+ $errors{update} = _('Updates are limited to 2000 characters in length. Please shorten your update');
+ }
+
return \%errors;
}
@@ -187,6 +192,10 @@ sub meta_problem_state {
my $state = $self->problem_state;
$state =~ s/ -.*$//;
+ $state = _("not the council's responsibility")
+ if $state eq 'not responsible';
+ $state = _('duplicate report') if $state eq 'duplicate';
+
return $state;
}
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index f43e31173..d9a2a0273 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -100,6 +100,8 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 1 },
"interest_count",
{ data_type => "integer", default_value => 0, is_nullable => 1 },
+ "subcategory",
+ { data_type => "text", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->has_many(
@@ -196,10 +198,11 @@ HASHREF.
sub open_states {
my $states = {
- 'confirmed' => 1,
- 'investigating' => 1,
- 'planned' => 1,
- 'in progress' => 1,
+ 'confirmed' => 1,
+ 'investigating' => 1,
+ 'in progress' => 1,
+ 'planned' => 1,
+ 'action scheduled' => 1,
};
return wantarray ? keys %{$states} : $states;
@@ -237,7 +240,11 @@ HASHREF.
sub closed_states {
my $states = {
- 'closed' => 1,
+ 'closed' => 1,
+ 'unable to fix' => 1,
+ 'not responsible' => 1,
+ 'duplicate' => 1,
+ 'internal referral' => 1,
};
return wantarray ? keys %{$states} : $states;
@@ -248,21 +255,26 @@ sub closed_states {
@states = FixMyStreet::DB::Problem::visible_states();
-Get a list or states that should be visible on the site. If called in
+Get a list of states that should be visible on the site. If called in
array context then returns an array of names, otherwise returns a
HASHREF.
=cut
my $visible_states = {
- 'confirmed' => 1,
- 'planned' => 1,
- 'investigating' => 1,
- 'in progress' => 1,
- 'fixed' => 1,
- 'fixed - council' => 1,
- 'fixed - user' => 1,
- 'closed' => 1,
+ 'confirmed' => 1,
+ 'investigating' => 1,
+ 'in progress' => 1,
+ 'planned' => 1,
+ 'action scheduled' => 1,
+ 'fixed' => 1,
+ 'fixed - council' => 1,
+ 'fixed - user' => 1,
+ 'unable to fix' => 1,
+ 'not responsible' => 1,
+ 'duplicate' => 1,
+ 'closed' => 1,
+ 'internal referral' => 1,
};
sub visible_states {
return wantarray ? keys %{$visible_states} : $visible_states;
@@ -271,6 +283,63 @@ sub visible_states_add_unconfirmed {
$visible_states->{unconfirmed} = 1;
}
+=head2
+
+ @states = FixMyStreet::DB::Problem::all_states();
+
+Get a list of all states that a problem can have. If called in
+array context then returns an array of names, otherwise returns a
+HASHREF.
+
+=cut
+
+sub all_states {
+ my $states = {
+ 'hidden' => 1,
+ 'partial' => 1,
+ 'unconfirmed' => 1,
+ 'confirmed' => 1,
+ 'investigating' => 1,
+ 'in progress' => 1,
+ 'action scheduled' => 1,
+ 'fixed' => 1,
+ 'fixed - council' => 1,
+ 'fixed - user' => 1,
+ 'unable to fix' => 1,
+ 'not responsible' => 1,
+ 'duplicate' => 1,
+ 'closed' => 1,
+ 'internal referral' => 1,
+ };
+
+ return wantarray ? keys %{$states} : $states;
+}
+
+=head2
+
+ @states = FixMyStreet::DB::Problem::council_states();
+
+Get a list of states that are availble to council users. If called in
+array context then returns an array of names, otherwise returns a
+HASHREF.
+
+=cut
+sub council_states {
+ my $states = {
+ 'confirmed' => 1,
+ 'investigating' => 1,
+ 'action scheduled' => 1,
+ 'in progress' => 1,
+ 'fixed - council' => 1,
+ 'unable to fix' => 1,
+ 'not responsible' => 1,
+ 'duplicate' => 1,
+ 'internal referral' => 1,
+ };
+
+ return wantarray ? keys %{$states} : $states;
+}
+
my $tz = DateTime::TimeZone->new( name => "local" );
sub confirmed_local {
@@ -371,6 +440,11 @@ sub check_for_errors {
$self->category(undef);
}
+ if ( $self->bodies_str && $self->detail &&
+ $self->bodies_str eq '2482' && length($self->detail) > 2000 ) {
+ $errors{detail} = _('Reports are limited to 2000 characters in length. Please shorten your report');
+ }
+
return \%errors;
}
@@ -508,11 +582,7 @@ sub meta_line {
my $category = _($problem->category);
utf8::decode($category);
- if ($problem->anonymous) {
- $meta = sprintf(_('%s, reported anonymously at %s'), $category, $date_time);
- } else {
- $meta = sprintf(_('%s, reported by %s at %s'), $category, $problem->name, $date_time);
- }
+ $meta = sprintf(_('%s, reported at %s'), $category, $date_time);
} else {
@@ -598,7 +668,8 @@ sub body {
# 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 && $self->send_method_used eq 'barnet') {
+ if ($self->external_id && $self->send_method_used &&
+ ($self->send_method_used eq 'barnet' || $self->council =~ /2237/)) {
return 1;
}
return 0;
@@ -618,7 +689,7 @@ sub processed_summary_string {
my ( $problem, $c ) = @_;
my ($duration_clause, $external_ref_clause);
if ($problem->whensent) {
- $duration_clause = $problem->duration_string($c)
+ $duration_clause = $problem->duration_string($c);
}
if ($problem->can_display_external_id) {
if ($duration_clause) {