Skip to content

Commit

Permalink
[Kingston] Garden changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Feb 14, 2025
1 parent b79635f commit 26e69a2
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 139 deletions.
4 changes: 3 additions & 1 deletion perllib/FixMyStreet/App/Controller/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ has index_template => (

my %GARDEN_IDS = (
merton => { bin240 => 26, bin140 => 27, sack => 28 },
kingston => { bin240 => 26, bin140 => 27, sack => 28 },
kingston => { bin240 => 39, bin140 => 37, sack => 36 },
sutton => { bin240 => 39, bin140 => 37, sack => 36 },
);
lock_hash(%GARDEN_IDS);
Expand Down Expand Up @@ -1365,6 +1365,7 @@ sub process_garden_cancellation : Private {
$c->set_param($end_date_field, $now->dmy('/'));

my $service = $c->cobrand->garden_current_subscription;
# Not actually used by Kingston/Sutton
if (!$c->stash->{slwp_garden_sacks} || $service->{garden_container} == $GARDEN_IDS{$c->cobrand->moniker}{bin240} || $service->{garden_container} == $GARDEN_IDS{$c->cobrand->moniker}{bin140}) {
my $bin_count = $c->cobrand->get_current_garden_bins;
$data->{new_bins} = $bin_count * -1;
Expand Down Expand Up @@ -1459,6 +1460,7 @@ sub process_garden_modification : Private {
# Needs to check current subscription too
my $service = $c->cobrand->garden_current_subscription;
if ($c->stash->{slwp_garden_sacks} && $service->{garden_container} == $GARDEN_IDS{$c->cobrand->moniker}{sack}) { # SLWP Sack
# This must be Kingston
$data->{bins_wanted} = 1;
$data->{new_bins} = 1;
$payment = $c->cobrand->garden_waste_sacks_cost_pa();
Expand Down
1 change: 1 addition & 0 deletions perllib/FixMyStreet/App/Form/Waste/Garden/Sacks/Choice.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package FixMyStreet::App::Form::Waste::Garden::Sacks::Choice;
use utf8;
use HTML::FormHandler::Moose::Role;

# Used by Merton only, below, to default the container choice
use constant CONTAINER_GARDEN_BIN => 26;
use constant CONTAINER_GARDEN_BIN_140 => 27;
use constant CONTAINER_GARDEN_SACK => 28;
Expand Down
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/Roles/Cobrand/Echo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ sub bin_services_for_address {
$garden = 1;
$garden_due = $self->waste_sub_due($schedules->{end_date});
$garden_overdue = $schedules if $_->{expired};
my $data_obj = $self->moniker eq 'sutton' ? $_->{Service} : $servicetask;
my $data_obj = $self->moniker eq 'sutton' || $self->moniker eq 'kingston' ? $_->{Service} : $servicetask;
my $data = Integrations::Echo::force_arrayref($data_obj->{Data}, 'ExtensibleDatum');
foreach (@$data) {
next unless $_->{DatatypeName} eq $self->garden_echo_container_name;
Expand Down
221 changes: 87 additions & 134 deletions t/app/controller/waste_kingston.t

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions templates/email/default/waste/_garden_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
END;

IF cobrand.moniker == 'sutton'; SET sack_quant = 1;
ELSIF cobrand.moniker == 'kingston'; SET sack_quant = 1;
ELSE; SET sack_quant = quantity; END;

SET pro_rata = report.get_extra_field_value('pro_rata');
Expand Down
2 changes: 1 addition & 1 deletion templates/web/base/admin/reports/_edit_waste.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ <h2>Subscription information</h2>
</ul>
[% END %]

[% IF (c.cobrand.moniker == 'sutton') AND problem.get_extra_field_value('Paid_Container_Type') %]
[% IF (c.cobrand.moniker == 'sutton' || c.cobrand.moniker == 'kingston') AND problem.get_extra_field_value('Paid_Container_Type') %]
<h2>Subscription information</h2>
<ul>
[% INCLUDE show_fields fields=[
Expand Down
4 changes: 2 additions & 2 deletions templates/web/kingston/waste/garden/subscribe_confirm.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ <h2>What happens next?</h2>
</p>
-->

[% SET container = report.get_extra_field_value('Subscription_Details_Containers') %]
[% SET container = report.get_extra_field_value('Paid_Container_Type') %]
[% SET new_bins = report.get_extra_field_value('new_containers') %]
[% IF container == 28 %]
[% IF container == 4 %]
[% SET container_str = 'sacks' %]
[% ELSE %]
[% SET container_str = nget('bin', 'bins', new_bins) %]
Expand Down

0 comments on commit 26e69a2

Please sign in to comment.