mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-13 23:26:29 +02:00
sig prefix and rental if reserved start
This commit is contained in:
parent
b3fb4e2143
commit
c8d7b562bd
13 changed files with 172 additions and 168 deletions
|
@ -786,8 +786,9 @@ sub fetch_bike_tariff {
|
|||
my $bike = shift;
|
||||
my $owner = shift;
|
||||
|
||||
my $bike_id = "";
|
||||
$bike_id = $1 if($bike =~ /(\d+)/);
|
||||
my $bike_id = $bike || "";
|
||||
$bike_id =~ s/S[1-9]X/SX/;
|
||||
$bike_id = $1 if($bike_id =~ /(\d+)/);
|
||||
|
||||
my $main_ids = "";
|
||||
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 $owner = shift || "";
|
||||
my $gps = shift || "";
|
||||
my $reserveid = shift || "";
|
||||
my $sig_book = shift || {};
|
||||
|
||||
my $dbh = "";
|
||||
my $bike_id = "";
|
||||
$bike_id = $1 if($bike =~ /(\d+)$/);
|
||||
$bike_id = $1 if($bike_id =~ /(\d+)$/);
|
||||
|
||||
my $pos_id="";
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M", localtime;
|
||||
|
@ -935,7 +936,7 @@ sub booking_request(){
|
|||
if($ctt->{c_id}){
|
||||
|
||||
#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,"");
|
||||
|
||||
if($pos_id){
|
||||
|
@ -1003,7 +1004,7 @@ sub booking_update(){
|
|||
my $varenv = shift;
|
||||
my $auth = shift;
|
||||
my $owner = shift || 0;
|
||||
my $rentalid = shift || "";
|
||||
my $sig_book = shift || {};
|
||||
|
||||
my $state = $q->escapeHTML($q->param('state')) || "";
|
||||
my $lock_state = $q->escapeHTML($q->param('lock_state')) || "";
|
||||
|
@ -1012,8 +1013,12 @@ sub booking_update(){
|
|||
my $rows = 0;
|
||||
my $user_agent = $q->user_agent();
|
||||
my $record_pos = { c_id => 0 };#if fails
|
||||
my $bike = $q->param('bike');
|
||||
my $bike_id = $1 if($q->escapeHTML($q->param('bike')) =~ /(\d+)/);
|
||||
#my $bike = $q->param('bike');
|
||||
#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_text = "";
|
||||
|
@ -1146,7 +1151,7 @@ sub booking_update(){
|
|||
$update_pos->{owner} = "$owner";
|
||||
|
||||
$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);
|
||||
|
||||
if($rows > 0){
|
||||
|
@ -1174,7 +1179,7 @@ sub booking_update(){
|
|||
$update_pos->{int41} = "$counting->{int41}" if(looks_like_number($counting->{int41}));
|
||||
|
||||
$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);
|
||||
|
||||
$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_pos->{int24} = "1";
|
||||
$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_pos->{txt06} = "$gps";#end pos coordinates
|
||||
$update_pos->{int21} = "$gps_age_minutes";
|
||||
|
@ -1351,7 +1356,8 @@ sub booking_update(){
|
|||
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;
|
||||
$self->service_automatic($q) if($1 <= 50);
|
||||
}
|
||||
|
@ -1710,6 +1716,14 @@ sub bikes_available(){
|
|||
my $auth = shift;
|
||||
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 $return={};
|
||||
my $pref = {
|
||||
|
@ -1726,13 +1740,11 @@ sub bikes_available(){
|
|||
$main_ids =~ s/[a-z_-]+//ig;#should work also without Trenner
|
||||
$pref = { %$pref, main_id => "IN::($main_ids)" };
|
||||
|
||||
if($q->param('station')){
|
||||
my $station_id = $1 if($q->param('station') =~ /(\d+)/);
|
||||
$pref = { %$pref, int04 => "=::" . $q->escapeHTML($station_id) } if(looks_like_number($station_id));
|
||||
if(looks_like_number($station_id)){
|
||||
$pref = { %$pref, int04 => "=::" . $station_id };
|
||||
}
|
||||
if($q->param('bike')){
|
||||
my $bike_id = $1 if($q->param('bike') =~ /(\d+)/);
|
||||
$pref = { %$pref, barcode => "=::" . $q->escapeHTML($bike_id) } if(looks_like_number($bike_id));
|
||||
if(looks_like_number($bike_id)){
|
||||
$pref = { %$pref, barcode => "=::" . $bike_id };
|
||||
}
|
||||
|
||||
my $record = $dbt->fetch_record($dbh,$pref) if(ref($bike_group) eq "ARRAY" && @{$bike_group}[0]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue