bike_group rental end and maps

This commit is contained in:
ragu 2022-05-17 06:13:53 +02:00
parent 50b695117a
commit f09361320e
8 changed files with 131 additions and 55 deletions

View file

@ -1186,7 +1186,8 @@ sub booking_update(){
my $geo_distance_next = 100000;
my $station_next = 0;
my $geo_debug="";
my ($stations,$stations_raw) = $self->stations_available($q,$varenv,$auth);
my ($stations,$stations_raw) = $self->stations_available($q,$varenv,$auth,$record_pos);
foreach my $id (sort { $stations_raw->{$a}->{barcode} <=> $stations_raw->{$b}->{barcode} } keys (%$stations_raw)){
my $latitude_station = $1 if($stations_raw->{$id}->{txt06} =~ /^(\d+\.\d+)/);
my $longitude_station = $1 if($stations_raw->{$id}->{txt06} =~ /(\d+\.\d+)$/);
@ -1376,7 +1377,7 @@ sub booking_update(){
#geofencing for Ilockit
my $geo_distance_next = $geo_distance;
my $geo_debug="";
my ($stations,$stations_raw) = $self->stations_available($q,$varenv,$auth);
my ($stations,$stations_raw) = $self->stations_available($q,$varenv,$auth,$record_pos);
foreach my $id (sort { $stations_raw->{$a}->{barcode} <=> $stations_raw->{$b}->{barcode} } keys (%$stations_raw)){
my $latitude_station = $1 if($stations_raw->{$id}->{txt06} =~ /^(\d+\.\d+)/);
my $longitude_station = $1 if($stations_raw->{$id}->{txt06} =~ /(\d+\.\d+)$/);
@ -1935,6 +1936,12 @@ sub stations_available(){
my $q = shift || "";
my $varenv = shift;
my $auth = shift || "";
my $record_pos = shift || {};
my $station_group = "";
$station_group = $record_pos->{int12} if(ref($record_pos) eq "HASH" && $record_pos->{int12});
$bw->log("stations_available by station_group: $station_group",$record_pos,"");
my $authed = 0;
$authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id});
@ -1949,12 +1956,19 @@ sub stations_available(){
int10 => "1",#1 = "available"
};
#group_id must have 6 numbers like 300103
my $pref_sql = "";
$pref_sql .= " and (";
foreach(@{$bike_group}){
if($_ =~ /(\d+)/){
$pref_sql .= " ct.txt24 like '%$1%' OR";
if($station_group && $_ =~ /(\d+)/){
my $group_id = $1;
if($group_id == $station_group){
$pref_sql .= " ct.txt24 like '%$group_id%' OR";
}
}elsif($_ =~ /(\d+)/){
my $group_id = $1;
$pref_sql .= " ct.txt24 like '%$group_id%' OR";
}
}
$pref_sql =~ s/OR$//;
$pref_sql .= ")";