From b1c6a6265755605b98d2b7e4e918310db5402837 Mon Sep 17 00:00:00 2001 From: ragu Date: Thu, 23 Nov 2023 19:02:16 +0100 Subject: [PATCH] Bike-smartlock archive refactoring and adding fleed hotline. 0 euro tariff extension --- copri4/main/src/Mod/APIfunc.pm | 50 ++++++++++++------- copri4/main/src/Mod/APIjsonserver.pm | 14 +++--- copri4/main/src/Mod/DBtank.pm | 14 ++---- copri4/main/src/Mod/Modalbox3.pm | 2 +- copri4/main/src/Mod/NodeEdit.pm | 19 ++++++- copri4/main/src/Mod/Prelib.pm | 8 +-- copri4/main/src/Mod/Pricing.pm | 4 +- copri4/main/src/Tpl/BaseEdit.pm | 14 +++--- copri4/main/src/Tpl/TransPositionen.pm | 2 +- .../src/scripts/statistik_amountCSV_files.pl | 17 ++----- .../scripts/statistik_occubike_stationCSV.pl | 10 ++-- 11 files changed, 85 insertions(+), 69 deletions(-) diff --git a/copri4/main/src/Mod/APIfunc.pm b/copri4/main/src/Mod/APIfunc.pm index a691c2e..8ff395c 100755 --- a/copri4/main/src/Mod/APIfunc.pm +++ b/copri4/main/src/Mod/APIfunc.pm @@ -921,8 +921,7 @@ sub booking_request(){ fetch => "one", main_id => 300008, template_id => 218, - ca_id => "$auth->{c_id}", - #int10 => "$auth->{c_id}",#deprecated + int10 => "$auth->{c_id}", state => "null", close_time => "is::null", }; @@ -948,7 +947,7 @@ sub booking_request(){ $ct_station = $dbt->fetch_record($dbh,$pref_station) if($ct_bike->{int04}); #get invoice - $ctt = $dbt->fetch_record($dbh,$pref); + $ctt = $dbt->fetch_record($dbh,$pref) if($auth->{c_id}); if(!$ctt->{c_id}){ my $ct_id = $dbt->insert_contenttrans($dbh,$auth,"300008","218","----","$owner"); $pref->{c_id} = $ct_id; @@ -1744,7 +1743,7 @@ sub rental_to_feedback{ } } return ($ctpos,$show_dialog); -} +}#end rental_to_feedback #user bikes occupied @@ -1961,11 +1960,21 @@ sub bikes_available(){ if(ref($tariff_content) eq "HASH"){ foreach my $tid (sort { $tariff_content->{$a}->{barcode} <=> $tariff_content->{$b}->{barcode} } keys (%$tariff_content)){ + my $unit_price1 = $tariff_content->{$tid}->{int35}; + my $unit_price2 = $tariff_content->{$tid}->{int36}; + my $max_fee = $tariff_content->{$tid}->{int17}; + my $unit_time = $tariff_content->{$tid}->{time01}; + my $free_time = $tariff_content->{$tid}->{time02}; + if($lang eq "de"){ + $unit_price1 =~ s/\./,/ if(looks_like_number($unit_price1)); + $unit_price2 =~ s/\./,/ if(looks_like_number($unit_price2)); + $max_fee =~ s/\./,/ if(looks_like_number($max_fee)); + } foreach my $atid (keys (%$adrtarif_hash)){ #print "if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $atid == $tariff_content->{$tid}->{barcode}){\n"; if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $atid == $tariff_content->{$tid}->{barcode}){ - #$bw->log("bikes_available for user c_id: $auth->{c_id} if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $atid == $tariff_content->{$tid}->{barcode}) on BIKE:",$return->{$id}->{bike},""); + $bw->log("bikes_available for user c_id: $auth->{c_id} if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $atid == $tariff_content->{$tid}->{barcode}) on BIKE:",$return->{$id}->{bike},""); $return->{$id}->{rental_description}->{name} = "$tariff_content->{$tid}->{ct_name}"; $return->{$id}->{rental_description}->{id} = "$tariff_content->{$tid}->{barcode}"; @@ -1978,30 +1987,33 @@ sub bikes_available(){ my $i = 0; foreach my $td (sort keys (%$td_template)){ - my $time_unit = ""; + my $time_unit = "Min"; + #print "$tid|$tariff_content->{$tid}->{barcode}|$tariff_content->{$tid}->{int35}|$tariff_content->{$tid}->{time02}\n"; - if($td_template->{$td}->{int35} && $tariff_content->{$tid}->{int35} && $tariff_content->{$tid}->{int35} > 0){ - $tariff_content->{$tid}->{int35} =~ s/\./,/ if($lang eq "de"); - $time_unit = $dbt->time_format($varenv_prim,$tariff_content->{$tid}->{time01}); - $return->{$id}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int35}","$tariff_content->{$tid}->{int35} € / $time_unit"]; + if($td_template->{$td}->{int35} && looks_like_number($tariff_content->{$tid}->{int35})){ + $time_unit = $dbt->time_format($varenv_prim,$tariff_content->{$tid}->{time01}) if($tariff_content->{$tid}->{time01} =~ /[1-9]/); + $return->{$id}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int35}","$unit_price1 € / $time_unit"]; }elsif($td_template->{$td}->{int36} && $tariff_content->{$tid}->{int36} && $tariff_content->{$tid}->{int36} > 0){ - $tariff_content->{$tid}->{int36} =~ s/\./,/ if($lang eq "de"); - $time_unit = $dbt->time_format($varenv_prim,$tariff_content->{$tid}->{time01}); - $return->{$id}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int36}", "$tariff_content->{$tid}->{int36} € / $time_unit"]; + $time_unit = $dbt->time_format($varenv_prim,$tariff_content->{$tid}->{time01}) if($tariff_content->{$tid}->{time01} =~ /[1-9]/); + $return->{$id}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int36}", "$unit_price2 € / $time_unit"]; }elsif($td_template->{$td}->{int17} && $tariff_content->{$tid}->{int17} && $tariff_content->{$tid}->{int17} > 0){ - $tariff_content->{$tid}->{int17} =~ s/\./,/ if($lang eq "de"); - $return->{$id}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int17}","$tariff_content->{$tid}->{int17} € / 24 $varenv_prim->{cms}->{'unit-hour'}->{txt}"]; - }elsif($td_template->{$td}->{time02} && $tariff_content->{$tid}->{time02} =~ /[1-9]/){ - if($further_freedtime_available == 1 || !$auth->{c_id}){ + $return->{$id}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int17}","$max_fee € / 24 $varenv_prim->{cms}->{'unit-hour'}->{txt}"]; + }elsif($td_template->{$td}->{time02}){ + if($tariff_content->{$tid}->{time02} =~ /[1-9]/){ + if($further_freedtime_available == 1 || !$auth->{c_id}){ $time_unit = $dbt->time_format($varenv_prim,$tariff_content->{$tid}->{time02}); $time_unit .= " / $varenv_prim->{cms}->{'unit-day'}->{txt}" if($dbt->{operator}->{$varenv->{dbname}}->{project} ne "Konstanz"); $return->{$id}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{time02}","$time_unit"]; + } + }else{ + delete $return->{$id}->{rental_description}->{tarif_elements}->{$td}; } } - }#end new rental_description + + }#end foreach my $td (sort keys (%$td_template)) } - } + }#end foreach my $atid (keys (%$adrtarif_hash)) } } $op_return->{$dbt->{operator}->{$varenv->{dbname}}->{oprefix} . $id} = $return->{$id}; diff --git a/copri4/main/src/Mod/APIjsonserver.pm b/copri4/main/src/Mod/APIjsonserver.pm index d4ca286..bdea494 100755 --- a/copri4/main/src/Mod/APIjsonserver.pm +++ b/copri4/main/src/Mod/APIjsonserver.pm @@ -50,6 +50,9 @@ sub handler { my @keywords = $q->param; my $debug=1; my $user_agent = $q->user_agent(); + my $user_agent_subversion = 1000; + #$user_agent = "Meinkonrad/3.0.363";#test + $user_agent_subversion = $1 if($user_agent =~ /3\.0\.(\d+)/); #my %headers = map { $_ => $q->http($_) } $q->http(); #$bw->log("headers:",\%headers,""); @@ -68,7 +71,7 @@ my $response = { apiserver => "$apiserver", response => "$respreq", uri_primary => "$dbt->{primary}->{sharee_primary}->{primaryApp}", - copri_version => "4.1.23.20", + copri_version => "4.1.23.22", user_id => "", authcookie => "", new_authcoo => "0", @@ -522,12 +525,11 @@ elsif($q->param('request') eq "bikes_available"){ } #2023-11-13, return also bikes_occupied on bikes_available by operator request - #if(1==1 && $varenv{syshost} ne "shareeapp-primary" && $dbt->{copri_conf}->{betau_id}->{$authraw->{c_id}}){ - #return list of occupied/requested bikes + if($user_agent_subversion >= 375 || $user_agent =~ /Mozilla/){#Mozilla for testing my $record = {}; $record = $apif->user_bikes_occupied($dbh,$authraw,""); $response->{bikes_occupied} = $apif->rentals(\%varenv,$record,$authraw,"1");#returns JSON rental values - #} + } } if(ref($response->{bikes}) ne "HASH"){ $response->{response_state} = "Failure 5003: cannot find any user defined bike tariff"; @@ -715,10 +717,6 @@ elsif($q->param('request') eq "stations_available"){ my $authraw = {}; ($auth,$authraw) = $apif->auth_verify($q); - my $user_agent_subversion = 1000; - #$user_agent = "Meinkonrad/3.0.363";#test - $user_agent_subversion = $1 if($user_agent =~ /3\.0\.(\d+)/); - #merchant_message timerange my $lnow = strftime("%Y-%m-%d %H:%M:%S", localtime(time)); my $localtime = Time::Piece->strptime($lnow, "%Y-%m-%d %H:%M:%S"); diff --git a/copri4/main/src/Mod/DBtank.pm b/copri4/main/src/Mod/DBtank.pm index e1f984e..50dc2dc 100755 --- a/copri4/main/src/Mod/DBtank.pm +++ b/copri4/main/src/Mod/DBtank.pm @@ -794,18 +794,13 @@ sub fetch_record(){ $where .= " and ct.$key $op $value"; } } - if($key =~ /^(type_id)$/){ - if(looks_like_number($value)){ + if($key =~ /type_id|archive/){ + if(looks_like_number($value) || $value eq "null"){ $where .= " and nd.$key $op $value"; } } - if($varenv{systype} && $varenv{systype} eq "azn" && $key =~ /start_time|end_time/){ - if($key =~ /start_time/){ - $where .= " and (ct.end_time >= '$fetch->{start_time}' AND ct.start_time <= '$fetch->{end_time}')"; - $order = "order by ct.start_time DESC";#because to get ct_id for contenttverpos Übertrag - } - }elsif($key =~ /close_time$/ && $value){ + if($key =~ /close_time$/ && $value){ $where .= " and ct.$key $op $value"; }elsif($key =~ /time$/ && $value){ if($value =~ /interval/){ @@ -818,6 +813,7 @@ sub fetch_record(){ } #ct.* because of nd.txt01 and ct.txt01 . + #TODO drop "lang" then set nd.* should be possible my $sql = "SELECT ct.*,rel.*,nd.node_name,nd.parent_id,nd.type_id,nd.energy_id FROM $fetch->{table} ct, relation rel, nodes nd $where $order"; #$bw->log("DBtank fetch_record : ",$sql,"") if($debug); my $sth = $dbh->prepare($sql); @@ -852,7 +848,7 @@ sub fetch_tablerecord(){ if($key =~ /ct_name/ && $value =~ /CAST/){#CAST(c_id AS text) $where .= " and $key $op $value"; - }elsif($key =~ /^(ct_name$|txt\d+|uri\d+|state)$/ && $value){ + }elsif($key =~ /^(ct_name|txt\d+|state)$/ && $value){ if($value =~ /length\($key\)/){ $where .= " and $value"; }elsif($value eq "null"){ diff --git a/copri4/main/src/Mod/Modalbox3.pm b/copri4/main/src/Mod/Modalbox3.pm index 1800e2b..0eb0e22 100755 --- a/copri4/main/src/Mod/Modalbox3.pm +++ b/copri4/main/src/Mod/Modalbox3.pm @@ -52,7 +52,7 @@ sub mobox3(){ if($R::node2edit eq "edit_relation" || $R::rel_edit =~ /_relation/){ $title = "Node Editor"; - $height = "300"; + $height = "400"; $width = "600"; } diff --git a/copri4/main/src/Mod/NodeEdit.pm b/copri4/main/src/Mod/NodeEdit.pm index 750944e..aec6abe 100755 --- a/copri4/main/src/Mod/NodeEdit.pm +++ b/copri4/main/src/Mod/NodeEdit.pm @@ -134,7 +134,8 @@ sub admin_tpl(){ print $q->Tr(); print $q->td({-class=>'left_italic_cms'},"$des"); print $q->td({-class=>'content1_cms'},$q->textfield(-class=>'etxt',-name=>"$key",-default=>"$node_meta->{$key}",-override=>'1',-size=>"$isize",-maxlength=>120)),"\n"; - }elsif($key eq "type_id" && $isize eq "select" && $node_meta->{template_id} eq "205"){ + }elsif($node_meta->{template_id} eq "205"){ + if($key eq "type_id" && $isize eq "select"){ my @s_valxx = (); my $s_hash = {}; $s_hash = $dbt->{copri_conf}->{type_id}; @@ -144,11 +145,25 @@ sub admin_tpl(){ push @s_valxx, "$s_key:$s_hash->{$s_key}"; } print $q->td({-class=>'content1_cms'},$but->selector_class("$key","","",$node_meta->{$key},@s_valxx)),"\n"; - }elsif($key eq "energy_id" && $isize eq "checkbox"){ + }elsif($key eq "energy_id" && $isize eq "checkbox"){ print $q->Tr(); print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; print $q->td({-class=>'content1_cms', -colspan=>'1'}, $but->checkbox("1","$key","$node_meta->{$key}")),"\n"; print $q->hidden(-name=>"$key",-override=>1,-value=>"null"); + }elsif($key eq "archive" && $isize eq "checkbox"){ + print $q->Tr(); + print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; + print $q->td({-class=>'content1_cms', -colspan=>'1'}, $but->checkbox("1","$key","$node_meta->{$key}")),"\n"; + print $q->hidden(-name=>"$key",-override=>1,-value=>"null"); + }elsif($key eq "hotline_email"){ + print $q->Tr(); + print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; + print $q->td({-class=>'content1_cms'},$q->textfield(-class=>'etxt',-name=>"$key",-default=>"$node_meta->{$key}",-override=>'1',-size=>"$isize",-maxlength=>120)),"\n"; + }elsif($key eq "hotline_phone"){ + print $q->Tr(); + print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; + print $q->td({-class=>'content1_cms'},$q->textfield(-class=>'etxt',-name=>"$key",-default=>"$node_meta->{$key}",-override=>'1',-size=>"$isize",-maxlength=>120)),"\n"; + } } } }else{ diff --git a/copri4/main/src/Mod/Prelib.pm b/copri4/main/src/Mod/Prelib.pm index a529ad0..51903a0 100755 --- a/copri4/main/src/Mod/Prelib.pm +++ b/copri4/main/src/Mod/Prelib.pm @@ -1217,11 +1217,11 @@ sub save_relation { $valxx = "null" if(!$valxx && $valxx ne "0");#for empty $valxx = "0" if($valxx eq "0"); $u_rows = $dbt->update_one($dbh,$update_node,"$_=$valxx") if($valxx =~ /^\d+$|null|0/); - }elsif($_ eq "type_id" && $valxx){ - $u_rows = $dbt->update_one($dbh,$update_node,"type_id=$valxx"); - }elsif($_ eq "energy_id"){ + }elsif($_ =~ /type_id|energy_id|archive/ && $valxx){ + $u_rows = $dbt->update_one($dbh,$update_node,"$_=$valxx"); $valxx = "null" if(!$valxx || $valxx eq "null"); - $u_rows = $dbt->update_one($dbh,$update_node,"energy_id=$valxx"); + }elsif($_ =~ /hotline_email|hotline_phone/){ + $u_rows = $dbt->update_one($dbh,$update_node,"$_='$valxx'"); }elsif($_ =~ /node_public/){ $valxx = "t" if($valxx eq "1" || $valxx eq "t"); $valxx = "f" if(!$valxx || $valxx eq "f"); diff --git a/copri4/main/src/Mod/Pricing.pm b/copri4/main/src/Mod/Pricing.pm index cea4c71..945af2f 100755 --- a/copri4/main/src/Mod/Pricing.pm +++ b/copri4/main/src/Mod/Pricing.pm @@ -411,8 +411,8 @@ sub fetch_rentalfeed { } foreach my $td (sort keys (%$td_template)){ - my $time_unit = ""; - if($td_template->{$td}->{int35} && $ctpos->{int35} && $ctpos->{int35} > 0){ + my $time_unit = "Min"; + if($td_template->{$td}->{int35} && looks_like_number($ctpos->{int35})){ $ctpos->{int35} =~ s/\./,/ if($lang eq "de"); $time_unit = $dbt->time_format($varenv_prim,$ctpos->{time01}); $return->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int35}","$ctpos->{int35} € / $time_unit"]; diff --git a/copri4/main/src/Tpl/BaseEdit.pm b/copri4/main/src/Tpl/BaseEdit.pm index cb7fd33..e37a04d 100755 --- a/copri4/main/src/Tpl/BaseEdit.pm +++ b/copri4/main/src/Tpl/BaseEdit.pm @@ -455,11 +455,11 @@ EOF print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; print $q->td({-class=>'content1_cms'}, $q->textfield(-id=>'datepicker3',-class=>'etxt',-name=>"start_date",-default=>"$s_dd.$s_mo.$s_yy",-size=>"10",-maxlength=>10), - $q->textfield(-class=>'etxt',-name=>"s_hh",-default=>"$s_hh",-size=>"2",-maxlength=>2),":", - $q->textfield(-class=>'etxt',-name=>"s_mi",-default=>"$s_mi",-size=>"2",-maxlength=>2)," → ", + $q->textfield(-class=>'etxt',-name=>"s_hh",-default=>"$s_hh", -override=>'1',-size=>"2",-maxlength=>2),":", + $q->textfield(-class=>'etxt',-name=>"s_mi",-default=>"$s_mi", -override=>'1',-size=>"2",-maxlength=>2)," → ", $q->textfield(-id=>'datepicker4',-class=>'etxt2',-name=>"end_date",-default=>"$e_dd.$e_mo.$e_yy",-size=>"10",-maxlength=>10), - $q->textfield(-class=>'etxt2',-name=>"e_hh",-default=>"$e_hh",-size=>"2",-maxlength=>2),":", - $q->textfield(-class=>'etxt2',-name=>"e_mi",-default=>"$e_mi",-size=>"2",-maxlength=>2)),"\n"; + $q->textfield(-class=>'etxt2',-name=>"e_hh",-default=>"$e_hh", -override=>'1',-size=>"2",-maxlength=>2),":", + $q->textfield(-class=>'etxt2',-name=>"e_mi",-default=>"$e_mi", -override=>'1',-size=>"2",-maxlength=>2)),"\n"; }elsif($key =~ /int10/ && "$size" eq "select"){#bike_state my @_lock_valxx = (); @@ -517,7 +517,7 @@ EOF }elsif($key =~ /int07/){ print $q->Tr(),"\n"; print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; - print $q->td({-class=>'content1_cms',-style=>"",-nowrap=>'1'},$q->textfield(-class=>'etxt',-name=>"$key",-default=>"$cttpos->{$key}", -override=>'1',-size=>"6",-maxlength=>6),$but->selector("int08","40px","$cttpos->{int08}",("0.00:%","1.00:€"))),"\n"; + print $q->td({-class=>'content1_cms',-style=>"",-nowrap=>'1'},$q->textfield(-class=>'etxt',-name=>"$key",-default=>"$cttpos->{$key}", -override=>'1',-size=>"6",-maxlength=>6),$but->selector("int08","40px","$cttpos->{int08}",("0:%","1:€"))),"\n"; }elsif($key =~ /int01/){ print $q->Tr(),"\n"; print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; @@ -583,9 +583,9 @@ EOF ($desc_key,$desc_name,$desc_size,$desc_intervall,$desc_type) = split(/=/,$ctrel->{$key}); print $q->Tr(),"\n"; print $q->hidden(-name=>"$key",-override=>1,-value=>"$tplkey"),"\n"; - print $q->td({-class=>'content1_cms'},"$desc_num",$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"$key", -default=>"$desc_name")),"\n"; + print $q->td({-class=>'content1_cms'},"$desc_num",$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"$key", -default=>"$desc_name", -override=>'1')),"\n"; print $q->hidden(-name=>"$key",-override=>1,-value=>"checkbox"),"\n"; - print $q->td({-class=>'content1_cms'},"Intervall",$q->textfield(-class=>'etxt', -style=>"width:2em;",-name=>"$key", -default=>"$desc_intervall"),"Tage"),"\n"; + print $q->td({-class=>'content1_cms'},"Intervall",$q->textfield(-class=>'etxt', -style=>"width:2em;",-name=>"$key", -default=>"$desc_intervall", -override=>'1'),"Tage"),"\n"; print $q->td({-class=>'content1_cms'},$but->radiobox2("$key","$desc_type","","weich","hart")),"\n"; } diff --git a/copri4/main/src/Tpl/TransPositionen.pm b/copri4/main/src/Tpl/TransPositionen.pm index 52a6e8b..c72eddc 100755 --- a/copri4/main/src/Tpl/TransPositionen.pm +++ b/copri4/main/src/Tpl/TransPositionen.pm @@ -299,7 +299,7 @@ EOF print $q->td({-class=>'element',-style=>"$txtstyle $set_style"},$q->textfield(-class=>'etxt',-style=>"$txtstyle",-name=>"$key",-default=>"$cttpos->{$id}->{$key}", -override=>'1',-size=>"$isize",-maxlength=>100)),"\n"; } }elsif($key =~ /int07/){ - print $q->td({-class=>'element',-style=>"$txtstyle $set_style",-nowrap=>'1'},$q->textfield(-class=>'etxt',-style=>"$txtstyle",-name=>"$key",-default=>"$cttpos->{$id}->{$key}", -override=>'1',-size=>"$isize",-maxlength=>100),$but->selector("int08","40px","$cttpos->{$id}->{int08}",("0.00:%","1.00:€"))),"\n"; + print $q->td({-class=>'element',-style=>"$txtstyle $set_style",-nowrap=>'1'},$q->textfield(-class=>'etxt',-style=>"$txtstyle",-name=>"$key",-default=>"$cttpos->{$id}->{$key}", -override=>'1',-size=>"$isize",-maxlength=>100),$but->selector("int08","40px","$cttpos->{$id}->{int08}",("0:%","1:€"))),"\n"; }elsif($key =~ /int04/){ print $q->td({-class=>'tdint',-nowrap=>"1"},"$gesamt €"),"\n"; }elsif($key =~ /txt01/){ diff --git a/copri4/main/src/scripts/statistik_amountCSV_files.pl b/copri4/main/src/scripts/statistik_amountCSV_files.pl index 9f6c820..e5a5c0a 100755 --- a/copri4/main/src/scripts/statistik_amountCSV_files.pl +++ b/copri4/main/src/scripts/statistik_amountCSV_files.pl @@ -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 diff --git a/copri4/main/src/scripts/statistik_occubike_stationCSV.pl b/copri4/main/src/scripts/statistik_occubike_stationCSV.pl index 546bc5a..fa85fb0 100755 --- a/copri4/main/src/scripts/statistik_occubike_stationCSV.pl +++ b/copri4/main/src/scripts/statistik_occubike_stationCSV.pl @@ -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;