mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 11:46:27 +01:00
enhance booking_update logging
This commit is contained in:
parent
0857601751
commit
7dcf48db2c
3 changed files with 24 additions and 22 deletions
|
@ -1153,26 +1153,30 @@ sub booking_update(){
|
||||||
$gps_data->{longitude} = $1 if($longitude_in =~ /(\d+\.\d+)/);
|
$gps_data->{longitude} = $1 if($longitude_in =~ /(\d+\.\d+)/);
|
||||||
$gps_data->{gps} = "$gps_data->{latitude},$gps_data->{longitude}" if($gps_data->{latitude} && $gps_data->{longitude});
|
$gps_data->{gps} = "$gps_data->{latitude},$gps_data->{longitude}" if($gps_data->{latitude} && $gps_data->{longitude});
|
||||||
}
|
}
|
||||||
|
my $gps_age = 0;
|
||||||
|
$gps_age = $1 if($q->param('gps_age') && $q->param('gps_age') =~ /^(\d+)/);#in milisec
|
||||||
|
$gps_data->{gps_age_minutes} = $gps_age / 1000 / 60 if($gps_age);
|
||||||
|
$gps_data->{gps_accuracy} = $1 if($q->param('gps_accuracy') && $q->param('gps_accuracy') =~ /^(\d+)/);#in meters
|
||||||
|
|
||||||
my $update_pos = {
|
my $update_pos = {
|
||||||
table => "contenttranspos",
|
table => "contenttranspos",
|
||||||
mtime => "now()",
|
mtime => "now()",
|
||||||
};
|
};
|
||||||
|
my $lock_charge = $q->param('voltage') || "";
|
||||||
my $logging = "log booking_update bike:$bike, state:$state, lock_state:$lock_state, userID:$auth->{c_id}, gps:$gps_data->{gps}";
|
my $gps_age_minutes = "";
|
||||||
|
$gps_age_minutes = $gps_data->{gps_age_minutes} if($q->param('gps_age'));
|
||||||
|
my $logging = "log booking_update bike:$bike, userID:$auth->{c_id}, state:$state, lock_state:$lock_state, lock_charge:$lock_charge, gps:$gps_data->{gps}, gps_age_minutes:$gps_age_minutes";
|
||||||
$bw->log("$logging",$auth->{c_id},"");
|
$bw->log("$logging",$auth->{c_id},"");
|
||||||
$update_pos->{txt24} = $record_pos->{txt24} . "\n$logging";
|
my $log_stamp = strftime "%d.%m.%Y %H:%M:%S", localtime;
|
||||||
|
$update_pos->{txt24} = $record_pos->{txt24} . "\n- $log_stamp $logging";
|
||||||
|
$dbt->update_record($dbh,$update_pos,$record_pos);
|
||||||
|
|
||||||
my $Ilockit_GUID = "";
|
my $Ilockit_GUID = "";
|
||||||
$Ilockit_GUID = $q->escapeHTML($q->param('Ilockit_GUID')) if($q->param('Ilockit_GUID') && $q->param('Ilockit_GUID') =~ /\w+-\w+-\w+-\w+$/);
|
$Ilockit_GUID = $q->escapeHTML($q->param('Ilockit_GUID')) if($q->param('Ilockit_GUID') && $q->param('Ilockit_GUID') =~ /\w+-\w+-\w+-\w+$/);
|
||||||
#$update_pos->{txt17} = $Ilockit_GUID if($Ilockit_GUID);
|
#$update_pos->{txt17} = $Ilockit_GUID if($Ilockit_GUID);
|
||||||
$update_cc->{txt17} = $Ilockit_GUID if($Ilockit_GUID);
|
$update_cc->{txt17} = $Ilockit_GUID if($Ilockit_GUID);
|
||||||
|
|
||||||
my $gps_age = 0;
|
|
||||||
$gps_age = $1 if($q->param('gps_age') =~ /^(\d+)/);#in milisec
|
|
||||||
$gps_data->{gps_age_minutes} = $gps_age / 1000 / 60 if($gps_age);
|
|
||||||
$gps_data->{gps_accuracy} = $1 if($q->param('gps_accuracy') =~ /^(\d+)/);#in meters
|
|
||||||
|
|
||||||
#2022-10-02 manage lock_state before state
|
#2022-10-02 manage lock_state before state
|
||||||
if($lock_state && $lock_state =~ /locking|locked|unlocking|unlocked/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
|
if($lock_state && $lock_state =~ /locking|locked|unlocking|unlocked/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
|
||||||
$booking_values = $self->smartlock($q,$varenv,$auth,$owner,$record_pos,$record_cc,$gps_data,$booking_values);
|
$booking_values = $self->smartlock($q,$varenv,$auth,$owner,$record_pos,$record_cc,$gps_data,$booking_values);
|
||||||
|
@ -1183,7 +1187,7 @@ sub booking_update(){
|
||||||
};
|
};
|
||||||
$record_pos = $dbt->fetch_tablerecord($dbh,$booking_pos);
|
$record_pos = $dbt->fetch_tablerecord($dbh,$booking_pos);
|
||||||
my $if_gps = $gps_data->{gps} || "";
|
my $if_gps = $gps_data->{gps} || "";
|
||||||
$bw->log("smartlock lock_state $bike $lock_state | int10 $record_pos->{int10} | int20 $record_pos->{int20} | if_gps $if_gps",$booking_values,"");
|
$bw->log("log smartlock lock_state $bike $lock_state | int10 $record_pos->{int10} | int20 $record_pos->{int20} | if_gps $if_gps",$booking_values,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -388,7 +388,7 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
||||||
$response = {%$response, %$booking_values};
|
$response = {%$response, %$booking_values};
|
||||||
|
|
||||||
}
|
}
|
||||||
elsif($q->param('request') eq "booking_update" && (($q->param('state') && $q->param('state') =~ /occupied|available/) || ($q->param('lock_state') && $q->param('lock_state') =~ /locking|locked|unlocking|unlocked/))){
|
elsif($q->param('request') eq "booking_update" && (($q->param('state') && $q->param('state') =~ /occupied|available/) || $q->param('lock_state'))){
|
||||||
my $booking_values = {};
|
my $booking_values = {};
|
||||||
|
|
||||||
#update on sig
|
#update on sig
|
||||||
|
|
|
@ -362,9 +362,6 @@ EOF
|
||||||
|
|
||||||
#Mietjournal edit
|
#Mietjournal edit
|
||||||
if($node_meta->{ct_table} eq "contenttranspos" && $node_meta->{tpl_id} == 221){
|
if($node_meta->{ct_table} eq "contenttranspos" && $node_meta->{tpl_id} == 221){
|
||||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
|
||||||
my $users_dms_primary = { u_id => 0 };
|
|
||||||
$users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"");
|
|
||||||
my ($key,$des,$size,$postdes) = split /=/,$_;
|
my ($key,$des,$size,$postdes) = split /=/,$_;
|
||||||
$des .= " ($key)" if($users_dms->{u_id} eq $varenv{superu_id});
|
$des .= " ($key)" if($users_dms->{u_id} eq $varenv{superu_id});
|
||||||
my $prefix = $cttpos->{txt12};
|
my $prefix = $cttpos->{txt12};
|
||||||
|
@ -488,6 +485,14 @@ EOF
|
||||||
print $q->Tr(),"\n";
|
print $q->Tr(),"\n";
|
||||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||||
print $q->td({-class=>'content1_cms',-nowrap=>"1"},"$gesamt €");
|
print $q->td({-class=>'content1_cms',-nowrap=>"1"},"$gesamt €");
|
||||||
|
}elsif($key eq "txt24"){
|
||||||
|
if($cttpos->{$key} && $users_dms->{int03} > 1){
|
||||||
|
$cttpos->{$key} = $q->unescapeHTML("$cttpos->{$key}");
|
||||||
|
$cttpos->{$key} = $lb->newline($cttpos->{$key},"","");
|
||||||
|
print $q->Tr(),"\n";
|
||||||
|
#print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||||
|
print $q->td({-class=>'content1_cms',-colspan=>2},"$cttpos->{$key}"),"\n";
|
||||||
|
}
|
||||||
}elsif($key =~ /txt/){
|
}elsif($key =~ /txt/){
|
||||||
print $q->Tr(),"\n";
|
print $q->Tr(),"\n";
|
||||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||||
|
@ -501,14 +506,7 @@ EOF
|
||||||
if($key eq "txt23" && $cttpos->{ca_id} && $cttpos->{ct_id} && !$cttpos->{state}){
|
if($key eq "txt23" && $cttpos->{ca_id} && $cttpos->{ct_id} && !$cttpos->{state}){
|
||||||
print $q->Tr(),"\n";
|
print $q->Tr(),"\n";
|
||||||
print $q->td({-class=>'left_italic_cms'}, $q->a({-class=>"linknav4",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Waren/Gebühren?ca_id=$cttpos->{ca_id}\&ct_id=$cttpos->{ct_id}\&owner=$users_dms->{u_id}",-title=>""},"Gebühr hinzufügen")),"\n";
|
print $q->td({-class=>'left_italic_cms'}, $q->a({-class=>"linknav4",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Waren/Gebühren?ca_id=$cttpos->{ca_id}\&ct_id=$cttpos->{ct_id}\&owner=$users_dms->{u_id}",-title=>""},"Gebühr hinzufügen")),"\n";
|
||||||
print $q->td({-class=>'content1_cms'}," \n");
|
print $q->td({-class=>'content1_cms'}," "),"\n";
|
||||||
}
|
|
||||||
if($key eq "txt24" && $cttpos->{$key} && $users_dms_primary->{u_id} && $dbt->{copri_conf}->{contributors} && $users_dms_primary->{u_id} =~ /$dbt->{copri_conf}->{contributors}/){
|
|
||||||
$cttpos->{$key} = $q->unescapeHTML("$cttpos->{$key}");
|
|
||||||
$cttpos->{$key} = $lb->newline($cttpos->{$key},"",1);
|
|
||||||
print $q->Tr(),"\n";
|
|
||||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
|
||||||
print $q->td({-class=>'content1_cms'},"$cttpos->{$key};\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}#end edit position
|
}#end edit position
|
||||||
|
|
Loading…
Add table
Reference in a new issue