From 0c5908e722a757ae86222df920cf0ceaf2bb6217 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 4 Aug 2024 08:49:57 +0200 Subject: manual journey entry: hardcode DB (HAFAS) for station selection TODO: Add a dropdown to select different backends Closes #150 --- lib/Travelynx/Controller/Traveling.pm | 5 +++-- lib/Travelynx/Model/Journeys.pm | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 7fbde79..3151d42 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -2114,8 +2114,9 @@ sub add_journey_form { my $db = $self->pg->db; my $tx = $db->begin; - $opt{db} = $db; - $opt{uid} = $self->current_user->{id}; + $opt{db} = $db; + $opt{uid} = $self->current_user->{id}; + $opt{backend_id} = 1; my ( $journey_id, $error ) = $self->journeys->add(%opt); diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm index e47df58..00f79b3 100755 --- a/lib/Travelynx/Model/Journeys.pm +++ b/lib/Travelynx/Model/Journeys.pm @@ -118,8 +118,10 @@ sub add { my $db = $opt{db}; my $uid = $opt{uid}; my $now = DateTime->now( time_zone => 'Europe/Berlin' ); - my $dep_station = $self->{stations}->search( $opt{dep_station} ); - my $arr_station = $self->{stations}->search( $opt{arr_station} ); + my $dep_station = $self->{stations} + ->search( $opt{dep_station}, backend_id => $opt{backend_id} ); + my $arr_station = $self->{stations} + ->search( $opt{arr_station}, backend_id => $opt{backend_id} ); if ( not $dep_station ) { return ( undef, 'Unbekannter Startbahnhof' ); -- cgit v1.2.3