mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 11:46:27 +01:00
rental end json and once miniquery
This commit is contained in:
parent
57515256a5
commit
95d890e188
17 changed files with 224 additions and 91 deletions
|
@ -1002,7 +1002,6 @@ sub booking_update(){
|
|||
|
||||
my $state = $q->escapeHTML($q->param('state')) || "";
|
||||
my $lock_state = $q->escapeHTML($q->param('lock_state')) || "";
|
||||
my $station_state = $q->escapeHTML($q->param('station_state')) || "";
|
||||
my %varenv = $cf->envonline();
|
||||
my $rows = 0;
|
||||
my $user_agent = $q->user_agent();
|
||||
|
@ -1030,7 +1029,7 @@ sub booking_update(){
|
|||
bike => "$bike",
|
||||
state => "",
|
||||
lock_state => "",
|
||||
#station_state => "",
|
||||
station_lock_state => "",
|
||||
co2saving => "",
|
||||
response_state => "OK 1017: No update",
|
||||
response_text => "Der Mietstatus wurde nicht geändert.",
|
||||
|
@ -1104,7 +1103,7 @@ sub booking_update(){
|
|||
|
||||
#2020-09-24 requested will be all done by net_booking
|
||||
#6 = "canceled"|3 = "occupied"|1 = "available"
|
||||
#if($state && $state =~ /$dbt->{copri_conf}->{bike_state}->{6}|$dbt->{copri_conf}->{bike_state}->{3}|$dbt->{copri_conf}->{bike_state}->{1}/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
|
||||
#if($state && $state =~ /$dbt->{copri_conf}->{bike_state}->{6}|$dbt->{copri_conf}->{bike_state}->{3}|$dbt->{copri_conf}->{bike_state}->{1}/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0)
|
||||
if($state_key && ($state_key == 6 || $state_key == 3 || $state_key == 1) && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
|
||||
|
||||
#set rent state if lock_system 2=Ilockit || 3=sigo
|
||||
|
@ -1204,7 +1203,7 @@ sub booking_update(){
|
|||
|
||||
$geo_distance = $lb->geo_fencing($latitude,$longitude,$latitude_station,$longitude_station);
|
||||
#$station_next = $stations_raw->{$id}->{int04};
|
||||
#if($geo_distance <= $stations_raw->{$id}->{int06}){
|
||||
#if($geo_distance <= $stations_raw->{$id}->{int06})
|
||||
#sigo development workaround without geofence
|
||||
if(($geo_distance <= $stations_raw->{$id}->{int06}) || ($record_pos->{int11} == 3)){
|
||||
$geo_distance_next = $geo_distance;
|
||||
|
@ -1219,6 +1218,8 @@ sub booking_update(){
|
|||
$update_pos->{int21} = "$gps_age_minutes";
|
||||
$update_pos->{int22} = "$gps_accuracy";
|
||||
$update_pos->{int23} = "$geo_distance";
|
||||
$update_pos->{int26} = "$sig_book->{distance}" if($sig_book->{distance});
|
||||
$update_pos->{int28} = "$sig_book->{station_lock_state}" if($sig_book->{station_lock_state});
|
||||
#end-Station prefix
|
||||
$update_pos->{txt13} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}";
|
||||
#end-Station prefix
|
||||
|
@ -1508,10 +1509,10 @@ sub booking_update(){
|
|||
|
||||
#fetch tracking distance on Ilockit cloud by summary trip if(tracking && deviceId && available)
|
||||
if($booking->{int25} == 1 && $booking->{int10} == 1){
|
||||
sleep 2;#hopefully get distance in 2 sec.
|
||||
$bw->log("$varenv{basedir}/src/scripts/Ilockit_trackingcloud.pl $varenv{syshost} get_tripsum $booking->{c_id}",$booking->{c_id},"");
|
||||
#if ilockit clouid
|
||||
if($booking->{int13}){
|
||||
$bw->log("get co2saving",$booking->{c_id},"");
|
||||
#if system=ilockit && clouid
|
||||
if($record_pos->{int11} == 2 && $booking->{int13}){
|
||||
sleep 2;#hopefully get distance in 2 sec.
|
||||
system("$varenv{basedir}/src/scripts/Ilockit_trackingcloud.pl $varenv{syshost} get_tripsum $booking->{c_id}");
|
||||
$booking = $dbt->fetch_tablerecord($dbh,$booking_pos);
|
||||
#try it again with 20sec sleep
|
||||
|
@ -1528,8 +1529,8 @@ sub booking_update(){
|
|||
$co2saving = "Einsparung: ";
|
||||
my $co2diff = $pri->co2calc($booking);
|
||||
my $sprit_price = $pri->sprit2calc($booking);
|
||||
$co2saving .= "$co2diff kg CO2 und ";
|
||||
$co2saving .= "$sprit_price EUR ";
|
||||
$co2saving .= "$co2diff kg CO2, ";
|
||||
$co2saving .= "$sprit_price EUR " if($sprit_price > 0);
|
||||
$booking->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei einer Strecke von $booking->{int26} KM";
|
||||
$booking_values->{co2saving} = $co2saving;
|
||||
|
@ -1676,9 +1677,6 @@ sub rentals(){
|
|||
|
||||
foreach my $id (sort { $record->{$a}->{end_time} cmp $record->{$b}->{end_time} } keys (%$record)){
|
||||
|
||||
#last
|
||||
#$return->{$id} = $pri->sharee_pricing($record->{$id},"readonly");
|
||||
|
||||
#new sharee_pricing
|
||||
(my $return_counting->{$id}, my $counting) = $pri->counting_rental(\%varenv,$record->{$id},"");
|
||||
my $return_feed->{$id} = $pri->fetch_rentalfeed(\%varenv,$record->{$id},$return_counting->{$id});
|
||||
|
@ -1700,6 +1698,39 @@ sub rentals(){
|
|||
$return->{$id}->{K_u} = "$K_val" if($K_key eq "K_u");
|
||||
}
|
||||
}
|
||||
#sig update station_lock_state=locked to cancel once miniquery
|
||||
elsif($record->{$id}->{int11} && $record->{$id}->{int11} == 3 && $record->{$id}->{int28} && $record->{$id}->{int28} == 3){
|
||||
|
||||
#only for project=Bayern and developer enabled
|
||||
if(($dbt->{operator}->{$varenv{dbname}}->{project} eq "Bayern" && $auth->{int23} < 4) || ($auth->{c_id} == 1842 || $auth->{c_id} == 5781 || $auth->{c_id} == 11765 || $auth->{c_id} == 1843 || $auth->{c_id} == 38883)){
|
||||
|
||||
$bw->log("user_miniquery via $varenv{dbname} user ID $auth->{c_id} exist count:",$auth->{int23},"");
|
||||
$return->{user_miniquery} = $dbt->evaluationsfragen($dbh);
|
||||
|
||||
#user_miniquest_count
|
||||
my $user_miniquest_count = $auth->{int23} || 0;
|
||||
if($user_miniquest_count <= 4){
|
||||
$user_miniquest_count++;
|
||||
my $update_op = {
|
||||
table => "contentadr",
|
||||
int23 => $user_miniquest_count,
|
||||
atime => "now()",
|
||||
};
|
||||
my $rows = $dbt->update_record($dbh,$update_op,$auth);
|
||||
}
|
||||
}#end mini_quest
|
||||
|
||||
#there seems some methodes which needs state, thats because disabled
|
||||
#$return->{state} = "requested";#used once in App after sig rental-end push-notify
|
||||
|
||||
my $update_pos = {
|
||||
table => "contenttranspos",
|
||||
int28 => "1",
|
||||
c_id => "$id",
|
||||
};
|
||||
$dbt->update_record($dbh,$update_pos,$update_pos);
|
||||
$bw->log("sig update int28 station_lock_state=locked to cancel once miniquery",$update_pos,"");
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
@ -1804,14 +1835,12 @@ sub bikes_available(){
|
|||
$return->{$id}->{tariff_description}->{max_eur_per_day} = "$tariff_content->{$tid}->{int17}" if($tariff_content->{$tid}->{int17});
|
||||
$return->{$id}->{tariff_description}->{free_hours} = "$tariff_content->{$tid}->{int16}" if($tariff_content->{$tid}->{int16});
|
||||
$return->{$id}->{tariff_description}->{abo_eur_per_month} = "$tariff_content->{$tid}->{int15}" if($tariff_content->{$tid}->{int15});
|
||||
#TODO, have to be set on Tarif table
|
||||
$return->{$id}->{tariff_description}->{operator_agb} = "Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt (als Demo sharee AGB)." if($auth->{c_id} && ($auth->{c_id} == 1842 || $auth->{c_id} == 5781 || $auth->{c_id} == 22262));
|
||||
|
||||
#new rental_description
|
||||
$return->{$id}->{rental_description}->{name} = "$tariff_content->{$tid}->{ct_name}";
|
||||
$return->{$id}->{rental_description}->{id} = "$tariff_content->{$tid}->{barcode}";
|
||||
$return->{$id}->{rental_description}->{rental_info}->{1} = ["Tracking","Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!"] if($record->{$id}->{int25});
|
||||
$return->{$id}->{rental_description}->{rental_info}->{2} = ["AGB","Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt (als Demo sharee AGB)."] if($auth->{c_id} && ($auth->{c_id} == 1842 || $auth->{c_id} == 5781 || $auth->{c_id} == 22262));
|
||||
$return->{$id}->{rental_description}->{rental_info}->{2} = ["AGB","Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt (als Demo sharee AGB)."] if($auth->{c_id} && ($auth->{c_id} == 1842 || $auth->{c_id} == 5781 || $auth->{c_id} == 22262 || $auth->{c_id} == 38883));
|
||||
|
||||
my $i = 0;
|
||||
foreach my $td (sort keys (%$td_template)){
|
||||
|
@ -2461,7 +2490,7 @@ sub auth_verify(){
|
|||
print FILE "auth_verified on operator anchor 3 by dbname $varenv{dbname} | op3 $auth_operator3->{c_id}\n" if($debug);
|
||||
|
||||
#if user on operator available by userid c_id, then update authcookie
|
||||
if($auth_operator3->{c_id} > 0){
|
||||
if($auth_operator3->{c_id} && $auth_operator3->{c_id} > 0){
|
||||
my $authcookies = $auth_operator3->{txt05} . "|" . $cgi_authcookie;
|
||||
$bw->log("UPDATE adr on operator by dbname $varenv{dbname}",$auth_operator3->{c_id},"");
|
||||
print FILE "UPDATE adr on operator by dbname $varenv{dbname} | op3 $auth_operator3->{c_id}\n" if($debug);
|
||||
|
@ -2496,7 +2525,7 @@ sub auth_verify(){
|
|||
}
|
||||
}
|
||||
$auth_operator = $dbt->fetch_record($dbh,$authref);
|
||||
if($auth_operator->{c_id} > 0){
|
||||
if($auth_operator->{c_id} && $auth_operator->{c_id} > 0){
|
||||
$record = $auth_operator;#At first try using operator to get Tarif
|
||||
$bw->log("auth_verified on operator anchor 2.2 by dbname $varenv{dbname}",$auth_operator->{c_id},"");
|
||||
print FILE "auth_verified on operator anchor 2.2 by dbname $varenv{dbname} | op $auth_operator->{c_id}\n" if($debug);
|
||||
|
|
|
@ -318,7 +318,7 @@ elsif($q->param('request') eq "booking_request"){
|
|||
$response->{response_state} = "Failure 1001: authcookie not defined";
|
||||
$response->{response_text} = "Entschuldigung, die Sitzung wurde unterbrochen";
|
||||
}
|
||||
}
|
||||
}#end booking request
|
||||
|
||||
#booking cancel/update
|
||||
elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booking_update"){
|
||||
|
@ -379,10 +379,10 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
|||
if($q->param('state') eq "occupied"){
|
||||
system("$varenv{basedir}/src/scripts/sig_client.pl $varenv{syshost} 'rental' $authraw->{c_id} '' $ctpos->{c_id} &");
|
||||
}
|
||||
if($q->param('state') eq "available"){
|
||||
#rental/end will be done by sig push-notification
|
||||
#rental/end will be done by sig push-notification
|
||||
#if($q->param('state') eq "available"){
|
||||
#system("$varenv{basedir}/src/scripts/sig_client.pl $varenv{syshost} 'rental_end' $authraw->{c_id} '' $ctpos->{c_id} &");
|
||||
}
|
||||
#}
|
||||
|
||||
#TODO, check if booking_values in both cases: push-notify and/or app trigger works
|
||||
$sig_book->{rentalId} = "$R::rentalId" if($R::rentalId);#only for cmd tests
|
||||
|
@ -396,51 +396,13 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
|||
}
|
||||
|
||||
#keep in mind, it works on operator dependency
|
||||
#Nur für project=Bayern und für Entwickler aktiviert
|
||||
if($booking_values->{state} eq "available" && (($dbt->{operator}->{$varenv{dbname}}->{project} eq "Bayern" && $authraw->{int23} >= 1 && $authraw->{int23} < 4) || ($authraw->{c_id} == 1842 || $authraw->{c_id} == 5781 || $authraw->{c_id} == 11765 || $authraw->{c_id} == 1843 || $authraw->{c_id} == 38883))){
|
||||
#only for project=Bayern and developer enabled
|
||||
#redundant code in APIfunc sub rentals for sig user_miniquery
|
||||
if($booking_values->{state} eq "available" && (($dbt->{operator}->{$varenv{dbname}}->{project} eq "Bayern" && $authraw->{int23} < 4) || ($authraw->{c_id} == 1842 || $authraw->{c_id} == 5781 || $authraw->{c_id} == 11765 || $authraw->{c_id} == 1843 || $authraw->{c_id} == 38883))){
|
||||
|
||||
$bw->log("user_miniquery via $varenv{dbname} user ID $authraw->{c_id} exist count:",$authraw->{int23},"");
|
||||
my $user_miniquery = {
|
||||
title => "Bitte unterstützen Sie unsere Begleitforschung",
|
||||
subtitle => "Ihre drei Antworten werden anonym gespeichert.",
|
||||
footer => "Herzlichen Dank und viel Spaß bei der nächsten Fahrt!",
|
||||
questions => {
|
||||
q1 => {
|
||||
type => "check_one",
|
||||
quest_text => "1. Was war der Hauptzweck dieser Ausleihe?",
|
||||
query => {
|
||||
opt1 => "a. Einkauf",
|
||||
opt2 => "b. Kinderbeförderung",
|
||||
opt3 => "c. Lastentransport",
|
||||
opt4 => "d. Freizeit",
|
||||
opt5 => "e. Ausprobieren",
|
||||
opt6 => "f. Sonstiges"
|
||||
}
|
||||
},
|
||||
q2 => {
|
||||
type => "check_one",
|
||||
quest_text => "2. Welches Verkehrsmittel hätten Sie ansonsten benutzt?",
|
||||
query => {
|
||||
opt1 => "a. Auto",
|
||||
opt2 => "b. Motorrad oder Motorroller",
|
||||
opt3 => "c. Bus oder Bahn",
|
||||
opt4 => "d. Eigenes Fahrrad",
|
||||
opt5 => "e. Zu Fuß",
|
||||
opt6 => "f. Keines (ich hätte die Fahrt sonst nicht gemacht)",
|
||||
opt7 => "g. Sonstige"
|
||||
}
|
||||
},
|
||||
q3 => {
|
||||
type => "text",
|
||||
quest_text => "3. Haben Sie Anmerkungen oder Anregungen?",
|
||||
query => {
|
||||
opt1 => ""
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
$response->{user_miniquery} = $dbt->evaluationsfragen($dbh);
|
||||
|
||||
$response->{user_miniquery} = $user_miniquery;
|
||||
|
||||
#user_miniquest_count
|
||||
my $user_miniquest_count = $authraw->{int23} || 0;
|
||||
|
@ -450,7 +412,6 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
|||
table => "contentadr",
|
||||
int23 => $user_miniquest_count,
|
||||
atime => "now()",
|
||||
owner => "198",
|
||||
};
|
||||
my $rows = $dbt->update_record($dbh,$update_op,$authraw);
|
||||
}
|
||||
|
@ -469,7 +430,7 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
|||
$response->{response_state} = "Failure 1001: authcookie not defined";
|
||||
$response->{response_text} = "Entschuldigung, die Sitzung wurde unterbrochen";
|
||||
}
|
||||
}
|
||||
}#end booking cancel/update
|
||||
|
||||
#user_bikes_occupied
|
||||
elsif($q->param('request') eq "user_bikes_occupied"){
|
||||
|
|
|
@ -41,6 +41,7 @@ sub handler {
|
|||
my @keywords = $q->param;
|
||||
my $user_agent = $q->user_agent();
|
||||
my $aowner = 168;
|
||||
my $debug=1;
|
||||
my $dbh = "";
|
||||
my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg";
|
||||
my $aconf = Config::General->new($api_file);
|
||||
|
@ -55,6 +56,13 @@ sub handler {
|
|||
#}
|
||||
|
||||
print $q->header(-type => "application/json", -charset => "utf-8", -'Access-Control-Allow-Origin' => "*");
|
||||
|
||||
open(FILE,">>$varenv{logdir}/APIshareeio.log") if($debug);
|
||||
print FILE "\n*** $now_dt user-agent: '$user_agent' to syshost: $varenv{syshost}\n" if($debug);
|
||||
print FILE "<=== DUMP query\n " . Dumper($q) . "\n" if($debug);
|
||||
print FILE "<=== DUMP postdata:\n " . Dumper($q->param('POSTDATA')) . "\n" if($debug);
|
||||
|
||||
|
||||
my $response = {
|
||||
response_state => "OK, nothing todo",
|
||||
};
|
||||
|
@ -70,7 +78,7 @@ sub handler {
|
|||
}
|
||||
|
||||
foreach(@keywords){
|
||||
if(length($_) > 20 || length($q->param($_)) > 40){
|
||||
if(length($_) > 40 || length($q->param($_)) > 400){
|
||||
$response->{response_state} = "Failure 9000: amount of characters in $_ exceeds";
|
||||
$bw->log("Failure 9000: amount of characters in $_ exceeds",$q,"");
|
||||
my $jrout = $json->pretty->encode({shareeio => $response});
|
||||
|
@ -80,15 +88,48 @@ sub handler {
|
|||
}
|
||||
}
|
||||
|
||||
#sig booking_update
|
||||
|
||||
#sig booking_update
|
||||
sig_booking_update();# sig json post
|
||||
|
||||
#sig json api
|
||||
sub sig_booking_update {
|
||||
|
||||
my $jrout = "seems to be not valid";
|
||||
|
||||
#sig using POST JSON
|
||||
my $POSTDATA = $q->param('POSTDATA');
|
||||
|
||||
#REST methode only used for easy testing
|
||||
if($R::request && $R::request eq "booking_update"){
|
||||
my $rentalId = $q->escapeHTML($R::rentalId) || "";
|
||||
my %POSTDATA_hash = (
|
||||
"event"=>"RENTAL_END",
|
||||
"data"=>{
|
||||
"bikeId"=>"test16b5-0522-43da-ab66-477744a731a3",
|
||||
"lockStatus"=>"unlocked",
|
||||
"rentalId"=>"$rentalId",
|
||||
"reservationState"=>"",
|
||||
"startTime"=>"2022-06-06T15:00:18.045Z",
|
||||
"endTime"=>"2022-06-06T15:01:43.118Z",
|
||||
"distance"=>1000
|
||||
}
|
||||
);
|
||||
$POSTDATA = encode_json(\%POSTDATA_hash);
|
||||
print FILE "<=== DUMP POSTDATA_hash:\n " . Dumper(\%POSTDATA_hash) . "\n" if($debug);
|
||||
}
|
||||
eval {
|
||||
my $response_in = {};
|
||||
$response_in = decode_json($POSTDATA) if($POSTDATA);
|
||||
|
||||
if($response_in->{event} && $response_in->{event} eq "RENTAL_END"){
|
||||
|
||||
my $rentalId = $q->escapeHTML($response_in->{data}->{rentalId}) || "";
|
||||
my $rows = 0;
|
||||
my $booking_values = {};
|
||||
|
||||
if($rentalId){
|
||||
|
||||
if($R::state && $R::lock_state && $R::state eq "available" && $R::lock_state eq "locked"){
|
||||
my $ctpos = {};
|
||||
my $booking_pos = {
|
||||
table => "contenttranspos",
|
||||
|
@ -98,29 +139,44 @@ sub handler {
|
|||
#ca_id => "$authraw->{c_id}",#sig doesn't know uid
|
||||
};
|
||||
$ctpos = $dbt->fetch_tablerecord($dbh,$booking_pos);
|
||||
|
||||
|
||||
my $distance = 0;
|
||||
$distance = $response_in->{data}->{distance} / 1000 if(looks_like_number($response_in->{data}->{distance}) && $response_in->{data}->{distance} > 0);
|
||||
$distance = sprintf('%.2f',$distance);
|
||||
if(ref($ctpos) eq "HASH" && $ctpos->{txt22} && $ctpos->{txt11}){
|
||||
my $sig_book = {
|
||||
bikeId => $ctpos->{txt22},
|
||||
rentalId => $ctpos->{txt11},
|
||||
reservationId => ""
|
||||
reservationId => "",
|
||||
station_lock_state => "3",#addition state in context to get state=returned for miniquery
|
||||
distance => $distance,
|
||||
};
|
||||
|
||||
my $authraw = { c_id => "" };
|
||||
$authraw->{c_id} = $ctpos->{ca_id} if($ctpos->{ca_id});
|
||||
$q->param(-name=>'bike',-value=>"$ctpos->{ct_name}") if($ctpos->{ct_name});
|
||||
$q->param(-name=>'state',-value=>"available");
|
||||
$q->param(-name=>'lock_state',-value=>"locked");
|
||||
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book) if($authraw->{c_id});
|
||||
$response = {%$response, %$booking_values};
|
||||
}else{
|
||||
$response->{response_state} = "Failure: there is no rental with rentalID=$rentalId";
|
||||
}
|
||||
}else{
|
||||
$response->{response_state} = "Failure: syntax failure";
|
||||
}
|
||||
|
||||
}else{
|
||||
$response->{response_state} = "Failure: no rentalId defined";
|
||||
}
|
||||
}#end sig booking_update
|
||||
}else{
|
||||
$response->{response_state} = "Failure: no rentalId defined";
|
||||
}
|
||||
|
||||
}#end event
|
||||
};#end eval
|
||||
if ($@){
|
||||
print FILE "failure! can not decode POST json, POSTDATA:\n" . Dumper($q->param('POSTDATA')) . "\n" if($debug);
|
||||
#warn $@;
|
||||
print FILE "warn:" . $@ . "\n" if($debug);
|
||||
}
|
||||
|
||||
}#end sig json booking_update
|
||||
|
||||
|
||||
#end RESTful ------------------------------------------------------------
|
||||
#FINAL JSON response OUTPUT ----------------------------------------------------------
|
||||
|
@ -130,6 +186,7 @@ sub handler {
|
|||
$bw->log("APIjsonserver response by $user_agent mapped aowner:$aowner",$jrout,"");
|
||||
#end JSON ----------------------------------------------------------------------------
|
||||
|
||||
close(FILE) if($debug);
|
||||
return Apache2::Const::OK;
|
||||
}#end handler
|
||||
1;
|
||||
|
|
|
@ -236,7 +236,8 @@ sub sig_available {
|
|||
}
|
||||
}
|
||||
#just like caching
|
||||
$return2copri->{$bike}->{int11} = 3;
|
||||
$return2copri->{$bike}->{int11} = 3;#system
|
||||
$return2copri->{$bike}->{int25} = 1;#tracking on
|
||||
$return2copri->{$bike}->{barcode} = $bike_id;
|
||||
$return2copri->{$bike}->{txt22} = $resp->{id};#sig bikeId like 380116b5-0522-43da-ab66-477744a731a3
|
||||
$return2copri->{$bike}->{int04} = $1 if($response_out->{$bike}->{station} =~ /(\d+)/);
|
||||
|
|
|
@ -625,6 +625,9 @@ sub collect_post(){
|
|||
}elsif($key =~ /^(c_id|ca_id|ct_id|owner|barcode|int\d+)$/ && $value){
|
||||
$cp_where .= " and cp.$key $op $value";
|
||||
}
|
||||
}elsif($key eq "int10" && $value eq "('3','2')"){
|
||||
#selects also station_lock_state=locking bikes to view once miniquery
|
||||
$cp_where .= " and (cp.$key $op $value OR cp.int28 = 3)";
|
||||
}elsif($key =~ /^(c_id|ca_id|ct_id|owner|barcode|int\d+)$/ && $value){
|
||||
$cp_where .= " and cp.$key $op $value";
|
||||
}elsif($fetch->{catch} && $key eq "template_id" && $value){
|
||||
|
@ -1431,4 +1434,54 @@ sub update_content4comp(){
|
|||
return $rows;
|
||||
}
|
||||
|
||||
#should be in DB
|
||||
sub evaluationsfragen {
|
||||
my $self = shift;
|
||||
my $dbh = shift || $dbh_intern;
|
||||
|
||||
my $user_miniquery = {
|
||||
title => "Bitte unterstützen Sie unsere Begleitforschung",
|
||||
subtitle => "Ihre drei Antworten werden anonym gespeichert.",
|
||||
footer => "Herzlichen Dank und viel Spaß bei der nächsten Fahrt!",
|
||||
questions => {
|
||||
q1 => {
|
||||
type => "check_one",
|
||||
quest_text => "1. Frage: Was war der Hauptzweck dieser Ausleihe?",
|
||||
query => {
|
||||
opt1 => "1. Einkauf",
|
||||
opt2 => "2. Kinderbeförderung",
|
||||
opt3 => "3. Freizeitaktivitäten, wie Ausflüge",
|
||||
opt4 => "4. Nutzung ohne Lastentransport",
|
||||
opt5 => "5. Gewerbliche Zwecke",
|
||||
opt6 => "6. Ausprobieren",
|
||||
opt7 => "7. Sonstiger Zweck"
|
||||
}
|
||||
},
|
||||
q2 => {
|
||||
type => "check_one",
|
||||
quest_text => "2. Frage: Welches Verkehrsmittel hätten Sie ohne Mietlastenrad für diese Fahrt genutzt?",
|
||||
query => {
|
||||
opt1 => "1. Fahrrad",
|
||||
opt2 => "2. Auto",
|
||||
opt3 => "3. Zu Fuß",
|
||||
opt4 => "4. Bus/Bahn",
|
||||
opt5 => "5. Anderes Lastenrad",
|
||||
opt6 => "6. Motorad/-roller",
|
||||
opt7 => "7. Keins (ich hätte den Weg nicht gemacht)",
|
||||
opt7 => "8. Sonstige"
|
||||
}
|
||||
},
|
||||
q3 => {
|
||||
type => "text",
|
||||
quest_text => "3. Haben Sie Anmerkungen oder Anregungen?",
|
||||
query => {
|
||||
opt1 => ""
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return $user_miniquery;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -474,7 +474,7 @@ td {
|
|||
my $co2diff = $pri->co2calc($cttpos->{$id});
|
||||
my $sprit_price = $pri->sprit2calc($cttpos->{$id});
|
||||
$co2saving .= "$co2diff kg CO²<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price > 0);
|
||||
$cttpos->{$id}->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei $cttpos->{$id}->{int26} KM";
|
||||
}
|
||||
|
|
|
@ -378,7 +378,7 @@ EOF
|
|||
my $co2diff = $pri->co2calc($cttpos);
|
||||
my $sprit_price = $pri->sprit2calc($cttpos);
|
||||
$co2saving .= "$co2diff kg CO²<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price > 0);
|
||||
$cttpos->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei $cttpos->{int26} KM";
|
||||
print $q->td({-class=>'content1_cms'},"$co2saving");
|
||||
|
|
|
@ -110,18 +110,18 @@ print<<EOF
|
|||
|
||||
var icon_green = L.icon({
|
||||
iconUrl: '$varenv->{metahost}/img/$icon_green',
|
||||
iconSize: [37, 41],
|
||||
iconAnchor: [20, 41],
|
||||
popupAnchor: [-2, -40]
|
||||
iconSize: [37, 37],
|
||||
iconAnchor: [20, 37],
|
||||
popupAnchor: [-2, -36]
|
||||
//shadowUrl: 'marker-shadow.png',
|
||||
//shadowSize: [68, 95],
|
||||
//shadowAnchor: [22, 94]
|
||||
});
|
||||
var icon_red = L.icon({
|
||||
iconUrl: '$varenv->{metahost}/img/$icon_red',
|
||||
iconSize: [37, 41],
|
||||
iconAnchor: [20, 41],
|
||||
popupAnchor: [-2, -40]
|
||||
iconSize: [37, 37],
|
||||
iconAnchor: [20, 37],
|
||||
popupAnchor: [-2, -36]
|
||||
});
|
||||
|
||||
Promise.all([
|
||||
|
@ -182,8 +182,8 @@ EOF
|
|||
print "</div>\n";
|
||||
|
||||
#print $q->div({-class=>"content2_legende", -style=>'font-weight:bold;'}, "• Ist ein Lastenrad an einer Mietradstation verfügbar?"),"\n";
|
||||
print $q->div({-class=>"content2_legende"}, $q->img({-style=>'height:38px;', -src=>"$varenv->{metahost}/img/$icon_green"}), "Lastenrad verfügbar"),"\n";
|
||||
print $q->div({-class=>"content2_legende"}, $q->img({-style=>'height:38px;', -src=>"$varenv->{metahost}/img/$icon_red"}), "Lastenrad nicht verfügbar"),"\n";
|
||||
print $q->div({-class=>"content2_legende"}, $q->img({-style=>'height:37px;', -src=>"$varenv->{metahost}/img/$icon_green"}), "Lastenrad verfügbar"),"\n";
|
||||
print $q->div({-class=>"content2_legende"}, $q->img({-style=>'height:37px;', -src=>"$varenv->{metahost}/img/$icon_red"}), "Lastenrad nicht verfügbar"),"\n";
|
||||
#print $q->div({-class=>"content2_legende"}, " "),"\n";
|
||||
|
||||
print "$initMap|$varenv->{dbname}|$api_return->{authcookie}|$users_sharee->{c_id}" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id});
|
||||
|
|
|
@ -253,7 +253,7 @@ EOF
|
|||
my $co2diff = $pri->co2calc($cttpos->{$id});
|
||||
my $sprit_price = $pri->sprit2calc($cttpos->{$id});
|
||||
$co2saving .= "$co2diff kg CO²<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price > 0);
|
||||
$cttpos->{$id}->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei $cttpos->{$id}->{int26} KM";
|
||||
}
|
||||
|
|
1
copri4/main/src/scripts/ftpSWKstatistik.pl
Symbolic link
1
copri4/main/src/scripts/ftpSWKstatistik.pl
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../../../sharee.bike/copri-bike/main/src/scripts/ftpSWKstatistik.pl
|
26
copri4/main/src/scripts/jsonclient.pl
Executable file
26
copri4/main/src/scripts/jsonclient.pl
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Client
|
||||
use JSON::RPC::Client;
|
||||
|
||||
my $client = new JSON::RPC::Client;
|
||||
|
||||
my $uri = 'http://www.example.com/jsonrpc/Test';
|
||||
my $obj = {
|
||||
method => 'sum', # or 'MyApp.sum'
|
||||
params => [10, 20],
|
||||
};
|
||||
|
||||
my $res = $client->call( $uri, $obj )
|
||||
|
||||
if($res){
|
||||
if ($res->is_error) {
|
||||
print "Error : ", $res->error_message;
|
||||
}
|
||||
else {
|
||||
print $res->result;
|
||||
}
|
||||
}
|
||||
else {
|
||||
print $client->status_line;
|
||||
}
|
1
copri4/main/src/scripts/statistik_amountCSV_files.pl
Symbolic link
1
copri4/main/src/scripts/statistik_amountCSV_files.pl
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../../../sharee.bike/copri-bike/main/src/scripts/statistik_amountCSV_files.pl
|
1
copri4/main/src/scripts/statistik_monthlyCSV.pl
Symbolic link
1
copri4/main/src/scripts/statistik_monthlyCSV.pl
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../../../sharee.bike/copri-bike/main/src/scripts/statistik_monthlyCSV.pl
|
1
copri4/main/src/scripts/statistik_occubike_stationCSV.pl
Symbolic link
1
copri4/main/src/scripts/statistik_occubike_stationCSV.pl
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../../../sharee.bike/copri-bike/main/src/scripts/statistik_occubike_stationCSV.pl
|
1
copri4/main/src/scripts/statistik_zip_transport.pl
Symbolic link
1
copri4/main/src/scripts/statistik_zip_transport.pl
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../../../sharee.bike/copri-bike/main/src/scripts/statistik_zip_transport.pl
|
|
@ -85,6 +85,7 @@ div a:hover {
|
|||
line-height:2.0;
|
||||
max-width:750px;
|
||||
text-align:left;
|
||||
padding:0.2em 0;
|
||||
color: #4f3f3f;
|
||||
}
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ Nach Abschluss der Registrierung erhalten Sie sowohl auf die von Ihnen hinterleg
|
|||
my $co2diff = $pri->co2calc($cttpos->{$id});
|
||||
my $sprit_price = $pri->sprit2calc($cttpos->{$id});
|
||||
$co2saving .= "$co2diff kg CO²<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />";
|
||||
$co2saving .= "$sprit_price EUR<br />" if($sprit_price > 0);
|
||||
$cttpos->{$id}->{int26} =~ s/\./,/;
|
||||
$co2saving .= "bei $cttpos->{$id}->{int26} KM";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue