sig prefix and rental if reserved start

This commit is contained in:
ragu 2022-05-04 08:02:59 +02:00
parent b3fb4e2143
commit c8d7b562bd
13 changed files with 172 additions and 168 deletions

View file

@ -786,8 +786,9 @@ sub fetch_bike_tariff {
my $bike = shift; my $bike = shift;
my $owner = shift; my $owner = shift;
my $bike_id = ""; my $bike_id = $bike || "";
$bike_id = $1 if($bike =~ /(\d+)/); $bike_id =~ s/S[1-9]X/SX/;
$bike_id = $1 if($bike_id =~ /(\d+)/);
my $main_ids = ""; my $main_ids = "";
my ($bike_group,$user_group,$tariff_content,$user_tour) = $self->fetch_tariff($varenv->{dbname},$auth,""); my ($bike_group,$user_group,$tariff_content,$user_tour) = $self->fetch_tariff($varenv->{dbname},$auth,"");
@ -872,11 +873,11 @@ sub booking_request(){
my $ct_tariff = shift; my $ct_tariff = shift;
my $owner = shift || ""; my $owner = shift || "";
my $gps = shift || ""; my $gps = shift || "";
my $reserveid = shift || ""; my $sig_book = shift || {};
my $dbh = ""; my $dbh = "";
my $bike_id = ""; my $bike_id = "";
$bike_id = $1 if($bike =~ /(\d+)$/); $bike_id = $1 if($bike_id =~ /(\d+)$/);
my $pos_id=""; my $pos_id="";
my $now_dt = strftime "%Y-%m-%d %H:%M", localtime; my $now_dt = strftime "%Y-%m-%d %H:%M", localtime;
@ -935,7 +936,7 @@ sub booking_request(){
if($ctt->{c_id}){ if($ctt->{c_id}){
#2 = "requested" #2 = "requested"
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct_bike,$auth,$ct_tariff,$now_dt,$bike,"2",$owner,$reserveid); $pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct_bike,$auth,$ct_tariff,$now_dt,$bike,"2",$owner,$sig_book);
$bw->log("booking_request insert_pos:",$pos_id,""); $bw->log("booking_request insert_pos:",$pos_id,"");
if($pos_id){ if($pos_id){
@ -1003,7 +1004,7 @@ sub booking_update(){
my $varenv = shift; my $varenv = shift;
my $auth = shift; my $auth = shift;
my $owner = shift || 0; my $owner = shift || 0;
my $rentalid = shift || ""; my $sig_book = shift || {};
my $state = $q->escapeHTML($q->param('state')) || ""; my $state = $q->escapeHTML($q->param('state')) || "";
my $lock_state = $q->escapeHTML($q->param('lock_state')) || ""; my $lock_state = $q->escapeHTML($q->param('lock_state')) || "";
@ -1012,8 +1013,12 @@ sub booking_update(){
my $rows = 0; my $rows = 0;
my $user_agent = $q->user_agent(); my $user_agent = $q->user_agent();
my $record_pos = { c_id => 0 };#if fails my $record_pos = { c_id => 0 };#if fails
my $bike = $q->param('bike'); #my $bike = $q->param('bike');
my $bike_id = $1 if($q->escapeHTML($q->param('bike')) =~ /(\d+)/); #my $bike_id = $1 if($q->escapeHTML($q->param('bike')) =~ /(\d+)/);
my $bike = $q->escapeHTML($q->param('bike')) || "";
my $bike_id = $bike;
$bike_id =~ s/S[1-9]X/SX/;
$bike_id = $1 if($bike_id =~ /(\d+)/);
my $state_key = 0; my $state_key = 0;
my $state_text = ""; my $state_text = "";
@ -1146,7 +1151,7 @@ sub booking_update(){
$update_pos->{owner} = "$owner"; $update_pos->{owner} = "$owner";
$update_pos->{int10} = "$state_key"; $update_pos->{int10} = "$state_key";
$update_pos->{txt11} = "$rentalid"; $update_pos->{txt11} = "$sig_book->{rentalid}" if($sig_book->{rentalid});
$rows = $dbt->update_record($dbh,$update_pos,$record_pos); $rows = $dbt->update_record($dbh,$update_pos,$record_pos);
if($rows > 0){ if($rows > 0){
@ -1174,7 +1179,7 @@ sub booking_update(){
$update_pos->{int41} = "$counting->{int41}" if(looks_like_number($counting->{int41})); $update_pos->{int41} = "$counting->{int41}" if(looks_like_number($counting->{int41}));
$update_pos->{int10} = "$state_key"; $update_pos->{int10} = "$state_key";
$update_pos->{txt11} = "$rentalid"; $update_pos->{txt11} = "$sig_book->{rentalid}" if($sig_book->{rentalid});
$rows = $dbt->update_record($dbh,$update_pos,$record_pos); $rows = $dbt->update_record($dbh,$update_pos,$record_pos);
$booking_values->{response_state} = "OK: available bike " . $q->param('bike') . ", still locked"; $booking_values->{response_state} = "OK: available bike " . $q->param('bike') . ", still locked";
@ -1210,7 +1215,7 @@ sub booking_update(){
$update_cc->{int04} = "$stations_raw->{$id}->{int04}"; $update_cc->{int04} = "$stations_raw->{$id}->{int04}";
$update_pos->{int24} = "1"; $update_pos->{int24} = "1";
$update_pos->{int10} = "$state_key"; $update_pos->{int10} = "$state_key";
$update_pos->{txt11} = "$rentalid"; $update_pos->{txt11} = "$sig_book->{rentalid}" if($sig_book->{rentalid});
$update_cc->{txt06} = "$gps";#end content coordinates $update_cc->{txt06} = "$gps";#end content coordinates
$update_pos->{txt06} = "$gps";#end pos coordinates $update_pos->{txt06} = "$gps";#end pos coordinates
$update_pos->{int21} = "$gps_age_minutes"; $update_pos->{int21} = "$gps_age_minutes";
@ -1351,7 +1356,8 @@ sub booking_update(){
owner => "$owner", owner => "$owner",
}; };
if($q->param('voltage') && $q->param('voltage') =~ /(\d+)/){ #only by system=Ilockit
if($record_pos->{int11} eq "2" && $q->param('voltage') && $q->param('voltage') =~ /(\d+)/){
$update_cc->{int14} = $1; $update_cc->{int14} = $1;
$self->service_automatic($q) if($1 <= 50); $self->service_automatic($q) if($1 <= 50);
} }
@ -1710,6 +1716,14 @@ sub bikes_available(){
my $auth = shift; my $auth = shift;
my $authed = 0; my $authed = 0;
my $station = $q->escapeHTML($q->param('station')) || "";
my $station_id = $1 if($station =~ /(\d+)/);
my $bike = $q->escapeHTML($q->param('bike')) || "";
my $bike_id = $bike;
$bike_id =~ s/S[1-9]X/SX/;
$bike_id = $1 if($bike_id =~ /(\d+)/);
#my $users_serviceapp = $dbt->select_users($dbh,$auth->{c_id},"and int09=1"); #my $users_serviceapp = $dbt->select_users($dbh,$auth->{c_id},"and int09=1");
my $return={}; my $return={};
my $pref = { my $pref = {
@ -1726,13 +1740,11 @@ sub bikes_available(){
$main_ids =~ s/[a-z_-]+//ig;#should work also without Trenner $main_ids =~ s/[a-z_-]+//ig;#should work also without Trenner
$pref = { %$pref, main_id => "IN::($main_ids)" }; $pref = { %$pref, main_id => "IN::($main_ids)" };
if($q->param('station')){ if(looks_like_number($station_id)){
my $station_id = $1 if($q->param('station') =~ /(\d+)/); $pref = { %$pref, int04 => "=::" . $station_id };
$pref = { %$pref, int04 => "=::" . $q->escapeHTML($station_id) } if(looks_like_number($station_id));
} }
if($q->param('bike')){ if(looks_like_number($bike_id)){
my $bike_id = $1 if($q->param('bike') =~ /(\d+)/); $pref = { %$pref, barcode => "=::" . $bike_id };
$pref = { %$pref, barcode => "=::" . $q->escapeHTML($bike_id) } if(looks_like_number($bike_id));
} }
my $record = $dbt->fetch_record($dbh,$pref) if(ref($bike_group) eq "ARRAY" && @{$bike_group}[0]); my $record = $dbt->fetch_record($dbh,$pref) if(ref($bike_group) eq "ARRAY" && @{$bike_group}[0]);

View file

@ -192,8 +192,9 @@ elsif($q->param('request') eq "booking_request"){
if(ref($auth) eq "HASH" && $auth->{authcookie}){ if(ref($auth) eq "HASH" && $auth->{authcookie}){
my $bike = $q->escapeHTML($q->param('bike')) || ""; my $bike = $q->escapeHTML($q->param('bike')) || "";
if($bike){ if($bike){
my $bike_id = ""; my $bike_id = $bike;
$bike_id = $1 if($bike =~ /(\d+)/); $bike_id =~ s/S[1-9]X/SX/;
$bike_id = $1 if($bike_id =~ /(\d+)/);
#check count of occcupied/requested bikes #check count of occcupied/requested bikes
my $record = $apif->user_bikes_occupied($q,$authraw); my $record = $apif->user_bikes_occupied($q,$authraw);
@ -238,16 +239,18 @@ elsif($q->param('request') eq "booking_request"){
my $ct_bike = {}; my $ct_bike = {};
my $ct_tariff = {}; my $ct_tariff = {};
($ct_bike,$ct_tariff) = $apif->fetch_bike_tariff(\%varenv,$authraw,$bike,$aowner); ($ct_bike,$ct_tariff) = $apif->fetch_bike_tariff(\%varenv,$authraw,$bike,$aowner);
my $sig_book = {
rentalId => "",
reservationId => ""
};
if($ct_bike->{barcode} && $ct_tariff->{barcode}){ if($ct_bike->{barcode} && $ct_tariff->{barcode}){
my $reserveid = ""; #sig reservation. not mandatory
#disabled if($ct_bike->{int11} == 3){
#TODO, check if we need prios revervation for rental. After work maybe enable $sig_book = $si->sig_booking(\%varenv,$auth,$ct_bike,"","reserve");
if(1==2 && $ct_bike->{int11} == 3){
my $sigo_book = $si->sigo_booking(\%varenv,$auth,$ct_bike,"reserve");
$reserveid = $sigo_book->{reservationId} if($sigo_book->{reservationId});
} }
$response_book = $apif->booking_request(\%varenv,$authraw,$bike,$ct_bike,$ct_tariff,$aowner,$gps,$reserveid); $response_book = $apif->booking_request(\%varenv,$authraw,$bike,$ct_bike,$ct_tariff,$aowner,$gps,$sig_book);
}elsif(!$ct_tariff->{barcode}){ }elsif(!$ct_tariff->{barcode}){
$response->{response_state} = "Failure 2089: booking bike $bike fails, no user tariff available"; $response->{response_state} = "Failure 2089: booking bike $bike fails, no user tariff available";
$response->{response_text} = "Reservierungsfehler Fahrrad Nr. $bike. Es konnte kein Mietrad Tarif gefunden werden."; $response->{response_text} = "Reservierungsfehler Fahrrad Nr. $bike. Es konnte kein Mietrad Tarif gefunden werden.";
@ -268,13 +271,13 @@ elsif($q->param('request') eq "booking_request"){
}; };
my $dbh = ""; my $dbh = "";
$ctpos = $dbt->fetch_tablerecord($dbh,$booking_pos); $ctpos = $dbt->fetch_tablerecord($dbh,$booking_pos);
my $rentalid = ""; #sig booking
if($ctpos->{int11} == 3){ if($ctpos->{int11} == 3){
my $sigo_book = $si->sigo_booking(\%varenv,$auth,$ctpos,"rental"); #usecase with reservationId (in ctpos) is in sig not defined, thats because using ct_bike.txt22
$rentalid = $sigo_book->{rentalId} if($sigo_book->{rentalId}); $sig_book = $si->sig_booking(\%varenv,$auth,$ct_bike,$ctpos,"rental");
} }
(my $rows, my $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$rentalid); (my $rows, my $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
$response = {%$response, %$booking_values}; $response = {%$response, %$booking_values};
}else{ }else{
$response = {%$response, %$response_book}; $response = {%$response, %$response_book};
@ -313,8 +316,9 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
if(ref($auth) eq "HASH" && $auth->{authcookie}){ if(ref($auth) eq "HASH" && $auth->{authcookie}){
my $bike = $q->escapeHTML($q->param('bike')) || ""; my $bike = $q->escapeHTML($q->param('bike')) || "";
if($bike){ if($bike){
my $bike_id = ""; my $bike_id = $bike;
$bike_id = $1 if($bike =~ /(\d+)/); $bike_id =~ s/S[1-9]X/SX/;
$bike_id = $1 if($bike_id =~ /(\d+)/);
my $ctpos = {}; my $ctpos = {};
my $booking_pos = { my $booking_pos = {
@ -326,32 +330,38 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
}; };
$ctpos = $dbt->fetch_tablerecord($dbh,$booking_pos); $ctpos = $dbt->fetch_tablerecord($dbh,$booking_pos);
my $sig_book = {
rentalId => "",
reservationId => ""
};
if($q->param('request') eq "booking_update" && $q->param('state') && $q->param('state') =~ /canceled/){ if($q->param('request') eq "booking_update" && $q->param('state') && $q->param('state') =~ /canceled/){
my $booking_values = {};
my $reserveid = "";
if($ctpos->{int11} == 3){ if($ctpos->{int11} == 3){
my $sigo_book = $si->sigo_booking(\%varenv,$auth,$ctpos,"reserve_end"); #this sigo request is still not defined
$reserveid = $sigo_book->{reservationId} if($sigo_book->{reservationId}); #$sig_book = $si->sig_booking(\%varenv,$auth,"",$ctpos,"reserve_end");
$response->{response_state} = "Failure: sigo bike reservation can not be canceled on sigo";
$response->{response_text} = "Abbruch, die Reservierung kann nicht storniert werden";
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
}else{
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
} }
($rows, my $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$reserveid);
$response = {%$response, %$booking_values}; $response = {%$response, %$booking_values};
}elsif($q->param('request') eq "booking_update" && (($q->param('state') && $q->param('state') =~ /occupied|available/) || ($q->param('lock_state') && $q->param('lock_state') =~ /locking|locked|unlocking|unlocked/))){ }elsif($q->param('request') eq "booking_update" && (($q->param('state') && $q->param('state') =~ /occupied|available/) || ($q->param('lock_state') && $q->param('lock_state') =~ /locking|locked|unlocking|unlocked/))){
my $rentalid = "";
if($ctpos->{int11} == 3){ if($ctpos->{int11} == 3){
if($q->param('state') eq "occupied"){ if($q->param('state') eq "occupied"){
my $sigo_book = $si->sigo_booking(\%varenv,$auth,$ctpos,"rental"); $sig_book = $si->sig_booking(\%varenv,$auth,"",$ctpos,"rental");
$rentalid = $sigo_book->{rentalId} if($sigo_book->{rentalId});
} }
if($q->param('state') eq "available"){ if($q->param('state') eq "available"){
my $sigo_book = $si->sigo_booking(\%varenv,$auth,$ctpos,"rental_end"); $sig_book = $si->sig_booking(\%varenv,$auth,"",$ctpos,"rental_end");
$rentalid = $sigo_book->{rentalId} if($sigo_book->{rentalId});
} }
} }
($rows, my $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$rentalid); ($rows, my $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
$response = {%$response, %$booking_values}; $response = {%$response, %$booking_values};
#keep in mind, it works on operator dependency #keep in mind, it works on operator dependency
@ -423,8 +433,7 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
}else{ }else{
$response->{response_state} = "Failure: no bike defined"; $response->{response_state} = "Failure: no bike defined";
$response->{response_text} = "Abbruch, es wurde keine Fahrrad Nummer angegeben"; $response->{response_text} = "Abbruch, es wurde keine Fahrrad Nummer angegeben";
$response->{timeCode} = 0;#if fails
} }
}else{ }else{
$response->{response_state} = "Failure 1001: authcookie not defined"; $response->{response_state} = "Failure 1001: authcookie not defined";
@ -747,7 +756,13 @@ elsif($q->param('request') eq "service_done"){
my ($auth,$authraw) = $apif->auth_verify($q); my ($auth,$authraw) = $apif->auth_verify($q);
my $station_id = $1 if($q->param('station') =~ /(\d+)/); my $station_id = $1 if($q->param('station') =~ /(\d+)/);
my $bike_id = $1 if($q->param('bike') =~ /(\d+)/); #my $bike_id = $1 if($q->param('bike') =~ /(\d+)/);
my $bike = $q->escapeHTML($q->param('bike')) || "";
my $bike_id = $bike;
$bike_id =~ s/S[1-9]X/SX/;
$bike_id = $1 if($bike_id =~ /(\d+)/);
$response->{uri_operator} = "$varenv{wwwhost}"; $response->{uri_operator} = "$varenv{wwwhost}";
if(ref($auth) eq "HASH" && $auth->{authcookie}){ if(ref($auth) eq "HASH" && $auth->{authcookie}){
@ -883,9 +898,14 @@ elsif($q->param('request') eq "service_work"){
my ($auth,$authraw) = $apif->auth_verify($q); my ($auth,$authraw) = $apif->auth_verify($q);
my $station_id = ""; my $station_id = "";
my $bike_id = "";
$station_id = $1 if($q->param('station') =~ /(\d+)/); $station_id = $1 if($q->param('station') =~ /(\d+)/);
$bike_id = $1 if($q->param('bike') =~ /(\d+)/); #$bike_id = $1 if($q->param('bike') =~ /(\d+)/);
my $bike = $q->escapeHTML($q->param('bike')) || "";
my $bike_id = $bike;
$bike_id =~ s/S[1-9]X/SX/;
$bike_id = $1 if($bike_id =~ /(\d+)/);
$response->{uri_operator} = "$varenv{wwwhost}"; $response->{uri_operator} = "$varenv{wwwhost}";
my $node = {}; my $node = {};
my $response_work = {}; my $response_work = {};

View file

@ -55,6 +55,7 @@ sub new {
$ua->max_size( $bytes ); $ua->max_size( $bytes );
$ua->default_header( 'x-api-key' => $apikeyconf{sigo}->{api_key} ); $ua->default_header( 'x-api-key' => $apikeyconf{sigo}->{api_key} );
#will be called on bikes_available
sub sigo_available { sub sigo_available {
my $self = shift; my $self = shift;
my $q = shift; my $q = shift;
@ -90,14 +91,15 @@ sub sigo_available {
my $ret_json = $self->get_sigo("$endpoint",$rest_json); my $ret_json = $self->get_sigo("$endpoint",$rest_json);
eval { eval {
$response_in = decode_json($ret_json); $response_in = decode_json($ret_json);
print FILE "<--- station_and_bikes response_in:\n"; $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
print FILE "<--- $now_dt station_and_bikes response_in:\n";
#print FILE Dumper($response_in) . "\n"; #print FILE Dumper($response_in) . "\n";
if(ref($response_in) eq "HASH"){ if(ref($response_in) eq "HASH"){
foreach my $resp (@{ $response_in->{items} }) { foreach my $resp (@{ $response_in->{items} }) {
print FILE "response_in loop\n" . Dumper($resp) . "\n"; print FILE "response_in loop\n" . Dumper($resp) . "\n";
if($dbt->{operator}->{$varenv->{dbname}}->{operatorApp} && $q->param('request') eq "stations_available"){ if(ref($resp->{site}) eq "HASH" && $dbt->{operator}->{$varenv->{dbname}}->{operatorApp} && $q->param('request') eq "stations_available"){
#station (mainly using sigojson site object) #station (mainly using sigojson site object)
my $station = "SX$resp->{site}->{id}"; my $station = "SX$resp->{site}->{id}";
@ -150,11 +152,16 @@ sub sigo_available {
} }
}#end stations_available }#end stations_available
if($dbt->{operator}->{$varenv->{dbname}}->{operatorApp} && $q->param('request') eq "bikes_available"){ if(ref($resp->{site}) eq "HASH" && $dbt->{operator}->{$varenv->{dbname}}->{operatorApp} && $q->param('request') eq "bikes_available"){
#bike (mainly using sigojson state object) #bike (mainly using sigojson state object)
my $bike = "SX$resp->{mobile_bike_id}"; #my $bike = "SX$resp->{mobile_bike_id}";
if($bike && looks_like_number($resp->{mobile_bike_id}) && looks_like_number($resp->{site}->{id})){ my $bike = $q->escapeHTML($resp->{license_plate}) || "";
my $bike_id = $bike;
$bike_id =~ s/S[1-9]X/SX/;
$bike_id = $1 if($bike_id =~ /(\d+)/);
if($bike && looks_like_number($bike_id) && looks_like_number($resp->{site}->{id})){
print FILE "Bike: $bike\n"; print FILE "Bike: $bike\n";
$response_out->{$bike}->{bike} = "$bike"; $response_out->{$bike}->{bike} = "$bike";
$response_out->{$bike}->{authed} = "$authed"; $response_out->{$bike}->{authed} = "$authed";
@ -165,14 +172,12 @@ sub sigo_available {
$response_out->{$bike}->{gps}->{longitude} = "$resp->{state}->{lon}" || ""; $response_out->{$bike}->{gps}->{longitude} = "$resp->{state}->{lon}" || "";
$response_out->{$bike}->{bike_charge} = "$resp->{energy_level}" || "0"; $response_out->{$bike}->{bike_charge} = "$resp->{energy_level}" || "0";
$response_out->{$bike}->{state} = "defect"; $response_out->{$bike}->{state} = "defect";
if($resp->{status} eq "ACTIVE"){#? if($resp->{reservation_state} eq "RESERVED"){
$response_out->{$bike}->{state} = "available"; $response_out->{$bike}->{state} = "requested";
}elsif($resp->{status} eq "MAINTANANCE"){ }elsif($resp->{reservation_state} eq "ACTIVE-RENTAL"){
$response_out->{$bike}->{state} = "maintanance";
}elsif($resp->{status} eq "OFFLINE"){
$response_out->{$bike}->{state} = "defect";
}elsif($resp->{status} eq "OPERATION"){#?
$response_out->{$bike}->{state} = "occupied"; $response_out->{$bike}->{state} = "occupied";
}elsif(!$resp->{reservation_state}){
$response_out->{$bike}->{state} = "available";
} }
#$response_out->{$bike}->{lock_state} = "undefined";#? #$response_out->{$bike}->{lock_state} = "undefined";#?
@ -227,8 +232,8 @@ sub sigo_available {
} }
#just like caching #just like caching
$return2copri->{$bike}->{int11} = 3; $return2copri->{$bike}->{int11} = 3;
$return2copri->{$bike}->{barcode} = $1 if($response_out->{$bike}->{bike} =~ /(\d+)/); $return2copri->{$bike}->{barcode} = $bike_id;
$return2copri->{$bike}->{txt22} = $resp->{id};#bike id like 380116b5-0522-43da-ab66-477744a731a3 $return2copri->{$bike}->{txt22} = $resp->{id};#sig bikeId like 380116b5-0522-43da-ab66-477744a731a3
$return2copri->{$bike}->{int04} = $1 if($response_out->{$bike}->{station} =~ /(\d+)/); $return2copri->{$bike}->{int04} = $1 if($response_out->{$bike}->{station} =~ /(\d+)/);
$return2copri->{$bike}->{txt01} = "$response_out->{$bike}->{description}"; $return2copri->{$bike}->{txt01} = "$response_out->{$bike}->{description}";
$return2copri->{$bike}->{txt06} = "$response_out->{$bike}->{gps}->{latitude},$response_out->{$bike}->{gps}->{longitude}"; $return2copri->{$bike}->{txt06} = "$response_out->{$bike}->{gps}->{latitude},$response_out->{$bike}->{gps}->{longitude}";
@ -262,16 +267,17 @@ sub sigo_available {
}#end sigo_available }#end sigo_available
#POST resverve, rental, ... #POST resverve, rental, ...
sub sigo_booking { sub sig_booking {
my $self = shift; my $self = shift;
my $varenv = shift || {}; my $varenv = shift || {};
my $auth = shift || {}; my $auth = shift || {};
my $ct_bike = shift || {}; my $ct_bike = shift || {};
my $ctpos = shift || {};
my $todo = shift || ""; my $todo = shift || "";
my $dbh = ""; my $dbh = "";
my $owner = 169; my $owner = 169;
my $sigo_book = {}; my $sig_book = {};
open(FILE,">>$varenv->{logdir}/APIsigo_client.log"); open(FILE,">>$varenv->{logdir}/APIsigo_client.log");
print FILE "\n*** $now_dt 'sigo_post $todo' \n"; print FILE "\n*** $now_dt 'sigo_post $todo' \n";
@ -279,6 +285,7 @@ sub sigo_booking {
my $endpoint = "$dbt->{operator}->{$varenv->{dbname}}->{endpoint}/"; my $endpoint = "$dbt->{operator}->{$varenv->{dbname}}->{endpoint}/";
my %json = (); my %json = ();
#reservation start
if($todo eq "reserve"){ if($todo eq "reserve"){
$endpoint .= "bikes/reserve"; $endpoint .= "bikes/reserve";
%json = ( %json = (
@ -286,13 +293,33 @@ sub sigo_booking {
email => "r.guempelein\@sharee.bike" email => "r.guempelein\@sharee.bike"
); );
} }
elsif($todo eq "rental"){ #reservation end, this sigo request is still not defined
$endpoint .= "rental"; elsif($todo eq "reserve_end"){
$endpoint .= "reserve/end";
%json = ( %json = (
bikeId => "$ct_bike->{txt22}", reservationId => "$ctpos->{txt10}",
email => "r.guempelein\@sharee.bike" email => "r.guempelein\@sharee.bike"
); );
} }
#rental start
elsif($todo eq "rental"){
$endpoint .= "rental";
my $sig_serial = $ctpos->{txt22} || $ct_bike->{txt22};
%json = (
bikeId => "$sig_serial",
#reservationId => "$ctpos->{txt10}",#not in sig implemented
email => "r.guempelein\@sharee.bike"
);
}
#rental end
elsif($todo eq "rental_end"){
$endpoint .= "rental/end";
%json = (
rentalId => "$ctpos->{txt11}",
email => "r.guempelein\@sharee.bike"
);
#keep in mind, it will return no json, just text: "Rental Ended"
}
else{ else{
print "Failure, request $todo not defined\n"; print "Failure, request $todo not defined\n";
@ -304,22 +331,22 @@ sub sigo_booking {
my $rest_json = encode_json(\%json); my $rest_json = encode_json(\%json);
my $ret_json = $self->post_sigo($endpoint,$rest_json); my $ret_json = $self->post_sigo($endpoint,$rest_json);
# $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
eval { eval {
$sigo_book = decode_json($ret_json); $sig_book = decode_json($ret_json);
print FILE "<--- sigo_post $todo response_in:\n" . Dumper($sigo_book); print FILE "<--- $now_dt sigo_post $todo response_in:\n" . Dumper($sig_book);
print $ret_json . "\n"; #print $ret_json . "\n";
}; };
if ($@){ if ($@){
print FILE "<--- failure sigo_post $todo raw response_in:\n" . Dumper($ret_json) . "\n"; print FILE "<--- $now_dt failure sigo_post $todo raw response_in:\n" . Dumper($ret_json) . "\n";
#warn $@; #warn $@;
print FILE "warn:" . $@ . "\n"; print FILE "warn:" . $@ . "\n";
} }
} }
close(FILE); close(FILE);
return $sigo_book; return $sig_book;
} }

View file

@ -1315,7 +1315,7 @@ sub insert_pos(){
my $ct_name = shift || ""; my $ct_name = shift || "";
my $status = shift || ""; my $status = shift || "";
my $owner = shift || ""; my $owner = shift || "";
my $reserveid = shift || ""; my $sig_book = shift || {};
$ct_name = $ct->{barcode} if(!$ct_name);#artikelnr or bikenr $ct_name = $ct->{barcode} if(!$ct_name);#artikelnr or bikenr
my $prefix = ""; my $prefix = "";
@ -1368,7 +1368,7 @@ sub insert_pos(){
my $sth; my $sth;
#Verleihräder #Verleihräder
if($ct->{template_id} && $ct->{template_id} == 205){#Leihrad_list if($ct->{template_id} && $ct->{template_id} == 205){#Leihrad_list
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt01,txt08,txt02,txt09,txt12,itime,start_time,end_time,int02,int03,int06,int04,txt05,txt06,txt07,int10,int12,int13,owner,int07,txt04,int09,int17,int15,int16,int11,int18,int19,txt17,txt18,int20,int25,int34,txt22,txt10,int35,int36,int37,time01,time02) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','$ct->{barcode}','$ct->{txt01}','$user_name','$ct->{txt02}','$ctadr->{txt09}','$prefix',now(),now(),'$endRental','$unit_price','$menge','$station','$station','$ct->{txt06}','$ct->{txt06}','$ct->{txt07}','$status','$from_main_id','$deviceId','$owner','$rabatt','$tariff_desc','$tariff_nr','$daymax_price','$abo_price','$free_hours','$ct->{int11}','$sharing_type','$bike_charge','$ct->{txt17}','$ct->{txt18}','$ct->{int20}','$trackon','$staff','$ct->{txt22}','$reserveid','$unit_price1','$unit_price2','$start_price','$unit_time','$free_time') RETURNING c_id"); $sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt01,txt08,txt02,txt09,txt12,itime,start_time,end_time,int02,int03,int06,int04,txt05,txt06,txt07,int10,int12,int13,owner,int07,txt04,int09,int17,int15,int16,int11,int18,int19,txt17,txt18,int20,int25,int34,txt22,txt10,int35,int36,int37,time01,time02) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','$ct->{barcode}','$ct->{txt01}','$user_name','$ct->{txt02}','$ctadr->{txt09}','$prefix',now(),now(),'$endRental','$unit_price','$menge','$station','$station','$ct->{txt06}','$ct->{txt06}','$ct->{txt07}','$status','$from_main_id','$deviceId','$owner','$rabatt','$tariff_desc','$tariff_nr','$daymax_price','$abo_price','$free_hours','$ct->{int11}','$sharing_type','$bike_charge','$ct->{txt17}','$ct->{txt18}','$ct->{int20}','$trackon','$staff','$ct->{txt22}','$sig_book->{reservationId}','$unit_price1','$unit_price2','$start_price','$unit_time','$free_time') RETURNING c_id");
}else{ }else{
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt08,txt09,itime,int02,int03,txt01,txt06,txt07,int10,int12,owner) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','0','$user_name','$ctadr->{txt09}',now(),'$unit_price1','1','$ct->{txt01}','$ct->{txt06}','$ct->{txt07}','0','$from_main_id','$owner') RETURNING c_id"); $sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt08,txt09,itime,int02,int03,txt01,txt06,txt07,int10,int12,owner) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','0','$user_name','$ctadr->{txt09}',now(),'$unit_price1','1','$ct->{txt01}','$ct->{txt06}','$ct->{txt07}','0','$from_main_id','$owner') RETURNING c_id");
} }

View file

@ -731,9 +731,9 @@ sub payone_capture(){
open(EMA, ">> $varenv->{logdir}/copri-print.log"); open(EMA, ">> $varenv->{logdir}/copri-print.log");
print EMA "\n$now_dt\n$topdf --page-size A4 \"$varenv->{wwwhost}/Printpreview?printer_id=PDF\&mandant_main_id=$mandant_id\&main_id=$main_id\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$ctt->{c_id}\&u_id=$owner\&wc=$wc_line\" $varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\n"; print EMA "\n$now_dt\n$topdf --page-size A4 \"$varenv->{wwwhost}/Printpreview?printer_id=PDF\&mandant_main_id=$mandant_id\&main_id=$main_id\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$ctt->{c_id}\&u_id=$owner\&wc=$wc_line\" $varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\n";
#send_invoice infomail #send_invoice infomail, only if eMail never sent
if(-f "$varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf"){ if(-f "$varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf" && !$ctt->{txt30}){
system(`$varenv->{basedir}/src/scripts/mailTransport.pl "$varenv->{syshost}" "send_invoice" "$ctt->{c_id}" "$praefix-$ctt->{ct_name}.pdf"`); system("$varenv->{basedir}/src/scripts/mailTransport.pl '$varenv->{syshost}' 'send_invoice' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'");
print EMA "---> Sent Invoice e-mail command: $varenv->{basedir}/src/scripts/mailTransport.pl '$varenv->{syshost}' 'send_invoice' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'\n"; print EMA "---> Sent Invoice e-mail command: $varenv->{basedir}/src/scripts/mailTransport.pl '$varenv->{syshost}' 'send_invoice' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'\n";
} }
close EMA; close EMA;

View file

@ -203,10 +203,8 @@ sub preinit(){
$table = "contenttranspos"; $table = "contenttranspos";
my $menge="1"; my $menge="1";
#Leihrad-logik my $zcolumn = "barcode";
my ($zcolumn,$zcontent,$ct_node); my $zcontent = "$R::spart_ct_name" || "$R::json_select";
$zcolumn = "barcode";
$zcontent = "$R::spart_ct_name" || "$R::json_select";
#get part for adding and get from_main_id #get part for adding and get from_main_id
my $ct_name = "$R::spart_ct_name" || "$R::json_select" || "";#turn-around!§$ my $ct_name = "$R::spart_ct_name" || "$R::json_select" || "";#turn-around!§$
@ -223,21 +221,13 @@ sub preinit(){
if($ct->{main_id}){ if($ct->{main_id}){
$ct_node = $db->get_node4multi($ct->{main_id},$lang);
#check if part linked to mandant
my $mandant_check;
$waren = $db->get_node2($varenv{wwwhost},"Waren",$lang);
$mandant_check = $db->collect_noderec($waren->{main_id},$lang,"nothing") if($waren->{main_id});
$mandant_check =~ s/,/|/g;
$users_dms = $db->select_users($users_dms->{u_id}) if($ib_key =~ /new_/);#nur bei new_ mit save_ $users_dms = $db->select_users($users_dms->{u_id}) if($ib_key =~ /new_/);#nur bei new_ mit save_
if(!$users_dms->{c_id4trans} && $ib_key !~ /new_transdate/){ if(!$users_dms->{c_id4trans} && $ib_key !~ /new_transdate/){
return "failure::Zu welchem Vorgang soll die Aktion verknüpft werden? Bitte erst den entsprechenden Vorgang öffnen."; return "failure::Zu welchem Vorgang soll die Aktion verknüpft werden? Bitte erst den entsprechenden Vorgang öffnen.";
}elsif($ct->{main_id} && ($ct_node->{main_id} !~ /$mandant_check/)){
return "failure::Der Artikel \"$R::spart_ct_name\" ist in der Datenbank vorhanden, aber nicht in \"$ctf->{ct_name}\" verlinkt<br />Kläre bitte ob eine Faktura hier in Zukunft gewollt ist. Falls ja, informiere den Admin damit dieser die Verknüpfung herstellt.";
} }
} }
if(($ct_name || $ct->{barcode}) && $rel->{content_id} && $ct_node->{main_id}){ if(($ct_name || $ct->{barcode}) && $rel->{content_id}){
my $partnr = "$ct_name / $ct->{barcode}"; my $partnr = "$ct_name / $ct->{barcode}";
$partnr = "$ct_name" if("$ct_name" eq "$ct->{barcode}" || !$ct->{barcode}); $partnr = "$ct_name" if("$ct_name" eq "$ct->{barcode}" || !$ct->{barcode});
my $bezeichnung = "$ct->{txt01}"; my $bezeichnung = "$ct->{txt01}";
@ -246,18 +236,8 @@ sub preinit(){
my $einzel_rabatt = $ct->{int07}; my $einzel_rabatt = $ct->{int07};
$einzel_rabatt = $ctt->{int06} if($ctt->{int06} > 0); $einzel_rabatt = $ctt->{int06} if($ctt->{int06} > 0);
my $unit = $ct->{txt03}; my $unit = $ct->{txt03};
if($ctf->{int02} != 0 && $ct->{int09} != 0){
$einzel_preis = $ctf->{int02};
$menge = $ct->{int09};
$unit = "AW";
}
#umst
my $umst=0;
$umst = $ct_node->{int03};
$umst = $1 if($ctf->{txt13} =~ /(\d+)/ && $ct_node->{int03} !~ /\d/);#Standard VK Umst
#Add Parts from content to contenttranspos################# #Add Parts from content to contenttranspos#################
my $pos_id; my $pos_id;
#Sort counter #Sort counter
@ -266,18 +246,9 @@ sub preinit(){
my $ctt = $db->get_content1("contenttrans",$users_dms->{c_id4trans}); my $ctt = $db->get_content1("contenttrans",$users_dms->{c_id4trans});
#INSERT pos #INSERT pos
$pos_id = $db->insert_contenttranspos($table,$partnr,$users_dms->{u_id},$ct->{barcode},$ct->{c_id},$ctt->{c_id},$ct->{main_id},$bezeichnung,$ct_node->{node_name},$unit,$einzel_preis,$menge,$umst,$einzel_rabatt,$lager,"","$ct->{txt05}","$ct->{txt06}","$ct->{txt07}","$ctt->{txt08}","$ctt->{int10}"); $pos_id = $db->insert_contenttranspos($table,$partnr,$users_dms->{u_id},$ct->{barcode},$ct->{c_id},$ctt->{c_id},$ct->{main_id},$bezeichnung,"",$unit,$einzel_preis,$menge,"",$einzel_rabatt,$lager,"","$ct->{txt05}","$ct->{txt06}","$ct->{txt07}","$ctt->{txt08}","$ctt->{int10}");
$i_rows += 1 if($pos_id > 0); $i_rows += 1 if($pos_id > 0);
#append Rahmennummer
if($ct->{txt11}){
my $rahmennr = "$ct->{txt11}";
$rahmennr = "$ctt->{txt11} | $ct->{txt11}" if($ctt->{txt11});#add nr.
$db->updater("contenttrans","c_id",$rel->{content_id},"txt11",$rahmennr,$users_dms->{u_id});
}
#}
#################################################################
#negate if not rental-bike #negate if not rental-bike
if(($ct->{template_id} ne "205") && ($ctt->{txt00} !~ /Angebot|Kostenvoranschlag|Auftrag|Storno/) && !$R::c_idpos){ if(($ct->{template_id} ne "205") && ($ctt->{txt00} !~ /Angebot|Kostenvoranschlag|Auftrag|Storno/) && !$R::c_idpos){
@ -781,7 +752,7 @@ sub preinit(){
#my $key_pdf; #my $key_pdf;
#$key_pdf = `/usr/bin/pdftotext $varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf - | grep "Seite:"`; #$key_pdf = `/usr/bin/pdftotext $varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf - | grep "Seite:"`;
#system(`$varenv{basedir}/src/Mod/newsletter_tink.pl "$varenv{basedir}" "$varenv{wwwhost}" "send_invoice" "$ctt->{int10}" "$ctt->{ct_name}"`);# if($key_pdf =~ /Seite:/); #system(`$varenv{basedir}/src/Mod/newsletter_tink.pl "$varenv{basedir}" "$varenv{wwwhost}" "send_invoice" "$ctt->{int10}" "$ctt->{ct_name}"`);# if($key_pdf =~ /Seite:/);
system(`$varenv{basedir}/src/scripts/mailTransport.pl "$varenv{syshost}" "send_invoice" "$ctt->{c_id}" "$praefix-$ctt->{ct_name}.pdf"`); system("$varenv{basedir}/src/scripts/mailTransport.pl '$varenv{syshost}' 'send_invoice' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'");
} }
# #

View file

@ -243,11 +243,11 @@ sub counting_rental {
my $discount_val = $ctpos->{int07} || 0; my $discount_val = $ctpos->{int07} || 0;
if($discount_val != 0 && $total_price){ if($discount_val != 0 && $total_price){
my $discount_eur = $discount_val; my $discount_eur = $discount_val;
$discount_eur = $total_price * $discount_val/100 if($ctpos->{int08} != 1); $discount_eur = $total_price * $discount_val/100 if(!$ctpos->{int08} || $ctpos->{int08} != 1);
$total_price -= $discount_eur; $total_price -= $discount_eur;
$discount = "-" . $ctpos->{int07}; $discount = "-" . $ctpos->{int07};
if($ctpos->{int08} == 1){ if($ctpos->{int08} && $ctpos->{int08} == 1){
$discount .= " €"; $discount .= " €";
}else{ }else{
$discount =~ s/\.00//; $discount =~ s/\.00//;
@ -345,7 +345,7 @@ sub fetch_rentalfeed {
}elsif($td_template->{$td}->{time02} && $ctpos->{time02} =~ /[1-9]/){ }elsif($td_template->{$td}->{time02} && $ctpos->{time02} =~ /[1-9]/){
$time_unit = $dbt->time_format($ctpos->{time02}); $time_unit = $dbt->time_format($ctpos->{time02});
$return->{tariff_description2}->{$td} = ["$td_template->{$td}->{time02}","$time_unit / Tag"]; $return->{tariff_description2}->{$td} = ["$td_template->{$td}->{time02}","$time_unit / Tag"];
}elsif($td_template->{$td}->{xduration} && $returned_counting->{real_clock} =~ /[1-9]/){ }elsif($td_template->{$td}->{xduration} && $returned_counting->{real_clock} && $returned_counting->{real_clock} =~ /[1-9]/){
$time_unit = $dbt->time_format($returned_counting->{real_clock}); $time_unit = $dbt->time_format($returned_counting->{real_clock});
$return->{tariff_description2}->{$td} = ["$td_template->{$td}->{xduration}","$time_unit"]; $return->{tariff_description2}->{$td} = ["$td_template->{$td}->{xduration}","$time_unit"];
}elsif($td_template->{$td}->{xprice} && $returned_counting->{total_price} && $returned_counting->{total_price} > 0){ }elsif($td_template->{$td}->{xprice} && $returned_counting->{total_price} && $returned_counting->{total_price} > 0){
@ -562,14 +562,14 @@ sub price2calc {
my $ctpos = shift; my $ctpos = shift;
my $total = 0; my $total = 0;
my $discount = ""; my $discount = 0;
my $einzel = $ctpos->{int02}; my $einzel = $ctpos->{int02} || 0;
my $menge = $ctpos->{int03}; my $menge = $ctpos->{int03} || 0;
my $discount_val = $ctpos->{int07} || 0; my $discount_val = $ctpos->{int07} || 0;
if($discount_val != 0 && $einzel && $menge){ if($discount_val != 0 && $einzel && $menge){
my $discount_eur = $discount_val; my $discount_eur = $discount_val;
#if int08 != 1 alias € #if int08 != 1 alias €
$discount_eur = $einzel * $menge * $discount_val/100 if($ctpos->{int08} != 1); $discount_eur = $einzel * $menge * $discount_val/100 if(!$ctpos->{int08} || $ctpos->{int08} != 1);
$total = $einzel * $menge - $discount_eur; $total = $einzel * $menge - $discount_eur;
}elsif($einzel && $menge){ }elsif($einzel && $menge){
$total = $einzel * $menge; $total = $einzel * $menge;
@ -577,7 +577,7 @@ sub price2calc {
if($ctpos->{int07} && $ctpos->{int07} > 0 && $menge > 0){ if($ctpos->{int07} && $ctpos->{int07} > 0 && $menge > 0){
$discount = "-" . $ctpos->{int07}; $discount = "-" . $ctpos->{int07};
if($ctpos->{int08} == 1){ if($ctpos->{int08} && $ctpos->{int08} == 1){
$discount .= " €"; $discount .= " €";
}else{ }else{
$discount =~ s/\.00//; $discount =~ s/\.00//;
@ -588,34 +588,5 @@ sub price2calc {
return ($total,$discount); return ($total,$discount);
} }
#computes rental position price and rabatt
sub rental_price2calc {
my $self = shift;
my $ctpos = shift || {};
my $pricing = shift || {};
my $total = 0;
my $discount = "";
my $discount_val = $ctpos->{int07} || 0;
if($discount_val != 0 && $pricing->{total_price}){
my $discount_eur = $discount_val;
#if int08 != 1 alias €
$discount_eur = $pricing->{total_price} * $discount_val/100 if($ctpos->{int08} != 1);
$total = $pricing->{total_price} - $discount_eur;
}elsif($pricing->{total_price}){
$total = $pricing->{total_price};
}
if($ctpos->{int07} && $ctpos->{int07} > 0){
$discount = "-" . $ctpos->{int07};
if($ctpos->{int08} == 1){
$discount .= " €";
}else{
$discount =~ s/\.00//;
$discount .= " %";
}
}
return ($total,$discount);
}
1; 1;

View file

@ -114,7 +114,7 @@ EOF
print "</div>\n"; print "</div>\n";
print $q->div({-class=>"content2_legende", -style=>'font-weight:bold;'}, "&bull; Ist ein Lastenrad an einer Mietradstation verfügbar?"),"\n"; #print $q->div({-class=>"content2_legende", -style=>'font-weight:bold;'}, "&bull; Ist ein Lastenrad an einer Mietradstation verfügbar?"),"\n";
print $q->div({-class=>"content2_legende"}, $q->img({-style=>'height:30px;', -src=>"$varenv->{metahost}/img/$icon_green"}), "Lastenrad verfügbar"),"\n"; print $q->div({-class=>"content2_legende"}, $q->img({-style=>'height:30px;', -src=>"$varenv->{metahost}/img/$icon_green"}), "Lastenrad verfügbar"),"\n";
print $q->div({-class=>"content2_legende"}, $q->img({-style=>'height:30px;', -src=>"$varenv->{metahost}/img/$icon_red"}), "Lastenrad nicht verfügbar"),"\n"; print $q->div({-class=>"content2_legende"}, $q->img({-style=>'height:30px;', -src=>"$varenv->{metahost}/img/$icon_red"}), "Lastenrad nicht verfügbar"),"\n";
print $q->div({-class=>"content2_legende"}, "&nbsp;"),"\n"; print $q->div({-class=>"content2_legende"}, "&nbsp;"),"\n";

View file

@ -70,7 +70,7 @@ sub tpl(){
my $vibuchen_mtime = ""; my $vibuchen_mtime = "";
$vibuchen_mtime = "Payone post " . $lb->time4de($ctt->{pay_time},1) . " . " if($ctt->{pay_time}); $vibuchen_mtime = "Payone post " . $lb->time4de($ctt->{pay_time},1) . " . " if($ctt->{pay_time});
my @tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=timerange","int03=Menge","int02=Preis","int07=Rabatt","int04=Gesamt"); my @tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=timerange","int03=Menge (Miet - Gratis Zeit)","int02=Preis","int07=Rabatt","int04=Gesamt");
my $tplf = $db->get_tpl("201");#Firma tpl my $tplf = $db->get_tpl("201");#Firma tpl
my @tplf_order = split /,/,$tplf->{tpl_order}; my @tplf_order = split /,/,$tplf->{tpl_order};
@ -83,7 +83,7 @@ sub tpl(){
foreach my $id (keys(%$cttpos)){ foreach my $id (keys(%$cttpos)){
if(ref($cttpos->{$id}) eq "HASH"){ if(ref($cttpos->{$id}) eq "HASH"){
if($cttpos->{$id}->{int26}){ if($cttpos->{$id}->{int26}){
@tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=timerange","int26=Einsparung","int03=Menge","int02=Preis","int07=Rabatt","int04=Gesamt"); @tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=timerange","int26=Einsparung","int03=Menge (Miet - Gratis Zeit)","int02=Preis","int07=Rabatt","int04=Gesamt");
} }
#enhanced tariff #enhanced tariff
#if($cttpos->{$id}->{int35}){ #if($cttpos->{$id}->{int35}){
@ -299,7 +299,7 @@ EOF
print $q->span({-style=>"$txtstyle $set_style"}, print $q->span({-style=>"$txtstyle $set_style"},
"Endstation: ", $q->textfield(-class=>'etxt',-name=>"int04",-default=>"$cttpos->{$id}->{int04}",-size=>"5",-maxlength=>40), "Endstation: ", $q->textfield(-class=>'etxt',-name=>"int04",-default=>"$cttpos->{$id}->{int04}",-size=>"5",-maxlength=>40),
"GPS: ", $q->textfield(-class=>'etxt',-name=>"txt06",-default=>"$cttpos->{$id}->{txt06}",-size=>"35",-maxlength=>40)),"<br />\n"; "GPS: ", $q->textfield(-class=>'etxt',-name=>"txt06",-default=>"$cttpos->{$id}->{txt06}",-size=>"30",-maxlength=>40)),"<br />\n";
print $q->span({-style=>"$txtstyle $set_style"},"Mietzeit: ", print $q->span({-style=>"$txtstyle $set_style"},"Mietzeit: ",
$q->textfield(-id=>'datepicker1',-class=>'etxt',-name=>"start_date",-default=>"$s_dd.$s_mo.$s_yy",-size=>"8",-maxlength=>10), $q->textfield(-id=>'datepicker1',-class=>'etxt',-name=>"start_date",-default=>"$s_dd.$s_mo.$s_yy",-size=>"8",-maxlength=>10),

View file

@ -36,23 +36,23 @@ my $todo = $ARGV[1];
if($todo eq "available"){ if($todo eq "available"){
$q->param(-name=>'request',-value=>"bikes_available"); $q->param(-name=>'request',-value=>"bikes_available");
my $auth = { c_id => 0 }; my $auth = { c_id => 0 };
my $return = $si->sigo_available($q,\%varenv,$auth); my $return = $si->sigo_available($q,\%varenv,$auth);
print $0 . Dumper($return) . "\n"; #print $0 . Dumper($return) . "\n";
} }
if($todo eq "reserve"){ if($todo eq "reserve"){
my $auth = { c_id => 1842 }; my $auth = { c_id => 1842 };
my $bike = { txt22 => "380116b5-0522-43da-ab66-477744a731a3" };# bike 1150 my $bike = { txt22 => "380116b5-0522-43da-ab66-477744a731a3" };# bike 1150
#my $bike = "SX1150";# bike 1150 from app booking_request #my $bike = "SX1150";# bike 1150 from app booking_request
my $return = $si->sigo_booking(\%varenv,$auth,$bike,$todo); my $return = $si->sigo_booking(\%varenv,$auth,$bike,$todo);
print $0 . Dumper($return) . "\n"; #print $0 . Dumper($return) . "\n";
} }
if($todo eq "rental"){ if($todo eq "rental"){
my $auth = { c_id => 1842 }; my $auth = { c_id => 1842 };
my $bike = { txt22 => "380116b5-0522-43da-ab66-477744a731a3" };# bike 1150 my $bike = { txt22 => "380116b5-0522-43da-ab66-477744a731a3" };# bike 1150
#my $bike = "SX1150";# bike 1150 from app booking_request #my $bike = "SX1150";# bike 1150 from app booking_request
my $return = $si->sigo_booking(\%varenv,$auth,$bike,$todo); my $return = $si->sigo_booking(\%varenv,$auth,$bike,$todo);
print $0 . Dumper($return) . "\n"; #print $0 . Dumper($return) . "\n";
} }

View file

@ -190,15 +190,18 @@ print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$bookin
my $booking_update_locking = "$uriop?request=booking_update&bike=$bike&lock_state=locking$and_station_state_locking&authcookie=$coo"; my $booking_update_locking = "$uriop?request=booking_update&bike=$bike&lock_state=locking$and_station_state_locking&authcookie=$coo";
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_locking"},"[ booking_update_locking ]---> $booking_update_locking")),"\n"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_locking"},"[ booking_update_locking ]---> $booking_update_locking")),"\n";
my $booking_update_locked = "$uriop?request=booking_update&bike=$bike&lock_state=locked$and_station_state_locked&authcookie=$coo"; my $booking_update_locked = "$uriop?request=booking_update&bike=$bike&lock_state=locked$and_station_state_locked&authcookie=$coo";
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_locked"},"[ booking_update_locked ]---> $booking_update_locked")),"\n"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_locked"},"[ booking_update_locked ]---> $booking_update_locked")),"\n";
my $booking_update_unlocking = "$uriop?request=booking_update&bike=$bike&lock_state=unlocking$and_station_state_unlocked&voltage=39&authcookie=$coo";
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_unlocking"},"[ booking_update_unlocking ]---> $booking_update_unlocking")),"\n"; my $booking_update_occupied_unlocking = "$uriop?request=booking_update&bike=$bike&state=occupied&lock_state=unlocking$and_station_state_unlocked&authcookie=$coo";
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_occupied_unlocking"},"[ booking_update_occupied_unlocking ]---> $booking_update_occupied_unlocking")),"\n";
my $booking_update_unlocked = "$uriop?request=booking_update&bike=$bike&lock_state=unlocked$and_station_state_unlocked&voltage=39&authcookie=$coo"; my $booking_update_unlocked = "$uriop?request=booking_update&bike=$bike&lock_state=unlocked$and_station_state_unlocked&voltage=39&authcookie=$coo";
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_unlocked"},"[ booking_update_unlocked ]---> $booking_update_unlocked")),"\n"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_unlocked"},"[ booking_update_unlocked ]---> $booking_update_unlocked")),"\n";
my $booking_update_oc_ul = "$uriop?request=booking_update&bike=$bike&state=occupied&lock_state=unlocked$and_station_state_unlocked&authcookie=$coo"; my $booking_update_occupied_unlocked = "$uriop?request=booking_update&bike=$bike&state=occupied&lock_state=unlocked$and_station_state_unlocked&authcookie=$coo";
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_oc_ul"},"[ booking_update_oc_ul ]---> $booking_update_oc_ul")),"\n"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_occupied_unlocked"},"[ booking_update_occupied_unlocked ]---> $booking_update_occupied_unlocked")),"\n";
my $booking_request_oc_uling = "$uriop?request=booking_request&bike=$bike&state=occupied&lock_state=unlocking$and_station_state_unlocked&authcookie=$coo"; my $booking_request_oc_uling = "$uriop?request=booking_request&bike=$bike&state=occupied&lock_state=unlocking$and_station_state_unlocked&authcookie=$coo";
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_request_oc_uling"},"[ booking_request_oc_unlocking ]---> $booking_request_oc_uling")),"\n"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_request_oc_uling"},"[ booking_request_oc_unlocking ]---> $booking_request_oc_uling")),"\n";

View file

@ -43,9 +43,9 @@ sub tpl(){
my $coo = $q->cookie('domcookie') || $q->param('sessionid') || ""; my $coo = $q->cookie('domcookie') || $q->param('sessionid') || "";
#my $api_test = "sharee_kn"; #my $api_test = "sharee_kn";
my $api_test = "sharee_fr01"; my $bike="FR1538"; #my $api_test = "sharee_fr01"; my $bike="FR1538";
#my $api_test = "sharee_wue"; #my $api_test = "sharee_wue";
#my $api_test = "sharee_sx"; my $bike="SX1150"; my $api_test = "sharee_sx"; my $bike="S3X1001";
#my $api_test = "sharee_ren"; my $bike="REN2"; #my $api_test = "sharee_ren"; my $bike="REN2";
print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"background-color:#ffffff;color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test\&bike=$bike", -target=>'_blank'}," [ tests --> $api_test ] "),"$users_sharee->{txt08}",$q->a({-style=>"color:#$bgcolor1;", -href=>"logout_sharee$session"},"logout")),"\n"; print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"background-color:#ffffff;color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test\&bike=$bike", -target=>'_blank'}," [ tests --> $api_test ] "),"$users_sharee->{txt08}",$q->a({-style=>"color:#$bgcolor1;", -href=>"logout_sharee$session"},"logout")),"\n";

View file

@ -49,9 +49,9 @@ sub tpl(){
if($users_sharee->{c_id} eq $varenv->{superu_id} || $dbt->{copri_conf}->{stage} eq "test"){ if($users_sharee->{c_id} eq $varenv->{superu_id} || $dbt->{copri_conf}->{stage} eq "test"){
my $coo = $q->cookie('domcookie') || $q->param('sessionid') || $dbt->{website}->{$varenv->{syshost}}->{merchant_id}; my $coo = $q->cookie('domcookie') || $q->param('sessionid') || $dbt->{website}->{$varenv->{syshost}}->{merchant_id};
#my $api_test = "sharee_kn"; #my $api_test = "sharee_kn";
my $api_test = "sharee_fr01"; my $bike="FR1538"; #my $api_test = "sharee_fr01"; my $bike="FR1538";
#my $api_test = "sharee_wue"; #my $api_test = "sharee_wue";
#my $api_test = "sharee_sx"; my $bike="SX1150"; my $api_test = "sharee_sx"; my $bike="S3X1001";
#my $api_test = "sharee_ren"; my $bike="REN2"; #my $api_test = "sharee_ren"; my $bike="REN2";
print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"background-color:#ffffff;color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test\&bike=$bike", -target=>'_blank'}," [ tests --> $api_test ] ")),"\n"; print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"background-color:#ffffff;color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test\&bike=$bike", -target=>'_blank'}," [ tests --> $api_test ] ")),"\n";
} }