fixing some file links and creating standard dirs. Moving Service-Tour setup to DMS-Account

This commit is contained in:
ragu 2023-04-24 14:49:30 +02:00
parent d6292aa09d
commit bf83052322
51 changed files with 1275 additions and 436 deletions

View file

@ -1256,7 +1256,10 @@ sub booking_update(){
$update_cc->{txt13} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}";
#return after booking_update
#in real, we know freed accountable rentals only on rental end's
$pri->count_freedrental($q,$varenv,$auth->{c_id},$record_pos);
my ($pricing,$counting) = $pri->counting_rental(\%varenv,$record_pos);
#int03 only used for tarif counting backwards compatibility
$update_pos->{int03} = "$pricing->{computed_hours}" if(looks_like_number($pricing->{computed_hours}));
$update_pos->{int38} = "$counting->{int38}" if(looks_like_number($counting->{int38}));
@ -1264,8 +1267,6 @@ sub booking_update(){
$update_pos->{int40} = "$counting->{int40}" if(looks_like_number($counting->{int40}));
$update_pos->{int41} = "$counting->{int41}" if(looks_like_number($counting->{int41}));
#in real, we know freed accountable rentals only on rental end's
$pri->count_freedrental($q,$varenv,$auth->{c_id},$update_pos);
$rows_end = $dbt->update_record($dbh,$update_pos,$record_pos);
if($rows_end > 0){
@ -1276,7 +1277,9 @@ sub booking_update(){
$geo_debug .= "Matching station: $stations_raw->{$id}->{barcode}|$gps_data->{latitude},$gps_data->{longitude},$latitude_station,$longitude_station --> $gps_data->{geo_distance} Meter\n";
last;
}else{
}
#out of geofence
else{
if($gps_data->{geo_distance} <= $geo_distance_next){
$geo_distance_next = $gps_data->{geo_distance};
$station_next = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}$stations_raw->{$id}->{int04}";
@ -1302,22 +1305,21 @@ sub booking_update(){
$rows_end = $dbt->update_record($dbh,$update_pos,$record_pos);
$geo_debug .= "Out of station distance: $stations_raw->{$id}->{int04}|$gps_data->{latitude},$gps_data->{longitude},$latitude_station,$longitude_station --> $geo_distance_next Meter ($geo_distance_next <= $gps_data->{geo_distance}) station_next: $station_next\n";
$booking_values->{response_state} = "Failure 2178: bike " . $q->param('bike') . " out of GEO fencing. $geo_distance_next meter distance to next station $station_next .";
$booking_values->{response_text} = "Achtung! Ihr aktueller Standort liegt außerhalb einer Fahrradstation. Die Miete Fahrrad Nr. " . $q->param('bike') . " kann nicht $state_text werden. $geo_distance_next Meter Entfernung zur nächsten Station $station_next . Falls Sie sich doch an einer Station befinden, dann wiederholen Sie \"Miete beenden\".";
$geo_debug .= "Out of station distance: $stations_raw->{$id}->{int04}|rows_end:$rows_end|$gps_data->{latitude},$gps_data->{longitude},$latitude_station,$longitude_station --> $geo_distance_next Meter ($geo_distance_next <= $gps_data->{geo_distance}) station_next: $station_next\n";
if($record_pos->{int42} == 1){
$booking_values->{response_state} = "Failure 2179: bike " . $q->param('bike') . " out of GEO fencing. $geo_distance_next meter distance to A-A station $station_next .";
$booking_values->{response_text} = "Achtung! Dieses Mietrad darf nur an der Station zurück gegeben werden an der es ausgeliehen wurde. Die Miete zu Rad " . $q->param('bike') . " kann nicht $state_text werden. $geo_distance_next Meter Entfernung zur A-A Station $station_next . Falls Sie sich doch an der Station befinden, dann wiederholen Sie \"Miete beenden\".";
}else{
$booking_values->{response_state} = "Failure 2178: bike " . $q->param('bike') . " out of GEO fencing. $geo_distance_next meter distance to next station $station_next .";
$booking_values->{response_text} = "Achtung! Ihr aktueller Standort liegt außerhalb einer für das Mietende freigegebenen Radstation. Die Miete zu Rad " . $q->param('bike') . " kann nicht $state_text werden. $geo_distance_next Meter Entfernung zur nächsten Station $station_next . Falls Sie sich doch an einer Station befinden, dann wiederholen Sie \"Miete beenden\".";
}
}
}else{
$geo_debug .= "ERROR no station GPS: $stations_raw->{$id}->{int04}|$gps_data->{latitude},$gps_data->{longitude},$latitude_station,$longitude_station --> $gps_data->{geo_distance} Meter\n";
}
}
#$geo_distance_next == 100000 defaults to if no station in stations_raw
if($record_pos->{int42} == 0 && !$rows_end && $geo_distance_next == 100000){
$geo_distance_next = "undefined";
$booking_values->{response_state} = "Failure 2244: this bike not accepted on A-A station, state change forbidden.";
$booking_values->{response_text} = "Ein Mietende mit diesem Rad ist an dieser Station nicht erlaubt, da es sich hier um eine sog. A-A Station handelt. An A-A Stationen dürfen nur Mieträder zurück gegeben werden die von dort gemietet wurden.";
}
$booking_values->{geo_distance} = "$geo_distance_next";
#print "$geo_debug\n";
$bw->log("GEOfencing geo_debug:$geo_debug",$q,"");
@ -2540,10 +2542,10 @@ sub fetch_tariff(){
#shareetool user_tour
if($auth_operator->{c_id} && $merchant_id && $dbt->{merchant_ids}->{$merchant_id}->{id} && $dbt->{merchant_ids}->{$merchant_id}->{id} == 187){
my $users_serviceapp = $dbt->select_users($dbh,$auth_operator->{c_id},"and int09=1");
if($users_serviceapp->{int09}){
$auth_operator->{txt18} =~ s/(\d+)/$dbt->{operator}->{$dbname}->{oprefix}$1/g;
@user_tour = ($auth_operator->{txt18});
@user_tour = split(/\s/,$auth_operator->{txt18}) if($auth_operator->{txt18} =~ /\s/);
if($users_serviceapp->{int09} && $users_serviceapp->{txt07}){
$users_serviceapp->{txt07} =~ s/(\d+)/$dbt->{operator}->{$dbname}->{oprefix}$1/g;
@user_tour = ($users_serviceapp->{txt07});
@user_tour = split(/\s/,$users_serviceapp->{txt07}) if($users_serviceapp->{txt07} =~ /\s/);
}
}#end user_tour
@ -2557,7 +2559,7 @@ sub fetch_tariff(){
}
#else select all available user tarif entries
$tariff_all = $dbt->fetch_record($dbh,$tariff);
$bw->log("$dbname Tariff type for operator registered user with Tarif $auth_operator->{txt30} by int18:$tariff->{int18} select 4:",$tariff_all,"");
$bw->log("$dbname Tariff type for operator registered user with Tarif in txt30:$auth_operator->{txt30} with s-type int18:$tariff->{int18} select 4:",$auth_operator->{txt30},"");
}
#end operators address
else{
@ -3065,7 +3067,6 @@ sub authorization(){
$pass_name =~ s/\s//g;
my $pwmd5=md5_hex($pass_name) || "";
my $pwsha256=sha256_base64($pwmd5) || "";
#$authref->{txt11} = "$pwmd5";
$authref->{txt04} = "$pwsha256";
#Servicetool, only users with users.int09=1