-
-
Notifications
You must be signed in to change notification settings - Fork 272
[Brent] Adds container request form #5748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1228,6 +1228,9 @@ sub waste_munge_request_form_fields { | |
| next unless $key =~ /^container-(\d+)/; | ||
| my $id = $1; | ||
| my ($cost, $hint) = $self->request_cost($id); | ||
| if (!$hint) { | ||
| $hint = $id == $CONTAINER_IDS{rubbish_grey_bin} ? 'Chargeable - Subject to approval' : ''; | ||
| } | ||
| push @radio_options, { | ||
| value => $id, | ||
| label => $self->{c}->stash->{containers}->{$id}, | ||
|
|
@@ -1291,7 +1294,7 @@ sub waste_munge_request_data { | |
|
|
||
| my $c = $self->{c}; | ||
|
|
||
| for (qw(how_long_lived contamination_reports ordered_previously)) { | ||
| for (qw(how_long_lived contamination_reports ordered_previously property_people property_children)) { | ||
| $c->set_param("request_$_", $data->{$_} || ''); | ||
dracos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| if (request_referral($id, $data)) { | ||
|
|
@@ -1357,6 +1360,20 @@ sub request_referral { | |
| # return 1 if ($data->{contamination_reports} || 0) >= 3; # Will be present on missing only | ||
| return 1 if ($data->{how_long_lived} || '') eq '3more'; # Will be present on new build only | ||
| return 1 if $data->{ordered_previously}; | ||
|
|
||
| if ( | ||
| ( ($data->{'container-choice'} && $data->{'container-choice'} == $CONTAINER_IDS{rubbish_grey_bin}) | ||
| || $data->{'container-' . $CONTAINER_IDS{rubbish_grey_bin}} | ||
| ) | ||
| ) { | ||
| if ($data->{request_reason} eq 'extra') { | ||
| if ($data->{property_people} == 6 || $data->{property_children} eq 'Yes') { | ||
| return 1; | ||
| } | ||
| } else { | ||
| return 1; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| sub waste_request_form_first_title { 'Which container do you need?' } | ||
|
|
@@ -1366,7 +1383,26 @@ sub waste_request_form_first_next { | |
| return sub { | ||
| my $data = shift; | ||
| my $choice = $data->{"container-choice"}; | ||
| return 'request_refuse_call_us' if $choice == $CONTAINER_IDS{rubbish_grey_bin}; | ||
| if ($choice == $CONTAINER_IDS{rubbish_grey_bin}) { | ||
| my $date = DateTime->now()->subtract( weeks => 2 ); | ||
| my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d'); | ||
| my $c = $self->{c}; | ||
| $data->{refuse_outcome} = $c->cobrand->problems->search( | ||
| { | ||
| category => 'Request new container', | ||
| title => ['Request new General rubbish bin (grey bin)'], | ||
| confirmed => { '>=', $parser->format_datetime($date) }, | ||
| uprn => $c->stash->{property}{uprn}, | ||
| } | ||
| )->first; | ||
| }; | ||
| if ($data->{refuse_outcome}) { | ||
| if ($data->{refuse_outcome}->get_extra_field_value('request_referral')) { | ||
| $data->{refuse_outcome} = 'referral'; | ||
| } else { | ||
| $data->{refuse_outcome} = 'capacity'; | ||
| } | ||
| }; | ||
| return 'replacement'; | ||
| }; | ||
| } | ||
|
|
@@ -1493,6 +1529,26 @@ sub waste_garden_mod_params { | |
| } | ||
| } | ||
|
|
||
|
|
||
| sub waste_post_report_creation { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one hasn't been done, but don't think it really matters, happy to leave it here for now. |
||
| my ($self, $report, $data) = @_; | ||
|
|
||
| if ( | ||
| $report->title =~ /Request new General rubbish bin \(grey bin\)/ | ||
| && $data->{request_reason} eq 'extra' | ||
| ) { | ||
|
|
||
| if ($report->get_extra_field_value('request_referral')) { | ||
| $report->detail('Request forwarded to Brent Council by email'); | ||
| } else { | ||
| $self->{c}->stash->{brent_request_automatic} = 1; | ||
| $report->detail('Request automatically calculated'); | ||
| $report->state('fixed - council'); | ||
| } | ||
| $report->update; | ||
| } | ||
| }; | ||
|
|
||
| =item * Uses custom text for the title field for new reports. | ||
|
|
||
| =cut | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.