mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-13 15:16:38 +02:00
user message on longterm rental, based also on fleed operator. Bikeakku view config
This commit is contained in:
parent
addf1ab6db
commit
030091de20
16 changed files with 364 additions and 248 deletions
|
@ -999,6 +999,7 @@ sub booking_request(){
|
|||
}
|
||||
#Rental is only permitted if sum_balance <= 1 (in primary prepaid context positive)
|
||||
#Rental is only permitted if no invoice with payment_fault or opos
|
||||
$bw->log("Rental is only permitted if no invoice with payment_fault or opos: $sum_balance <= 1 && !$ctt_opos->{c_id}, userID: $auth->{c_id} ",$sum_balance,"");
|
||||
if($sum_balance <= 1 && !$ctt_opos->{c_id}){
|
||||
#2 = "requested"
|
||||
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct_bike,$ct_station,$auth,$ct_tariff,$now_dt,$bike,"2",$owner,$sig_book);
|
||||
|
@ -1990,11 +1991,10 @@ sub bikes_available(){
|
|||
$return->{$id}->{bike_type}->{engine}->{manufacturer} = "dummy";
|
||||
my $max_bars = 5;
|
||||
my $current_bars = 0;
|
||||
my $charge_view_hidden = 0;#1=hide charge view
|
||||
#$charge_view_hidden = 0 if($dbt->{operator}->{$varenv->{dbname}}->{oprefix} =~ /BVB|FR|KN/);
|
||||
my $backend_accessible = 1;
|
||||
$backend_accessible = 0 if($record->{$id}->{int11} eq "2");#for asking user
|
||||
#$backend_accessible = 0 if($dbt->{operator}->{$varenv->{dbname}}->{oprefix} =~ /BVB|FR|KN/);#for asking user
|
||||
my $charge_view_hidden = 0;#0=view charge
|
||||
$charge_view_hidden = 1 if($record->{$id}->{battery_hidden});#1=hide charge view
|
||||
my $backend_accessible = 0;#0=user has edit load
|
||||
$backend_accessible = 1 if($record->{$id}->{battery_accessible});#1=charge from backend
|
||||
$return->{$id}->{bike_type}->{battery}->{charge_max_bars} = "$max_bars";
|
||||
$return->{$id}->{bike_type}->{battery}->{charge_current_bars} = "$current_bars";
|
||||
$return->{$id}->{bike_type}->{battery}->{charge_current_percent} = "0";
|
||||
|
@ -2175,11 +2175,10 @@ sub bikes_all(){
|
|||
$return->{$id}->{bike_type}->{engine}->{manufacturer} = "dummy";
|
||||
my $max_bars = 5;
|
||||
my $current_bars = 0;
|
||||
my $charge_view_hidden = 0;#1=hide charge view
|
||||
#$charge_view_hidden = 0 if($dbt->{operator}->{$varenv->{dbname}}->{oprefix} =~ /BVB|FR|KN/);
|
||||
my $backend_accessible = 1;#1=battery charge from backend, 0=asking user
|
||||
$backend_accessible = 0 if($record->{$id}->{int11} eq "2");#for asking user
|
||||
#$backend_accessible = 0 if($dbt->{operator}->{$varenv->{dbname}}->{oprefix} =~ /BVB|FR|KN/);#for asking user
|
||||
my $charge_view_hidden = 0;
|
||||
$charge_view_hidden = 1 if($record->{$id}->{battery_hidden});#1=hide charge view
|
||||
my $backend_accessible = 0;
|
||||
$backend_accessible = 1 if($record->{$id}->{battery_accessible});#1=charge from backend
|
||||
$return->{$id}->{bike_type}->{battery}->{charge_max_bars} = "$max_bars";
|
||||
$return->{$id}->{bike_type}->{battery}->{charge_current_bars} = "$current_bars";
|
||||
$return->{$id}->{bike_type}->{battery}->{charge_current_percent} = "0";
|
||||
|
@ -2344,21 +2343,40 @@ sub stations_available(){
|
|||
template_id => 197,
|
||||
c_id => "1",
|
||||
};
|
||||
my $hotline_data = $dbt->fetch_record($dbh,$hotline_hash);
|
||||
my $hotline_data = {
|
||||
txt01 => "",
|
||||
txt84 => "",
|
||||
txt07 => "",
|
||||
txt08 => "",
|
||||
};
|
||||
$hotline_data = $dbt->fetch_record($dbh,$hotline_hash);
|
||||
|
||||
|
||||
my $op_return = {};
|
||||
foreach my $id (sort { $record->{$a}->{barcode} <=> $record->{$b}->{barcode} } keys (%$record)){
|
||||
$record->{$id}->{txt06} =~ s/\s//g if($record->{$id}->{txt06});
|
||||
if($record->{$id}->{txt06} && $record->{$id}->{txt06} =~ /\d+\.\d+\,\d+\.\d+/){
|
||||
my $op_return = {};
|
||||
foreach my $id (sort { $record->{$a}->{barcode} <=> $record->{$b}->{barcode} } keys (%$record)){
|
||||
$record->{$id}->{txt06} =~ s/\s//g if($record->{$id}->{txt06});
|
||||
if($record->{$id}->{txt06} && $record->{$id}->{txt06} =~ /\d+\.\d+\,\d+\.\d+/){
|
||||
my $fleed = {
|
||||
name => "",
|
||||
hours => "",
|
||||
phone => "",
|
||||
email => "",
|
||||
};
|
||||
my $bike_count = 0;
|
||||
my @bike_ids = ();
|
||||
foreach my $b_id (keys (%$record_bikes)){
|
||||
if($record->{$id}->{int04} == $record_bikes->{$b_id}->{int04}){
|
||||
push @bike_ids,$dbt->{operator}->{$varenv->{dbname}}->{oprefix} . $record_bikes->{$b_id}->{barcode};
|
||||
$bike_count++;
|
||||
$fleed = {
|
||||
name => "$record_bikes->{$b_id}->{fleed_name}",
|
||||
hours => "$record_bikes->{$b_id}->{fleed_hours}",
|
||||
phone => "$record_bikes->{$b_id}->{fleed_phone}",
|
||||
email => "$record_bikes->{$b_id}->{fleed_email}",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$return->{$id}->{bike_count} = "$bike_count";
|
||||
$return->{$id}->{bike_ids} = [@bike_ids];
|
||||
|
||||
|
@ -2403,16 +2421,39 @@ sub stations_available(){
|
|||
$return->{$id}->{station_group} = [@station_group];
|
||||
}
|
||||
|
||||
$return->{$id}->{operator_data} = {
|
||||
"operator_name" => "",
|
||||
"operator_hours" => "",
|
||||
"operator_phone" => "",
|
||||
"operator_email" => "",
|
||||
};
|
||||
$return->{$id}->{operator_data}->{operator_name} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$hotline_data->{txt01})) if($hotline_data->{txt01});
|
||||
$return->{$id}->{operator_data}->{operator_hours} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$hotline_data->{txt84})) if($hotline_data->{txt84});
|
||||
$return->{$id}->{operator_data}->{operator_phone} = $hotline_data->{txt07} if($hotline_data->{txt07});
|
||||
$return->{$id}->{operator_data}->{operator_email} = $hotline_data->{txt08} if($hotline_data->{txt08});
|
||||
if($fleed->{email} && $fleed->{phone}){
|
||||
$return->{$id}->{operator_data} = {
|
||||
operator_name => $fleed->{name},
|
||||
operator_hours => $fleed->{hours},
|
||||
operator_phone => $fleed->{phone},
|
||||
operator_email => $fleed->{email},
|
||||
};
|
||||
}else{
|
||||
$return->{$id}->{operator_data} = {
|
||||
operator_name => $hotline_data->{txt01},
|
||||
operator_hours => $hotline_data->{txt84},
|
||||
operator_phone => $hotline_data->{txt07},
|
||||
operator_email => $hotline_data->{txt08},
|
||||
};
|
||||
}
|
||||
|
||||
#not desired 2024-02-15
|
||||
if(1==2){
|
||||
$return->{$id}->{contact_data} = {
|
||||
software => {
|
||||
company_name => "$hotline_data->{txt01}",
|
||||
opening_hours => "$hotline_data->{txt84}",
|
||||
phone => "$hotline_data->{txt07}",
|
||||
email => "$hotline_data->{txt08}"
|
||||
},
|
||||
hardware => {
|
||||
company_name => "$fleed->{name}",
|
||||
opening_hours => "$fleed->{hours}",
|
||||
phone => "$fleed->{phone}",
|
||||
email => "$fleed->{email}"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$return->{$id}->{cached} = "0";
|
||||
$return->{$id}->{withpub} = "0";
|
||||
|
@ -2425,11 +2466,11 @@ sub stations_available(){
|
|||
|
||||
$op_return->{$dbt->{operator}->{$varenv->{dbname}}->{oprefix} . $id} = $return->{$id};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#json caching
|
||||
if($dbt->{operator}->{$varenv->{dbname}}->{cache_station} == 1 && $cachme){
|
||||
#json caching
|
||||
if($dbt->{operator}->{$varenv->{dbname}}->{cache_station} == 1 && $cachme){
|
||||
|
||||
#order by sharing_type
|
||||
foreach my $tarif_key (keys(%$adrtarif_hash)){
|
||||
|
@ -2452,7 +2493,7 @@ sub stations_available(){
|
|||
}
|
||||
}
|
||||
}
|
||||
}#end caching
|
||||
}#end caching
|
||||
|
||||
return ($op_return, $record);
|
||||
}#end stations_available
|
||||
|
@ -3142,7 +3183,7 @@ sub auth_verify(){
|
|||
my $last_used_operator = $record->{txt19};#check if this is primary and/or useable
|
||||
#$bw->log("last_used_operator selected by txt19:",$last_used_operator,"");
|
||||
if($last_used_operator){
|
||||
my $dbh_operator = $dbt->dbconnect_extern("$last_used_operator");
|
||||
my $dbh_operator = $dbt->dbconnect_extern("$last_used_operator","iso-8859-1");
|
||||
my $hotline_hash = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
|
@ -3157,8 +3198,8 @@ sub auth_verify(){
|
|||
"operator_phone" => "",
|
||||
"operator_email" => "",
|
||||
};
|
||||
$return->{last_used_operator}->{operator_name} = $hotline_data->{txt01} if($hotline_data->{txt01});
|
||||
$return->{last_used_operator}->{operator_hours} = $hotline_data->{txt84} if($hotline_data->{txt84});
|
||||
$return->{last_used_operator}->{operator_name} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$hotline_data->{txt01})) if($hotline_data->{txt01});
|
||||
$return->{last_used_operator}->{operator_hours} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$hotline_data->{txt84})) if($hotline_data->{txt84});
|
||||
$return->{last_used_operator}->{operator_phone} = $hotline_data->{txt07} if($hotline_data->{txt07});
|
||||
$return->{last_used_operator}->{operator_email} = $hotline_data->{txt08} if($hotline_data->{txt08});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue