diff options
-rwxr-xr-x | bin/zurich/fixture | 9 | ||||
-rwxr-xr-x | bin/zurich/overdue-alert | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Open311.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 228 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 14 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Script/Reports.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Zurich.pm | 8 | ||||
-rw-r--r-- | t/app/controller/report_display.t | 100 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 129 | ||||
-rw-r--r-- | templates/web/zurich/admin/header.html | 14 | ||||
-rw-r--r-- | templates/web/zurich/admin/index-dm.html | 6 | ||||
-rw-r--r-- | templates/web/zurich/admin/index.html | 3 | ||||
-rw-r--r-- | templates/web/zurich/admin/problem_row.html | 5 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit-sdm.html | 2 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit.html | 19 | ||||
-rw-r--r-- | templates/web/zurich/report/_item.html | 4 | ||||
-rw-r--r-- | templates/web/zurich/report/_main.html | 2 | ||||
-rw-r--r-- | web/cobrands/zurich/js.js | 2 |
20 files changed, 263 insertions, 295 deletions
diff --git a/bin/zurich/fixture b/bin/zurich/fixture index fec9977a5..e387c4fab 100755 --- a/bin/zurich/fixture +++ b/bin/zurich/fixture @@ -17,6 +17,7 @@ BEGIN { } use FixMyStreet; +use FixMyStreet::Cobrand::Zurich; use FixMyStreet::DB::Factories; use Getopt::Long::Descriptive; @@ -30,6 +31,9 @@ print($usage->text), exit if $opt->help; FixMyStreet::DB::Factories->setup($opt); +my $cobrand = FixMyStreet::Cobrand::Zurich->new(); +$cobrand->db_state_migration; + # Body + categories my $body = FixMyStreet::DB::Factory::Body->find_or_create({ name => 'Zürich', @@ -93,11 +97,10 @@ foreach ( my $lat = 47.381416; my $lon = 8.531369; -my $cobrand = 'zurich'; my $user = $users{'user@example.org'}; my $num = 20; -say "Created $num problems around '$lat,$lon' in cobrand '$cobrand'"; +say "Created $num problems around '$lat,$lon' in cobrand '" . $cobrand->moniker . "'"; my $confirmed = DateTime->today->subtract(days => 1)->add(hours => 8); my $problems = []; for (1..$num) { @@ -110,7 +113,7 @@ for (1..$num) { latitude => $lat, longitude => $lon, category => $category, - cobrand => $cobrand, + cobrand => $cobrand->moniker, confirmed => $confirmed, }); } diff --git a/bin/zurich/overdue-alert b/bin/zurich/overdue-alert index f4fd0f4b7..7689c172f 100755 --- a/bin/zurich/overdue-alert +++ b/bin/zurich/overdue-alert @@ -32,9 +32,9 @@ exit if FixMyStreet::Cobrand::Zurich::is_public_holiday($now) or FixMyStreet::Co my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('zurich')->new(); my %bodies = map { $_->id => $_ } FixMyStreet::DB->resultset("Body")->all; -loop_through( 'alert-moderation-overdue.txt', 0, 1, [ 'unconfirmed' ] ); +loop_through( 'alert-moderation-overdue.txt', 0, 1, [ 'submitted' ] ); loop_through( 'alert-overdue.txt', 1, 6, 'in progress' ); -loop_through( 'alert-overdue.txt', 0, 6, ['confirmed', 'planned'] ); +loop_through( 'alert-overdue.txt', 0, 6, ['confirmed', 'feedback pending'] ); sub loop_through { my ( $template, $include_parent, $days, $states ) = @_; diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm index c7e4e5bee..50f082e39 100644 --- a/perllib/FixMyStreet/App/Controller/Open311.pm +++ b/perllib/FixMyStreet/App/Controller/Open311.pm @@ -307,6 +307,7 @@ sub get_requests : Private { # Only provide access to the published reports my $states = FixMyStreet::DB::Result::Problem->visible_states(); delete $states->{unconfirmed}; + delete $states->{submitted}; my $criteria = { state => [ keys %$states ] }; @@ -409,6 +410,7 @@ sub get_request : Private { my $states = FixMyStreet::DB::Result::Problem->visible_states(); delete $states->{unconfirmed}; + delete $states->{submitted}; my $criteria = { state => [ keys %$states ], id => $id, diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 888110429..f7334c115 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -967,6 +967,7 @@ sub process_report : Private { # set defaults that make sense $report->state('unconfirmed'); + $report->state('submitted') if $c->cobrand->moniker eq 'zurich'; # save the cobrand and language related information $report->cobrand( $c->cobrand->moniker ); diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index c495cf941..7068d3b03 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -55,7 +55,7 @@ you already have, and the countres set so that they shouldn't in future. =cut sub setup_states { - FixMyStreet::DB::Result::Problem->visible_states_add('unconfirmed'); + FixMyStreet::DB::Result::Problem->visible_states_remove('not contactable'); } sub shorten_recency_if_new_greater_than_fixed { @@ -64,8 +64,8 @@ sub shorten_recency_if_new_greater_than_fixed { sub pin_colour { my ( $self, $p, $context ) = @_; - return 'green' if $p->is_fixed || $p->is_closed || $p->state eq 'investigating'; - return 'red' if $p->state eq 'unconfirmed' || $p->state eq 'confirmed'; + return 'green' if $p->is_fixed || $p->is_closed; + return 'red' if $p->state eq 'submitted' || $p->state eq 'confirmed'; return 'yellow'; } @@ -96,35 +96,11 @@ sub prettify_dt { return Utils::prettify_dt( $dt, 'zurich' ); } -# problem already has a concept of is_fixed/is_closed, but Zurich has different -# workflow for this here. -# -# TODO: look at more elegant way of doing this, for example having ::DB::Problem -# consider cobrand specific state config? - -sub zurich_closed_states { - my $states = { - 'fixed - council' => 1, - 'closed' => 1, # extern - 'hidden' => 1, - 'investigating' => 1, # wish - 'unable to fix' => 1, # jurisdiction unknown - 'partial' => 1, # not contactable - }; - - return wantarray ? keys %{ $states } : $states; -} - -sub problem_is_closed { - my ($self, $problem) = @_; - return exists $self->zurich_closed_states->{ $problem->state } ? 1 : 0; -} - sub zurich_public_response_states { my $states = { 'fixed - council' => 1, - 'closed' => 1, # extern - 'investigating' => 1, # wish + 'external' => 1, + 'wish' => 1, }; return wantarray ? keys %{ $states } : $states; @@ -132,9 +108,9 @@ sub zurich_public_response_states { sub zurich_user_response_states { my $states = { - 'unable to fix' => 1, # jurisdiction unknown + 'jurisdiction unknown' => 1, 'hidden' => 1, - 'partial' => 1, # not contactable + 'not contactable' => 1, }; return wantarray ? keys %{ $states } : $states; @@ -158,44 +134,33 @@ sub problem_as_hashref { my $hashref = $problem->as_hashref( $ctx ); - if ( $problem->state eq 'unconfirmed' ) { - for my $var ( qw( photo detail state state_t is_fixed meta ) ) { + if ( $problem->state eq 'submitted' ) { + for my $var ( qw( photo is_fixed meta ) ) { delete $hashref->{ $var }; } $hashref->{detail} = _('This report is awaiting moderation.'); $hashref->{title} = _('This report is awaiting moderation.'); - $hashref->{state} = 'submitted'; - $hashref->{state_t} = _('Submitted'); $hashref->{banner_id} = 'closed'; } else { + if ( $problem->state eq 'confirmed' || $problem->state eq 'external' ) { + $hashref->{banner_id} = 'closed'; + } elsif ( $problem->is_fixed || $problem->is_closed ) { + $hashref->{banner_id} = 'fixed'; + } else { + $hashref->{banner_id} = 'progress'; + } + if ( $problem->state eq 'confirmed' ) { $hashref->{state} = 'open'; $hashref->{state_t} = _('Open'); - $hashref->{banner_id} = 'closed'; - } elsif ( $problem->state eq 'closed' ) { - $hashref->{state} = 'extern'; # is this correct? - $hashref->{banner_id} = 'closed'; - $hashref->{state_t} = _('Extern'); - } elsif ( $problem->state eq 'unable to fix' ) { - $hashref->{state} = 'jurisdiction unknown'; # is this correct? - $hashref->{state_t} = _('Jurisdiction Unknown'); - $hashref->{banner_id} = 'fixed'; # green - } elsif ( $problem->state eq 'partial' ) { - $hashref->{state} = 'not contactable'; # is this correct? - $hashref->{state_t} = _('Not contactable'); - # no banner_id as hidden - } elsif ( $problem->state eq 'investigating' ) { - $hashref->{state} = 'wish'; # is this correct? - $hashref->{banner_id} = 'fixed'; + } elsif ( $problem->state eq 'wish' ) { $hashref->{state_t} = _('Closed'); } elsif ( $problem->is_fixed ) { $hashref->{state} = 'closed'; - $hashref->{banner_id} = 'fixed'; $hashref->{state_t} = _('Closed'); - } elsif ( $problem->state eq 'in progress' || $problem->state eq 'planned' ) { + } elsif ( $problem->state eq 'feedback pending' ) { $hashref->{state} = 'in progress'; - $hashref->{state_t} = _('In progress'); - $hashref->{banner_id} = 'progress'; + $hashref->{state_t} = FixMyStreet::DB->resultset("State")->display('in progress'); } } @@ -212,7 +177,7 @@ sub updates_as_hashref { if (problem_has_public_response($problem)) { $hashref->{update_pp} = $self->prettify_dt( $problem->lastupdate ); - if ( $problem->state ne 'closed' ) { + if ( $problem->state ne 'external' ) { $hashref->{details} = FixMyStreet::App::View::Web::add_links( $problem->get_extra_metadata('public_response') || '' ); } else { @@ -228,6 +193,7 @@ sub updates_as_hashref { # boolean whether that indexed photo can be shown. sub allow_photo_display { my ( $self, $r, $num ) = @_; + return unless $r; my $publish_photo; if (blessed $r) { $publish_photo = $r->get_extra_metadata('publish_photo'); @@ -249,10 +215,6 @@ sub allow_photo_display { return $i + 1; } -sub show_unconfirmed_reports { - 1; -} - sub get_body_sender { my ( $self, $body, $category ) = @_; return { method => 'Zurich' }; @@ -323,25 +285,23 @@ sub overdue { return 0 unless $w; # call with previous state - if ( $problem->state eq 'unconfirmed' ) { + if ( $problem->state eq 'submitted' ) { # One working day $w = add_days( $w, 1 ); return $w < DateTime->now() ? 1 : 0; - } elsif ( $problem->state eq 'confirmed' || $problem->state eq 'in progress' || $problem->state eq 'planned' ) { + } elsif ( $problem->state eq 'confirmed' || $problem->state eq 'in progress' || $problem->state eq 'feedback pending' ) { # States which affect the subdiv_overdue statistic. TODO: this may no longer be required # Six working days from creation $w = add_days( $w, 6 ); return $w < DateTime->now() ? 1 : 0; # call with new state - } elsif ( $self->problem_is_closed($problem) ) { + } else { # States which affect the closed_overdue statistic # Five working days from moderation (so 6 from creation) $w = add_days( $w, 6 ); return $w < DateTime->now() ? 1 : 0; - } else { - return 0; } } @@ -429,6 +389,13 @@ sub admin_pages { 'users' => [_('Users'), 3], 'user_edit' => [undef, undef], }; + + # There are some pages that only super users can see + if ($self->{c}->user->is_superuser) { + $pages->{states} = [ _('States'), 8 ]; + $pages->{config} = [ _('Configuration'), 9]; + }; + return $pages if $type eq 'super'; } @@ -470,14 +437,14 @@ sub admin { $order .= ' desc' if $dir; # XXX No multiples or missing bodies - $c->stash->{unconfirmed} = $c->cobrand->problems->search({ - state => [ 'unconfirmed', 'confirmed' ], + $c->stash->{submitted} = $c->cobrand->problems->search({ + state => [ 'submitted', 'confirmed' ], bodies_str => $c->stash->{body}->id, }, { order_by => $order, }); $c->stash->{approval} = $c->cobrand->problems->search({ - state => 'planned', + state => 'feedback pending', bodies_str => $c->stash->{body}->id, }, { order_by => $order, @@ -485,7 +452,7 @@ sub admin { my $page = $c->get_param('p') || 1; $c->stash->{other} = $c->cobrand->problems->search({ - state => { -not_in => [ 'unconfirmed', 'confirmed', 'planned' ] }, + state => { -not_in => [ 'submitted', 'confirmed', 'feedback pending' ] }, bodies_str => \@all, }, { order_by => $order, @@ -511,7 +478,7 @@ sub admin { order_by => $order } ); $c->stash->{reports_unpublished} = $c->cobrand->problems->search( { - state => 'planned', + state => 'feedback pending', bodies_str => $body->parent->id, }, { order_by => $order @@ -644,8 +611,7 @@ sub admin_report_edit { my $state = $c->get_param('state') || ''; my $oldstate = $problem->state; - my $closure_states = $self->zurich_closed_states; - delete $closure_states->{'fixed - council'}; # may not be needed? + my $closure_states = { map { $_ => 1 } FixMyStreet::DB::Result::Problem->closed_states(), FixMyStreet::DB::Result::Problem->hidden_states() }; my $old_closure_state = $problem->get_extra_metadata('closure_status') || ''; @@ -670,19 +636,19 @@ sub admin_report_edit { $self->update_admin_log($c, $problem, "Changed category from $old_cat to $new_cat"); $redirect = 1 if $cat->body_id ne $body->id; } elsif ( $oldstate ne $state and $closure_states->{$state} and - $oldstate ne 'planned' || $old_closure_state ne $state) + $oldstate ne 'feedback pending' || $old_closure_state ne $state) { # for these states - # - closed (Extern) - # - investigating (Wish) + # - external + # - wish # - hidden - # - partial (Not contactable) - # - unable to fix (Jurisdiction unknown) - # we divert to planned (Rueckmeldung ausstehend) and set closure_status to the requested state + # - not contactable + # - jurisdiction unknown + # we divert to feedback pending (Rueckmeldung ausstehend) and set closure_status to the requested state # From here, the DM can reply to the user, triggering the setting of problem to correct state $problem->set_extra_metadata( closure_status => $state ); - $self->set_problem_state($c, $problem, 'planned'); - $state = 'planned'; + $self->set_problem_state($c, $problem, 'feedback pending'); + $state = 'feedback pending'; $problem->set_extra_metadata_if_undefined( moderated_overdue => $self->overdue( $problem ) ); } elsif ( my $subdiv = $c->get_param('body_subdivision') ) { @@ -695,18 +661,18 @@ sub admin_report_edit { } else { if ($state) { - if ($oldstate eq 'unconfirmed' and $state ne 'unconfirmed') { + if ($oldstate eq 'submitted' and $state ne 'submitted') { # only set this for the first state change $problem->set_extra_metadata_if_undefined( moderated_overdue => $self->overdue( $problem ) ); } $self->set_problem_state($c, $problem, $state) unless $closure_states->{$state}; - # we'll defer to 'planned' clause below to change the state + # we'll defer to 'feedback pending' clause below to change the state } } - if ($problem->state eq 'planned') { + if ($problem->state eq 'feedback pending') { # Rueckmeldung ausstehend # override $state from the metadata set above $state = $problem->get_extra_metadata('closure_status') || ''; @@ -719,7 +685,7 @@ sub admin_report_edit { $moderated++; $closed++; } - elsif ($state =~/^(closed|investigating)$/) { # Extern | Wish + elsif ($state =~/^(external|wish)$/) { $moderated++; # Nested if instead of `and` because in these cases, we *don't* # want to close unless we have body_external (so we don't want @@ -732,7 +698,7 @@ sub admin_report_edit { if ($problem->external_body && $c->get_param('publish_response')) { $problem->whensent( undef ); $self->set_problem_state($c, $problem, $state); - my $template = ($state eq 'investigating') ? 'problem-wish.txt' : 'problem-external.txt'; + my $template = ($state eq 'wish') ? 'problem-wish.txt' : 'problem-external.txt'; _admin_send_email( $c, $template, $problem ); $redirect = 0; $closed++; @@ -778,7 +744,7 @@ sub admin_report_edit { # send external_message if provided and state is *now* Wish|Extern # e.g. was already, or was set in the Rueckmeldung ausstehend clause above. if ( my $external_message = $c->get_param('external_message') - and $problem->state =~ /^(closed|investigating)$/) + and $problem->state =~ /^(external|wish)$/) { my $external = $problem->external_body; my $external_body = $c->model('DB::Body')->find($external) @@ -790,7 +756,7 @@ sub admin_report_edit { $problem->add_to_comments( { text => ( sprintf '(%s %s) %s', - $state eq 'closed' ? + $state eq 'external' ? _('Forwarded to external body') : _('Forwarded wish to external body'), $external_body->name, @@ -867,8 +833,8 @@ sub admin_report_edit { $problem->bodies_str( $body->parent->id ); if ($not_contactable) { # we can't directly set state, but mark the closure_status for DM to confirm. - $self->set_problem_state($c, $problem, 'planned'); - $problem->set_extra_metadata( closure_status => 'partial'); + $self->set_problem_state($c, $problem, 'feedback pending'); + $problem->set_extra_metadata( closure_status => 'not contactable'); } else { $self->set_problem_state($c, $problem, 'confirmed'); @@ -915,7 +881,7 @@ sub admin_report_edit { $problem->set_extra_metadata( subdiv_overdue => $self->overdue( $problem ) ); $problem->bodies_str( $body->parent->id ); $problem->whensent( undef ); - $self->set_problem_state($c, $problem, 'planned'); + $self->set_problem_state($c, $problem, 'feedback pending'); $problem->update; $c->res->redirect( '/admin/summary' ); } @@ -943,61 +909,52 @@ sub stash_states { my @states = ( { # Erfasst - state => 'unconfirmed', - trans => _('Submitted'), - unconfirmed => 1, + state => 'submitted', + submitted => 1, hidden => 1, }, { # Aufgenommen state => 'confirmed', - trans => _('Open'), - unconfirmed => 1, + submitted => 1, }, { # Unsichtbar (hidden) state => 'hidden', - trans => _('Hidden'), - unconfirmed => 1, + submitted => 1, hidden => 1, }, { # Extern - state => 'closed', - trans => _('Extern'), + state => 'external', }, { # Zustaendigkeit unbekannt - state => 'unable to fix', - trans => _('Jurisdiction unknown'), + state => 'jurisdiction unknown', }, { - # Wunsch (hidden) - state => 'investigating', - trans => _('Wish'), + # Wunsch + state => 'wish', }, { # Nicht kontaktierbar (hidden) - state => 'partial', - trans => _('Not contactable'), + state => 'not contactable', }, ); - my %state_trans = map { $_->{state} => $_->{trans} } @states; my $state = $problem->state; # Rueckmeldung ausstehend may also indicate the status it's working towards. push @states, do { - if ($state eq 'planned' and my $closure_status = $problem->get_extra_metadata('closure_status')) { + if ($state eq 'feedback pending' and my $closure_status = $problem->get_extra_metadata('closure_status')) { { state => $closure_status, - trans => sprintf '%s (%s)', _('Planned'), $state_trans{$closure_status}, + trans => sprintf 'Rückmeldung ausstehend (%s)', FixMyStreet::DB->resultset("State")->display($closure_status), }; } else { { - state => 'planned', - trans => _('Planned'), + state => 'feedback pending', }; } }; @@ -1005,25 +962,22 @@ sub stash_states { if ($state eq 'in progress') { push @states, { state => 'in progress', - trans => _('In progress'), }; } elsif ($state eq 'fixed - council') { push @states, { state => 'fixed - council', - trans => _('Closed'), }; } - elsif ($state =~/^(hidden|unconfirmed)$/) { + elsif ($state =~/^(hidden|submitted)$/) { @states = grep { $_->{$state} } @states; } $c->stash->{states} = \@states; - $c->stash->{states_trans} = { map { $_->{state} => $_->{trans} } @states }; # [% states_trans.${problem.state} %] # stash details about the public response $c->stash->{default_public_response} = "\nFreundliche Grüsse\n\nIhre Stadt Zürich\n"; $c->stash->{show_publish_response} = - ($problem->state eq 'planned'); + ($problem->state eq 'feedback pending'); } =head2 _admin_send_email @@ -1055,7 +1009,7 @@ sub _admin_send_email { sub munge_sendreport_params { my ($self, $row, $h, $params) = @_; - if ($row->state =~ /^(closed|investigating)$/) { + if ($row->state =~ /^(external|wish)$/) { # we attach images to reports sent to external bodies my $photoset = $row->get_photoset(); my $num = $photoset->num_images @@ -1166,12 +1120,12 @@ sub admin_stats { # Reports marked as spam my $hidden = $c->model('DB::Problem')->search( { state => 'hidden', %optional_params } )->count; # Reports assigned to third party - my $closed = $c->model('DB::Problem')->search( { state => 'closed', %optional_params } )->count; + my $external = $c->model('DB::Problem')->search( { state => 'external', %optional_params } )->count; # Reports moderated within 1 day my $moderated = $c->model('DB::Problem')->search( { extra => { like => '%moderated_overdue,I1:0%' }, %optional_params } )->count; # Reports solved within 5 days (sent back from subdiv) my $subdiv_dealtwith = $c->model('DB::Problem')->search( { extra => { like => '%subdiv_overdue,I1:0%' }, %params } )->count; - # Reports solved within 5 days (marked as 'fixed - council', 'closed', or 'hidden' + # Reports solved within 5 days (marked as 'fixed - council', 'external', or 'hidden' my $fixed_in_time = $c->model('DB::Problem')->search( { extra => { like => '%closed_overdue,I1:0%' }, %optional_params } )->count; # Reports per category my $per_category = $c->model('DB::Problem')->search( \%params, { @@ -1201,7 +1155,7 @@ sub admin_stats { reports_total => $total, reports_solved => $solved, reports_spam => $hidden, - reports_assigned => $closed, + reports_assigned => $external, reports_moderated => $moderated, reports_dealtwith => $fixed_in_time, reports_category_changed => $changed, @@ -1321,4 +1275,38 @@ sub singleton_bodies_str { 1 } sub contact_extra_fields { [ 'abbreviation' ] }; +sub db_state_migration { + my $rs = FixMyStreet::DB->resultset('State'); + + # Create new states needed + $rs->create({ label => 'submitted', type => 'open', name => 'Erfasst' }); + $rs->create({ label => 'feedback pending', type => 'open', name => 'Rückmeldung ausstehend' }); + $rs->create({ label => 'wish', type => 'closed', name => 'Wunsch' }); + $rs->create({ label => 'external', type => 'closed', name => 'Extern' }); + $rs->create({ label => 'jurisdiction unknown', type => 'closed', name => 'Zuständigkeit unbekannt' }); + $rs->create({ label => 'not contactable', type => 'closed', name => 'Nicht kontaktierbar' }); + + # And update used current ones to have correct name + $rs->find({ label => 'in progress' })->update({ name => 'In Bearbeitung' }); + $rs->find({ label => 'fixed' })->update({ name => 'Beantwortet' }); + + # Move reports to correct new state + my %state_move = ( + unconfirmed => 'submitted', + closed => 'external', + investigating => 'wish', + 'unable to fix' => 'jurisdiction unknown', + planned => 'feedback pending', + partial => 'not contactable', + ); + foreach (keys %state_move) { + FixMyStreet::DB->resultset('Problem')->search({ state => $_ })->update({ state => $state_move{$_} }); + } + + # Delete unused standard states from the database + for ('action scheduled', 'duplicate', 'not responsible', 'internal referral', 'planned', 'investigating', 'unable to fix') { + $rs->find({ label => $_ })->delete; + } +} + 1; diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index c73f7efca..2deeb3084 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -341,7 +341,7 @@ around service => sub { sub title_safe { my $self = shift; - return _('Awaiting moderation') if $self->cobrand eq 'zurich' && $self->state eq 'unconfirmed'; + return _('Awaiting moderation') if $self->cobrand eq 'zurich' && $self->state eq 'submitted'; return $self->title; } @@ -509,6 +509,18 @@ sub tokenised_url { return "/M/". $token->token; } +=head2 is_hidden + +Returns 1 if the problem is in an hidden state otherwise 0. + +=cut + +sub is_hidden { + my $self = shift; + + return exists $self->hidden_states->{ $self->state } ? 1 : 0; +} + =head2 is_open Returns 1 if the problem is in a open state otherwise 0. diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 458efa179..ebc6e6c1b 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -118,8 +118,8 @@ sub _recent { my $key = $photos ? 'recent_photos' : 'recent'; $key .= ":$site_key:$num"; - # unconfirmed might be returned for e.g. Zurich, but would mean in moderation, so no photo - my @states = grep { $_ ne 'unconfirmed' } FixMyStreet::DB::Result::Problem->visible_states(); + # submitted might be returned for e.g. Zurich, but would mean in moderation, so no photo + my @states = grep { $_ ne 'submitted' } FixMyStreet::DB::Result::Problem->visible_states(); my $query = { non_public => 0, state => \@states, diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm index be3c4c69a..aa6b64752 100644 --- a/perllib/FixMyStreet/Script/Reports.pm +++ b/perllib/FixMyStreet/Script/Reports.pm @@ -29,7 +29,7 @@ sub send(;$) { my $site = $site_override || CronFns::site($base_url); my $states = [ FixMyStreet::DB::Result::Problem::open_states() ]; - $states = [ 'unconfirmed', 'confirmed', 'in progress', 'planned', 'closed', 'investigating' ] if $site eq 'zurich'; + $states = [ 'submitted', 'confirmed', 'in progress', 'feedback pending', 'external', 'wish' ] if $site eq 'zurich'; my $unsent = $rs->search( { state => $states, whensent => undef, diff --git a/perllib/FixMyStreet/SendReport/Zurich.pm b/perllib/FixMyStreet/SendReport/Zurich.pm index b38981d94..59adfd688 100644 --- a/perllib/FixMyStreet/SendReport/Zurich.pm +++ b/perllib/FixMyStreet/SendReport/Zurich.pm @@ -44,15 +44,15 @@ sub get_template { my ( $self, $row ) = @_; my $template; - if ( $row->state eq 'unconfirmed' || $row->state eq 'confirmed' ) { + if ( $row->state eq 'submitted' || $row->state eq 'confirmed' ) { $template = 'submit.txt'; } elsif ( $row->state eq 'in progress' ) { $template = 'submit-in-progress.txt'; - } elsif ( $row->state eq 'planned' ) { + } elsif ( $row->state eq 'feedback pending' ) { $template = 'submit-feedback-pending.txt'; - } elsif ( $row->state eq 'investigating' ) { + } elsif ( $row->state eq 'wish' ) { $template = 'submit-external-wish.txt'; - } elsif ( $row->state eq 'closed' ) { + } elsif ( $row->state eq 'external' ) { $template = 'submit-external.txt'; if ( $row->extra->{third_personal} ) { $template = 'submit-external-personal.txt'; diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t index f0913fbd2..605371ed7 100644 --- a/t/app/controller/report_display.t +++ b/t/app/controller/report_display.t @@ -419,106 +419,6 @@ for my $test ( }; } -subtest "Zurich unconfirmeds are 200" => sub { - FixMyStreet::override_config { - ALLOWED_COBRANDS => [ 'zurich' ], - MAP_TYPE => 'Zurich,OSM', - }, sub { - $mech->host( 'zurich.example.com' ); - ok $report->update( { state => 'unconfirmed' } ), 'unconfirm report'; - $mech->get_ok("/report/$report_id"); - $mech->content_contains( 'Überprüfung ausstehend' ); - ok $report->update( { state => 'confirmed' } ), 'confirm report again'; - $mech->host( 'www.fixmystreet.com' ); - }; -}; - -subtest "Zurich banners are displayed correctly" => sub { - FixMyStreet::override_config { - ALLOWED_COBRANDS => [ 'zurich' ], - MAP_TYPE => 'Zurich,OSM', - }, sub { - $mech->host( 'zurich.example.com' ); - - for my $test ( - { - description => 'new report', - state => 'unconfirmed', - banner_id => 'closed', - banner_text => 'Erfasst' - }, - { - description => 'confirmed report', - state => 'confirmed', - banner_id => 'closed', - banner_text => 'Aufgenommen', - }, - { - description => 'fixed report', - state => 'fixed - council', - banner_id => 'fixed', - banner_text => 'Beantwortet', - }, - { - description => 'closed report', - state => 'closed', - banner_id => 'closed', - banner_text => _('Extern'), - }, - { - description => 'in progress report', - state => 'in progress', - banner_id => 'progress', - banner_text => 'In Bearbeitung', - }, - { - description => 'planned report', - state => 'planned', - banner_id => 'progress', - banner_text => 'In Bearbeitung', - }, - { - description => 'planned report', - state => 'planned', - banner_id => 'progress', - banner_text => 'In Bearbeitung', - }, - { - description => 'jurisdiction unknown', - state => 'unable to fix', - banner_id => 'fixed', - # We can't use _('Jurisdiction Unknown') here because - # TestMech::extract_problem_banner decodes the HTML entities before - # the string is passed back. - banner_text => 'Zust\x{e4}ndigkeit unbekannt', - }, - ) { - subtest "banner for $test->{description}" => sub { - $report->state( $test->{state} ); - $report->update; - - $mech->get_ok("/report/$report_id"); - is $mech->uri->path, "/report/$report_id", "at /report/$report_id"; - my $banner = $mech->extract_problem_banner; - if ( $banner->{text} ) { - $banner->{text} =~ s/^ //g; - $banner->{text} =~ s/ $//g; - } - - is $banner->{id}, $test->{banner_id}, 'banner id'; - if ($test->{banner_text}) { - like_string( $banner->{text}, qr/$test->{banner_text}/i, 'banner text is ' . $test->{banner_text} ); - } else { - is $banner->{text}, $test->{banner_text}, 'banner text'; - } - - }; - } - - $mech->host( 'www.fixmystreet.com' ); - }; -}; - my $oxfordshire = $mech->create_body_ok(2237, 'Oxfordshire County Council'); my $oxfordshireuser = $mech->create_user_ok('counciluser@example.com', name => 'Council User', from_body => $oxfordshire); diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index 3ad107b04..f5c6b1145 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -23,6 +23,7 @@ my $mech = FixMyStreet::TestMech->new; use FixMyStreet; my $cobrand = FixMyStreet::Cobrand::Zurich->new(); +$cobrand->db_state_migration; my $sample_file = path(__FILE__)->parent->parent->child("app/controller/sample.jpg"); ok $sample_file->exists, "sample file $sample_file exists"; @@ -48,7 +49,7 @@ sub reset_report_state { $report->unset_extra_metadata('closed_overdue'); $report->unset_extra_metadata('closure_status'); $report->whensent(undef); - $report->state('unconfirmed'); + $report->state('submitted'); $report->created($created) if $created; $report->update; } @@ -109,7 +110,7 @@ subtest "set up superuser" => sub { }; my @reports = $mech->create_problems_for_body( 1, $division->id, 'Test', { - state => 'unconfirmed', + state => 'submitted', confirmed => undef, cobrand => 'zurich', areas => ',423017,', @@ -125,6 +126,80 @@ FixMyStreet::override_config { $mech->content_contains('Überprüfung ausstehend') or die $mech->content; +subtest "Banners are displayed correctly" => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'zurich' ], + MAP_TYPE => 'Zurich,OSM', + }, sub { + for my $test ( + { + description => 'new report', + state => 'submitted', + banner_id => 'closed', + banner_text => 'Erfasst' + }, + { + description => 'confirmed report', + state => 'confirmed', + banner_id => 'closed', + banner_text => 'Aufgenommen', + }, + { + description => 'fixed report', + state => 'fixed - council', + banner_id => 'fixed', + banner_text => 'Beantwortet', + }, + { + description => 'closed report', + state => 'external', + banner_id => 'closed', + banner_text => 'Extern', + }, + { + description => 'in progress report', + state => 'in progress', + banner_id => 'progress', + banner_text => 'In Bearbeitung', + }, + { + description => 'planned report', + state => 'feedback pending', + banner_id => 'progress', + banner_text => 'In Bearbeitung', + }, + { + description => 'jurisdiction unknown', + state => 'jurisdiction unknown', + banner_id => 'fixed', + banner_text => 'Zust\x{e4}ndigkeit unbekannt', + }, + ) { + subtest "banner for $test->{description}" => sub { + $report->state( $test->{state} ); + $report->update; + + $mech->get_ok("/report/" . $report->id); + is $mech->uri->path, "/report/" . $report->id, "at /report/" . $report->id; + my $banner = $mech->extract_problem_banner; + if ( $banner->{text} ) { + $banner->{text} =~ s/^ //g; + $banner->{text} =~ s/ $//g; + } + + is $banner->{id}, $test->{banner_id}, 'banner id'; + if ($test->{banner_text}) { + like_string( $banner->{text}, qr/$test->{banner_text}/i, 'banner text is ' . $test->{banner_text} ); + } else { + is $banner->{text}, $test->{banner_text}, 'banner text'; + } + + }; + } + $report->update({ state => 'submitted' }); + }; +}; + # Check logging in to deal with this report FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'zurich' ], @@ -158,7 +233,7 @@ subtest "changing of categories" => sub { ); } - # full Categories dropdown is hidden for unconfirmed reports + # full Categories dropdown is hidden for submitted reports $report->update({ state => 'confirmed' }); # put report into known category @@ -274,7 +349,7 @@ subtest "report_edit" => sub { $report->discard_changes; is ( $report->get_extra_metadata('moderated_overdue'), 0, 'Still marked moderated_overdue' ); is ( $report->get_extra_metadata('closed_overdue'), undef, "Marking hidden doesn't set closed_overdue..." ); - is ( $report->state, 'planned', 'Marking hidden actually sets state to planned'); + is ( $report->state, 'feedback pending', 'Marking hidden actually sets state to feedback pending'); is ( $report->get_extra_metadata('closure_status'), 'hidden', 'Marking hidden sets closure_status to hidden'); is get_moderated_count(), 1, 'Check still counted moderated' or diag $report->get_column('extra'); @@ -429,7 +504,7 @@ subtest 'SDM' => sub { $mech->clear_emails_ok; $report->discard_changes; - is $report->state, 'planned', 'Report now in planned state'; + is $report->state, 'feedback pending', 'Report now in feedback pending state'; subtest 'send_back' => sub { FixMyStreet::override_config { @@ -454,8 +529,8 @@ subtest 'SDM' => sub { $mech->get_ok( '/admin/report_edit/' . $report->id ); $mech->submit_form_ok( { button => 'not_contactable', form_number => 2 } ); $report->discard_changes; - is $report->state, 'planned', 'Report sent back to Rueckmeldung ausstehend state'; - is $report->get_extra_metadata('closure_status'), 'partial', 'Report sent back to partial (not_contactable) state'; + is $report->state, 'feedback pending', 'Report sent back to Rueckmeldung ausstehend state'; + is $report->get_extra_metadata('closure_status'), 'not contactable', 'Report sent back to not_contactable state'; is $report->bodies_str, $division->id, 'Report sent back to division'; }; }; @@ -471,7 +546,7 @@ FixMyStreet::override_config { }; reset_report_state($report); -$report->update({ state => 'planned' }); +$report->update({ state => 'feedback pending' }); $mech->content_contains( 'report_edit/' . $report->id ); $mech->content_contains( DateTime->now->strftime("%d.%m.%Y") ); @@ -506,9 +581,9 @@ like $email->header('From'), qr/do-not-reply\@example.org/, 'from line looks cor like $email->body, qr/FINAL UPDATE/, 'body looks correct'; $mech->clear_emails_ok; -# Assign planned (via confirmed), don't confirm email +# Assign feedback pending (via confirmed), don't confirm email @reports = $mech->create_problems_for_body( 1, $division->id, 'Second', { - state => 'unconfirmed', + state => 'submitted', confirmed => undef, cobrand => 'zurich', areas => ',423017,', @@ -522,7 +597,7 @@ FixMyStreet::override_config { $mech->get_ok( '/admin/report_edit/' . $report->id ); $mech->submit_form_ok( { with_fields => { state => 'confirmed' } } ); $mech->get_ok( '/admin/report_edit/' . $report->id ); - $mech->submit_form_ok( { with_fields => { state => 'planned' } } ); + $mech->submit_form_ok( { with_fields => { state => 'feedback pending' } } ); $mech->get_ok( '/report/' . $report->id ); }; $mech->content_contains('In Bearbeitung'); @@ -549,7 +624,7 @@ $mech->email_count_is(0); # Report assigned to third party @reports = $mech->create_problems_for_body( 1, $division->id, 'Third', { - state => 'unconfirmed', + state => 'submitted', confirmed => undef, cobrand => 'zurich', areas => ',423017,', @@ -564,8 +639,8 @@ subtest "external report triggers email" => sub { }, sub { # required to see body_external field - $report->state('planned'); - $report->set_extra_metadata('closure_status' => 'closed'); + $report->state('feedback pending'); + $report->set_extra_metadata('closure_status' => 'external'); # Set the public_response manually here because the default one will have line breaks that get escaped as HTML, causing the comparison to fail. $report->set_extra_metadata('public_response' => 'Freundliche Gruesse Ihre Stadt Zuerich'); $report->update; @@ -581,7 +656,7 @@ subtest "external report triggers email" => sub { $report->discard_changes; $mech->get_ok( '/report/' . $report->id ); }; - is ($report->state, 'closed', 'Report was closed correctly'); + is ($report->state, 'external', 'Report was closed correctly'); $mech->content_contains('Extern') or die $mech->content; $mech->content_contains('Third Test'); @@ -602,8 +677,8 @@ subtest "external report triggers email" => sub { }, sub { $mech->get_ok( '/admin' ); # required to see body_external field - $report->state('planned'); - $report->set_extra_metadata('closure_status' => 'closed'); + $report->state('feedback pending'); + $report->set_extra_metadata('closure_status' => 'external'); $report->set_extra_metadata('public_response' => 'Freundliche Gruesse Ihre Stadt Zuerich'); $report->update; @@ -638,10 +713,10 @@ subtest "external report triggers email" => sub { }, sub { # set as wish $report->discard_changes; - $report->state('planned'); - $report->set_extra_metadata('closure_status' => 'investigating'); + $report->state('feedback pending'); + $report->set_extra_metadata('closure_status' => 'wish'); $report->update; - is ($report->state, 'planned', 'Sanity check') or die; + is ($report->state, 'feedback pending', 'Sanity check') or die; $mech->get_ok( '/admin/report_edit/' . $report->id ); @@ -674,12 +749,12 @@ subtest "external report triggers email" => sub { }, sub { # set as extern reset_report_state($report); - $report->state('planned'); - $report->set_extra_metadata('closure_status' => 'closed'); + $report->state('feedback pending'); + $report->set_extra_metadata('closure_status' => 'external'); $report->set_extra_metadata('email_confirmed' => 1); $report->unset_extra_metadata('public_response'); $report->update; - is ($report->state, 'planned', 'Sanity check') or die; + is ($report->state, 'feedback pending', 'Sanity check') or die; $mech->get_ok( '/admin/report_edit/' . $report->id ); @@ -881,7 +956,7 @@ subtest "test admin_log" => sub { # XXX: following is dependent on all of test up till now, rewrite to explicitly # test which things need to be logged! is scalar @entries, 4, 'State changes logged'; - is $entries[-1]->action, 'state change to closed', 'State change logged as expected'; + is $entries[-1]->action, 'state change to external', 'State change logged as expected'; }; subtest 'email images to external partners' => sub { @@ -901,7 +976,7 @@ subtest 'email images to external partners' => sub { # The below email comparison must not have an external message. $report->unset_extra_metadata('external_message'); $report->update({ - state => 'closed', + state => 'external', photo => $fileid, external_body => $external_body->id, }); @@ -953,9 +1028,9 @@ subtest 'Status update shown as appropriate' => sub { }, sub { # ALL closed states must hide the public_response edit, and public ones # must show the answer in blue. - for (['planned', 1, 0, 0], + for (['feedback pending', 1, 0, 0], ['fixed - council', 0, 1, 0], - ['closed', 0, 1, 0], + ['external', 0, 1, 0], ['hidden', 0, 0, 1]) { my ($state, $update, $public, $user_response) = @$_; diff --git a/templates/web/zurich/admin/header.html b/templates/web/zurich/admin/header.html index 40847f190..91ac24faa 100644 --- a/templates/web/zurich/admin/header.html +++ b/templates/web/zurich/admin/header.html @@ -1,20 +1,6 @@ [% SET bodyclass = bodyclass || 'fullwidthpage'; INCLUDE 'header.html' admin = 1, bodyclass = bodyclass _ ' admin'; - - states = { - 'unconfirmed' = loc('Submitted'), - 'confirmed' = loc('Open'), - 'in progress' = loc('In progress'), - 'planned' = loc('Planned'), - 'fixed - council' = loc('Closed'), - 'hidden' = loc('Hidden'), - 'closed' = loc('Extern'), - 'partial' = loc('Not contactable'), - 'investigating' = loc('Wish'), - 'unable to fix' = loc('Jurisdiction unknown'), - 'fixed - council' = loc('Closed'), - } %] <style type="text/css"> .adminhidden { color: #666666; } diff --git a/templates/web/zurich/admin/index-dm.html b/templates/web/zurich/admin/index-dm.html index e0b62d5d2..4d77cf264 100644 --- a/templates/web/zurich/admin/index-dm.html +++ b/templates/web/zurich/admin/index-dm.html @@ -4,10 +4,10 @@ [% status_message %] <h2 id="submitted">[% loc('Submitted') %]</h2> -[% INCLUDE list, problems = unconfirmed.all, hash = 'submitted' %] +[% INCLUDE list, problems = submitted.all, hash = 'submitted' %] -<h2 id="planned">[% loc('Planned') %]</h2> -[% INCLUDE list, problems = approval.all, hash = 'planned' %] +<h2 id="feedback_pending">Rückmeldung ausstehend</h2> +[% INCLUDE list, problems = approval.all, hash = 'feedback_pending' %] <h2 id="alle">[% loc('All reports') %]</h2> [% INCLUDE list, problems = other.all, include_subdiv = 1, hash = 'alle' %] diff --git a/templates/web/zurich/admin/index.html b/templates/web/zurich/admin/index.html index fb3609bb3..62cd1a52c 100644 --- a/templates/web/zurich/admin/index.html +++ b/templates/web/zurich/admin/index.html @@ -9,8 +9,7 @@ <h2>[% loc('Problem breakdown by state') %]</h2> <ul> [% FOREACH state IN problems.keys.sort %] - [% NEXT IF NOT states.$state %] - <li>[% problems.$state %] [% states.$state %]</li> + <li>[% problems.$state %] [% prettify_state(state) %]</li> [% END %] </ul> diff --git a/templates/web/zurich/admin/problem_row.html b/templates/web/zurich/admin/problem_row.html index a83e22b27..973d9f651 100644 --- a/templates/web/zurich/admin/problem_row.html +++ b/templates/web/zurich/admin/problem_row.html @@ -18,9 +18,10 @@ <td>[% PROCESS value_or_nbsp value=problem.category_display %]</td> <td>[% PROCESS format_date this_date=problem.created %]</td> <td>[% PROCESS format_date this_date=problem.lastupdate %]</td> - <td> [% states.${problem.state} %][% IF problem.state == 'planned'; + <td>[% prettify_state(problem.state) %] + [% IF problem.state == 'feedback pending'; SET cs=problem.get_extra_metadata('closure_status'); - IF cs %] ([% states.$cs %]) [% END; END %]</td> + IF cs %] ([% prettify_state(cs) %]) [% END; END %]</td> [% IF include_subdiv %] <td> diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html index 2cbc262ae..d07629d01 100644 --- a/templates/web/zurich/admin/report_edit-sdm.html +++ b/templates/web/zurich/admin/report_edit-sdm.html @@ -73,7 +73,7 @@ <dd>[% problem.category_display | html %]</dd> <dt class="print-only">[% loc('State:') %] <!-- Status --></dt> - <dd class="print-only">[% states.${problem.state} %]</dd> + <dd class="print-only">[% prettify_state(problem.state) %]</dd> <dt>[% loc('Time spent (in minutes):') %]</dt> <dd>[% problem.get_time_spent %]</dd> diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html index 79d04d36b..ad14b2d45 100644 --- a/templates/web/zurich/admin/report_edit.html +++ b/templates/web/zurich/admin/report_edit.html @@ -27,7 +27,7 @@ <dd class="screen-only">» <a href="http://webgis.intra.stzh.ch/stapo/GoogleStreetView.asp?lat=[% problem.latitude %]&lon=[% problem.longitude %]" target="_blank">[% loc('Street View') %]</a></dd> - [% IF c.cobrand.problem_is_closed(problem) %] + [% IF problem.is_fixed || problem.is_closed || problem.is_hidden %] <dt><span class="mock-label">[% loc('Details:') %]</span></dt> <dd>[% problem.detail | html %]</dd> [% IF problem.extra.original_detail %] @@ -101,7 +101,7 @@ <dd>[% problem.category_display | html %]</dd> <dt class="print-only">[% loc('State:') %] <!-- Status --></dt> - <dd class="print-only">[% states_trans.${problem.state} %]</dd> + <dd class="print-only">[% prettify_state(problem.state) %]</dd> <dt>[% loc('Time spent (in minutes):') %]</dt> <dd>[% problem.get_time_spent %]</dd> @@ -154,7 +154,8 @@ <select class="form-control" name="state" id="state" data-pstate="[% pstate %]"> <option value="">--</option> [% FOREACH s IN states %] - <option [% 'selected ' IF s.state == pstate %] value="[% s.state %]">[% s.trans %]</option> + <option [% 'selected ' IF s.state == pstate %] value="[% s.state %]"> + [% IF s.trans; s.trans; ELSE; prettify_state(s.state); END %]</option> [% END %] </select> </dd> @@ -196,15 +197,15 @@ </ul> -[% IF problem.state == 'planned' %] +[% IF problem.state == 'feedback pending' %] [%# 3rd party messages sent for Extern/Wunsch states %] [% SWITCH pstate %] - [% CASE ['closed','investigating'] %] + [% CASE ['external','wish'] %] <ul class="no-bullets screen-only"> <li class="assignation" id="assignation__external"> <span class="error hidden">[% loc('Please select a body.') %]</span> <label for="body_external"> - [% IF pstate == 'closed' %] + [% IF pstate == 'external' %] [% loc('Assign to external body:') %] [% ELSE %] [% loc('Assign to competent body:') %] @@ -219,7 +220,7 @@ </select> </li> <li> - [% IF pstate == 'closed' %] + [% IF pstate == 'external' %] <input type="checkbox" name="third_personal" id="third_personal" value="1"[% ' checked' IF problem.extra.third_personal %]> <label for="third_personal" class="inline">[% loc('Include reporter personal details') %]</label> [% END %] @@ -272,9 +273,9 @@ [% END %] [% SWITCH problem.state %] - [% CASE ['closed','investigating'] %] + [% CASE ['external','wish'] %] <h2> - [% IF problem.state == 'closed' %] + [% IF problem.state == 'external' %] [% loc('Message to external body:') %] [% ELSE %] [% loc('Message to competent body:') %] diff --git a/templates/web/zurich/report/_item.html b/templates/web/zurich/report/_item.html index ccae84271..f20b2021d 100644 --- a/templates/web/zurich/report/_item.html +++ b/templates/web/zurich/report/_item.html @@ -1,11 +1,11 @@ <li class="item-list__item item-list--reports__item"> <a href="[% c.uri_for('/report', problem.id ) %]"> [% photo_to_display = c.cobrand.allow_photo_display(problem) %] - [% IF problem.state != 'unconfirmed' AND problem.photo AND photo_to_display %] + [% IF problem.state != 'submitted' AND problem.photo AND photo_to_display %] [% photo_idx = photo_to_display - 1 ~%] <img class="img" height="60" width="90" src="[% problem.photos.${photo_idx}.url_fp %]" alt=""> [% END %] - [% IF problem.state != 'unconfirmed' %] + [% IF problem.state != 'submitted' %] <h3 class="item-list__heading">[% problem.title | html %]</h3> [% ELSE %] <h3 class="item-list__heading"><em>[% loc('Awaiting moderation') %]</em></h3> diff --git a/templates/web/zurich/report/_main.html b/templates/web/zurich/report/_main.html index 912e8b0c9..c9225b4aa 100644 --- a/templates/web/zurich/report/_main.html +++ b/templates/web/zurich/report/_main.html @@ -5,7 +5,7 @@ [%- IF !problem.used_map %]<br>[% loc('there is no pin shown as the user did not use the map') %][% END %] </p> - [% IF problem.state != 'unconfirmed' %] + [% IF problem.state != 'submitted' %] [% INCLUDE 'report/photo.html' object=problem %] [% problem.detail | add_links | html_para %] [% ELSE %] diff --git a/web/cobrands/zurich/js.js b/web/cobrands/zurich/js.js index d2909bb6d..8b30436d5 100644 --- a/web/cobrands/zurich/js.js +++ b/web/cobrands/zurich/js.js @@ -77,7 +77,7 @@ $(function() { $('#assignation__category').show(); $('#assignation__subdivision').show(); } - if ((state === 'closed') || (state === 'investigating')) { + if ((state === 'external') || (state === 'wish')) { $('#assignation__external').show(); } else { $('#assignation__external').hide(); |