Service-Config refactoring

This commit is contained in:
ragu 2022-05-09 12:45:01 +02:00
parent 0f89b9e836
commit 0163c06893
15 changed files with 149 additions and 107 deletions

View file

@ -876,15 +876,12 @@ sub booking_request(){
my $sig_book = shift || {};
my $dbh = "";
my $bike_id = "";
$bike_id = $1 if($bike_id =~ /(\d+)$/);
my $pos_id="";
my $now_dt = strftime "%Y-%m-%d %H:%M", localtime;
my $response_state = "OK";
my $response_text = "";
$bw->log("booking_request ct_bike $ct_bike->{barcode}, auth $auth->{c_id}, tarif $ct_tariff->{barcode}, requested bike:",$bike,"");
$bw->log("booking_request bike $bike, auth $auth->{c_id}, tarif $ct_tariff->{barcode}, requested bike:",$bike,"");
my $update_adr = {
table => "contentadr",
@ -904,14 +901,6 @@ sub booking_request(){
close_time => "is::null",
};
my $booking_pos = {
table => "contenttranspos",
fetch => "one",
barcode => "$bike_id",
int10 => "IN::('2','3')",
ca_id => "$auth->{c_id}",
};
#if bike and tariff
if($ct_bike->{barcode} && $ct_tariff->{barcode}){
@ -1020,6 +1009,7 @@ sub booking_update(){
$bike_id =~ s/S[1-9]X/SX/;
$bike_id = $1 if($bike_id =~ /(\d+)/);
my $state_key = 0;
my $state_text = "";
while (my ($key, $value) = each %{ $dbt->{copri_conf}->{bike_state} }) {
@ -1064,6 +1054,7 @@ sub booking_update(){
my $record_cc = $dbt->fetch_record($dbh,$pref_cc) if($q->param('bike'));
$bw->log("booking_update bike to state $bike $state ($state_key) $lock_state, auth $auth->{c_id}, bike:",$bike,"");
my $update_cc = {
table => "content",
@ -1108,7 +1099,8 @@ sub booking_update(){
#2020-09-24 requested will be all done by net_booking
#6 = "canceled"|3 = "occupied"|1 = "available"
if($state && $state =~ /$dbt->{copri_conf}->{bike_state}->{6}|$dbt->{copri_conf}->{bike_state}->{3}|$dbt->{copri_conf}->{bike_state}->{1}/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
#if($state && $state =~ /$dbt->{copri_conf}->{bike_state}->{6}|$dbt->{copri_conf}->{bike_state}->{3}|$dbt->{copri_conf}->{bike_state}->{1}/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
if($state_key && ($state_key == 6 || $state_key == 3 || $state_key == 1) && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
#set rent state if lock_system 2=Ilockit || 3=sigo
if($record_pos->{int11} && ($record_pos->{int11} == 2 || $record_pos->{int11} == 3)){