From 54547eb3affa06a203e687a7f4a8447e7dd5adf0 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 18 Aug 2023 20:42:37 +0200 Subject: manual station entry: HAFAS support --- lib/Travelynx/Controller/Traveling.pm | 12 +++++++++++- templates/landingpage.html.ep | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 0f6b64f..8f560a9 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -1095,7 +1095,17 @@ sub redirect_to_station { my ($self) = @_; my $station = $self->param('station'); - $self->redirect_to("/s/${station}"); + if ( my $s = $self->app->stations->search($station) ) { + if ( $s->{hafas} ) { + $self->redirect_to("/s/${station}?hafas=1"); + } + else { + $self->redirect_to("/s/${station}"); + } + } + else { + $self->redirect_to("/s/${station}?hafas=1"); + } } sub cancelled { diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep index bf2835e..42a46f2 100644 --- a/templates/landingpage.html.ep +++ b/templates/landingpage.html.ep @@ -61,7 +61,7 @@ %= form_for 'list_departures' => begin
%= text_field 'station', id => 'station', class => 'autocomplete contrast-color-text', autocomplete => 'off', required => undef - +