mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-07-17 02:07:26 +02:00
Bike-smartlock archive refactoring and adding fleed hotline. 0 euro tariff extension
This commit is contained in:
parent
60f5bf58ed
commit
b1c6a62657
11 changed files with 85 additions and 69 deletions
|
@ -42,8 +42,6 @@ if($bike_type_id == 300101){
|
|||
}
|
||||
|
||||
|
||||
my $owner = $ARGV[4] || "";
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
@ -91,9 +89,6 @@ my $year = $1 if($start_itime =~ /(\d{4})-\d{2}-\d{2}/);
|
|||
|
||||
my $channel_map = $dbt->channel_map();
|
||||
my $channel = "ALL";
|
||||
foreach my $id (keys (%$channel_map)){
|
||||
$channel = $channel_map->{$id} if($id eq $owner);
|
||||
}
|
||||
|
||||
my $new_reg=0;
|
||||
my $swk_reg=0;
|
||||
|
@ -105,10 +100,9 @@ my $adr_search = {
|
|||
fetch => "all",
|
||||
keyfield => "c_id",
|
||||
int09 => "is::null", #not Service App staff
|
||||
start_itime => ">=::$start_itime",
|
||||
end_itime => "<::$end_itime",
|
||||
};
|
||||
$adr_search = { %$adr_search , owner => $owner } if($owner && $owner =~ /^\d+$/);
|
||||
$adr_search = { %$adr_search , start_itime => ">=::$start_itime" } if($start_itime);
|
||||
$adr_search = { %$adr_search , end_itime => "<::$end_itime" } if($end_itime);
|
||||
my $adr = $dbt->fetch_tablerecord($dbh,$adr_search);
|
||||
|
||||
|
||||
|
@ -134,7 +128,7 @@ foreach my $id (sort { $adr->{$a}->{itime} cmp $adr->{$b}->{itime} }keys (%$adr)
|
|||
template_id => "225",
|
||||
int04 => "!=::99",#virtual station
|
||||
int10 => "1", #available
|
||||
txt01 => "not ilike::%Contributor%",
|
||||
int09 => "is::null", #Contributor-Archive
|
||||
};
|
||||
my $station_rec = $dbt->fetch_record($dbh,$pref);
|
||||
|
||||
|
@ -193,10 +187,9 @@ print "Neue NutzerInnen mit Bonus Tarif: $swk_reg\n";
|
|||
int06 => "!=::99",#virtual start-station
|
||||
int29 => "$bike_type_id",#nodes.type_id
|
||||
int34 => "is::null",#not if staff
|
||||
start_itime => ">=::$start_itime",
|
||||
end_itime => "<::$end_itime",
|
||||
};
|
||||
$pos_search->{owner} = $owner if($owner && $owner =~ /^\d+$/);
|
||||
$pos_search->{start_time} = ">=::$start_itime" if($start_itime);
|
||||
$pos_search->{end_time} = "<::$end_itime" if($end_itime);
|
||||
my $pos = $dbt->fetch_tablerecord($dbh,$pos_search);
|
||||
|
||||
#Loop rental positions alias Mietjournal
|
||||
|
|
|
@ -116,7 +116,7 @@ $sendref->{message} .= "occubike on station\n";
|
|||
template_id => "225",
|
||||
int04 => "!=::99",
|
||||
int10 => 1, #available
|
||||
txt01 => "not ilike::%Contributor%",
|
||||
int09 => "is::null", #Contributor-Archive
|
||||
};
|
||||
my $station_rec = $dbt->fetch_record($dbh,$pref);
|
||||
|
||||
|
@ -127,6 +127,7 @@ $sendref->{message} .= "occubike on station\n";
|
|||
keyfield => "barcode",
|
||||
barcode => ">::0",
|
||||
template_id => "205",
|
||||
archive => "is::null", #Contributor-bikes
|
||||
};
|
||||
my $bikes_rec = $dbt->fetch_record($dbh,$pref_b);
|
||||
my $bike_stat = {};
|
||||
|
@ -143,9 +144,9 @@ $sendref->{message} .= "occubike on station\n";
|
|||
int06 => "!=::99",#virtuel start-station
|
||||
int29 => "$bike_type_id",#nodes.type_id
|
||||
int34 => "is::null",#not if staff
|
||||
start_itime => ">=::$start_itime",
|
||||
end_itime => "<::$end_itime",
|
||||
};
|
||||
$pos_search->{start_time} = ">=::$start_itime" if($start_itime);
|
||||
$pos_search->{end_time} = "<::$end_itime" if($end_itime);
|
||||
my $pos = $dbt->fetch_tablerecord($dbh,$pos_search);
|
||||
|
||||
#print "fetching bookings: Start >= $start_itime End < $end_itime\n";
|
||||
|
@ -232,7 +233,8 @@ if(1==1){
|
|||
|
||||
#Generate bike/station CSV-lines
|
||||
foreach my $b_id (sort { $bikes_rec->{$a}->{barcode} <=> $bikes_rec->{$b}->{barcode} } keys(%$bikes_rec)){
|
||||
if($bikes_rec->{$b_id}->{type_id} == $bike_type_id && $bikes_rec->{$b_id}->{node_name} !~ /Contributor/i){
|
||||
#if($bikes_rec->{$b_id}->{type_id} == $bike_type_id && $bikes_rec->{$b_id}->{node_name} !~ /Contributor/i){
|
||||
if($bikes_rec->{$b_id}->{type_id} == $bike_type_id){
|
||||
|
||||
#Durchschnittliche Nutzungsdauer pro Rad
|
||||
my $km = $bike_stat->{$b_id}->{km} || 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue