diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-02-01 16:15:20 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-02-01 16:15:20 +0100 |
commit | eb3f4aed05d31509e0544ff29b382759ba31b9c2 (patch) | |
tree | fc863f10184cadba9504092881bfae420e93efd7 /lib/Travelynx/Controller/Traveling.pm | |
parent | 5439dbad343d9db39119cc0168b18bc9c58b195c (diff) |
allow checkin and checkout station to be edited
Diffstat (limited to 'lib/Travelynx/Controller/Traveling.pm')
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index e294c8c..b08864e 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -894,6 +894,17 @@ sub edit_journey { } } } + for my $key (qw(from_name to_name)) { + if ( defined $self->param($key) + and $self->param($key) ne $journey->{$key} ) + { + $error = $self->update_journey_part( $db, $journey->{id}, $key, + $self->param($key) ); + if ($error) { + last; + } + } + } for my $key (qw(comment)) { if ( defined $self->param($key) @@ -919,7 +930,7 @@ sub edit_journey { } } { - my $cancelled_old = $journey->{cancelled}; + my $cancelled_old = $journey->{cancelled} // 0; my $cancelled_new = $self->param('cancelled') // 0; if ( $cancelled_old != $cancelled_new ) { $error @@ -955,7 +966,9 @@ sub edit_journey { $self->param( route => join( "\n", map { $_->[0] } @{ $journey->{route} } ) ); - $self->param( cancelled => $journey->{cancelled} ); + $self->param( cancelled => $journey->{cancelled} ? 1 : 0 ); + $self->param( from_name => $journey->{from_name} ); + $self->param( to_name => $journey->{to_name} ); for my $key (qw(comment)) { if ( $journey->{user_data} and $journey->{user_data}{$key} ) { @@ -965,8 +978,9 @@ sub edit_journey { $self->render( 'edit_journey', - error => $error, - journey => $journey + with_autocomplete => 1, + error => $error, + journey => $journey ); } |