Refactoring some mailing methodes and adding cms text

This commit is contained in:
ragu 2023-06-01 07:50:17 +02:00
parent 75a23dc3f4
commit 7736fee89d
20 changed files with 376 additions and 731 deletions

View file

@ -907,7 +907,7 @@ sub booking_request(){
my $response_text = "";
#state and lock_state is only defined if requestes incl. occupied
$bw->log("booking_request bike to state $bike | $state | $lock_state, tarif $ct_tariff->{barcode}, auth:$auth->{c_id}",$auth->{c_id},"");
$bw->log("log booking_request bike:$bike, state:$state, lock_state:$lock_state, tarif:$ct_tariff->{barcode}, auth:$auth->{c_id}",$auth->{txt08},"");
my $update_adr = {
table => "contentadr",
@ -1154,7 +1154,14 @@ sub booking_update(){
$gps_data->{gps} = "$gps_data->{latitude},$gps_data->{longitude}" if($gps_data->{latitude} && $gps_data->{longitude});
}
$bw->log("booking_update bike to state $bike | $state | $lock_state, auth:$auth->{c_id}, gps:$gps_data->{gps}",$auth->{c_id},"");
my $update_pos = {
table => "contenttranspos",
mtime => "now()",
};
my $logging = "log booking_update bike:$bike, state:$state, lock_state:$lock_state, userID:$auth->{c_id}, gps:$gps_data->{gps}";
$bw->log("$logging",$auth->{c_id},"");
$update_pos->{txt24} = $record_pos->{txt24} . "\n$logging";
my $Ilockit_GUID = "";
$Ilockit_GUID = $q->escapeHTML($q->param('Ilockit_GUID')) if($q->param('Ilockit_GUID') && $q->param('Ilockit_GUID') =~ /\w+-\w+-\w+-\w+$/);
@ -1185,10 +1192,6 @@ sub booking_update(){
#set rent state if lock_system 2=Ilockit || 3=sigo
if($record_pos->{int11} && ($record_pos->{int11} == 2 || $record_pos->{int11} == 3)){
my $update_pos = {
table => "contenttranspos",
mtime => "now()",
};
if($user_agent && $user_agent !~ /axios/){#keep device info if sig push
$update_pos->{txt21} = $q->escapeHTML($q->param('user_device')) if($q->param('user_device'));
@ -1413,10 +1416,18 @@ sub booking_update(){
my $booking = $dbt->fetch_tablerecord($dbh,$booking_pos);
if(ref($booking) eq "HASH" && $booking->{ct_name}){
#$booking_values->{bike} = "$booking->{ct_name}";
#deprecated
$booking_values->{bike} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}$booking->{barcode}";
$booking_values->{state} = "$dbt->{copri_conf}->{bike_state}->{$booking->{int10}}";
$booking_values->{lock_state} = "$dbt->{copri_conf}->{lock_state}->{$booking->{int20}}";
#new object after rental end
$booking_values->{bike_returned} = {};
if($booking->{int10} == 1){
$booking_values->{bike_returned}->{bike} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}$booking->{barcode}";
$booking_values->{bike_returned}->{station} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}$booking->{int04}";
$booking_values->{bike_returned}->{state} = "$dbt->{copri_conf}->{bike_state}->{$booking->{int10}}";
$booking_values->{bike_returned}->{lock_state} = "$dbt->{copri_conf}->{lock_state}->{$booking->{int20}}";
}
#user_miniquest_count on operator
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
@ -2001,8 +2012,8 @@ sub bikes_all(){
my $pref = {
table => "content",
fetch => "all",
keyfield => "barcode",#2018-02-21 changed to bike id
template_id => "205",#Leihrad_liste
keyfield => "barcode",
template_id => "205",
};
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
@ -2018,7 +2029,11 @@ sub bikes_all(){
$pref->{int04} = "=::$station_id" if(looks_like_number($station_id));
if(looks_like_number($bike_id)){
$pref->{ barcode} = "=::$bike_id";
$pref->{int10} = "!=::3";#2022-12-02 do not select occupied bikes in servicetool by direct bike-select
#2022-12-02 not select occupied bikes in servicetool by direct select-bike
$pref->{int10} = "!=::3";
#}else{
#2023-05-23 not select requested and occupied bikes in servicetool by list-bikes?
#$pref->{int10} = "IN::(1,4,5,6)";
}
my $record = {};
@ -2201,7 +2216,7 @@ sub stations_available(){
}elsif($station_group && $type_id =~ /(\d+)/){
my $group_id = $1;
if($group_id == $station_group){
$pref_sql = " and ct.txt25 like '%$group_id%' and ct.int42=0";
$pref_sql = " and ct.txt25 like '%$group_id%' and (ct.int42=0 OR ct.int42 is null)";
}
}
}