aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm8
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm30
3 files changed, 39 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 1ac8bdd5c..6b222be4c 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -173,7 +173,7 @@ sub format_problem_for_display : Private {
if ( $c->stash->{ajax} ) {
$c->res->content_type('application/json; charset=utf-8');
my $content = JSON->new->utf8(1)->encode(
- $problem->as_hashref( $c )
+ $c->cobrand->problem_as_hashref( $problem, $c )
);
$c->res->body( $content );
return 1;
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index d99950ad0..2292a6cf3 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -818,5 +818,13 @@ Set to an indent string if you wish to override the default email handling.
sub email_indent { undef; }
+sub problem_as_hashref {
+ my $self = shift;
+ my $problem = shift;
+ my $ctx = shift;
+
+ return $problem->as_hashref( $ctx );
+}
+
1;
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index c7396f0c3..30365e0a3 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -51,6 +51,36 @@ sub prettify_dt {
return Utils::prettify_dt( $dt, 'zurich' );
}
+sub problem_as_hashref {
+ my $self = shift;
+ my $problem = shift;
+ my $ctx = shift;
+
+ my $hashref = $problem->as_hashref( $ctx );
+
+ if ( $problem->state eq 'unconfirmed' ) {
+ for my $var ( qw( photo category detail state state_t is_fixed meta ) ) {
+ delete $hashref->{ $var };
+ }
+ $hashref->{detail} = _('This report is awating moderation');
+ $hashref->{state} = 'submitted';
+ $hashref->{state_t} = _('Submitted');
+ } else {
+ if ( $problem->state eq 'confirmed' ) {
+ $hashref->{state} = 'open';
+ $hashref->{state_t} = _('Open');
+ } elsif ( $problem->is_fixed ) {
+ $hashref->{state} = 'closed';
+ $hashref->{state_t} = _('Closed');
+ } elsif ( $problem->state eq 'in progress' || $problem->state eq 'planned' ) {
+ $hashref->{state} = 'in progress';
+ $hashref->{state_t} = _('In progress');
+ }
+ }
+
+ return $hashref;
+}
+
sub remove_redundant_areas {
my $self = shift;
my $all_areas = shift;