summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller/Traveling.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-12-08 19:46:45 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-12-08 19:46:45 +0100
commit315a94affedffda8ab4be62cebf2b62c3f5f0d78 (patch)
treef10f35f59aa35860ec9b67e1ba2754864de82d89 /lib/Travelynx/Controller/Traveling.pm
parent561ff4574bb6078ce4c9f72647a9c3d1a92cac6e (diff)
allow a journey's cancellation status to be edited1.11.1
Closes #27
Diffstat (limited to 'lib/Travelynx/Controller/Traveling.pm')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 7b48d28..6b8c766 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -752,6 +752,7 @@ sub edit_journey {
my $journey = $self->get_journey(
uid => $uid,
journey_id => $journey_id,
+ verbose => 1,
with_datetime => 1,
);
@@ -811,6 +812,15 @@ sub edit_journey {
[@route_new] );
}
}
+ {
+ my $cancelled_old = $journey->{cancelled};
+ my $cancelled_new = $self->param('cancelled') // 0;
+ if ( $cancelled_old != $cancelled_new ) {
+ $error
+ = $self->update_journey_part( $db, $journey->{id},
+ 'cancelled', $cancelled_new );
+ }
+ }
if ( not $error ) {
$journey = $self->get_journey(
@@ -839,6 +849,8 @@ sub edit_journey {
$self->param(
route => join( "\n", map { $_->[0] } @{ $journey->{route} } ) );
+ $self->param( cancelled => $journey->{cancelled} );
+
for my $key (qw(comment)) {
if ( $journey->{user_data} and $journey->{user_data}{$key} ) {
$self->param( $key => $journey->{user_data}{$key} );