pie code made functional and relevant distance code updated

This commit is contained in:
Finn 2017-12-15 14:59:38 +00:00
parent c4b7fa5102
commit 88aa5becff
4 changed files with 60 additions and 11 deletions

View file

@ -92,6 +92,11 @@ sub update {
return $c->redirect_to( '/admin/users/' . $id );
}
my $location = $c->get_location_from_postcode(
$validation->param('postcode'),
$user->type,
);
if ( $user->type eq 'customer' ){
try {
@ -100,6 +105,7 @@ sub update {
full_name => $validation->param('full_name'),
display_name => $validation->param('display_name'),
postcode => $validation->param('postcode'),
( defined $location ? ( %$location ) : ( latitude => undef, longitude => undef ) ),
});
$user->update({
email => $validation->param('email'),
@ -125,6 +131,7 @@ sub update {
town => $validation->param('town'),
sector => $validation->param('sector'),
postcode => $validation->param('postcode'),
( defined $location ? ( %$location ) : ( latitude => undef, longitude => undef ) ),
});
$user->update({
email => $validation->param('email'),