sigo lock_state unlocking

This commit is contained in:
Rainer Gümpelein 2022-04-05 13:19:00 +02:00
parent c40f326d37
commit 5870071d1b
6 changed files with 26 additions and 7 deletions

View file

@ -1086,7 +1086,7 @@ sub booking_update(){
}#end if $state =~ /canceled|occupied|available/
if($lock_state && $lock_state =~ /locking|locked|unlocked/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
if($lock_state && $lock_state =~ /locking|locked|unlocking|unlocked/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
#content
my $update_cc = {
table => "content",
@ -1186,7 +1186,6 @@ sub booking_update(){
$lock_value = 2;
$update_cc->{int20} = "$lock_value";
$update_pos->{int20} = "$lock_value";
$update_pos->{int23} = "$geo_distance";
if($state){
$booking_values->{response_state} .= " OK: bike " . $q->param('bike') . " unlocked confirmed";
$booking_values->{response_text} .= " Aufschließen von Fahrrad Nr. " . $q->param('bike') . " bestätigt";
@ -1211,7 +1210,17 @@ sub booking_update(){
system("$varenv{basedir}/src/scripts/sms_message.pl $varenv{syshost} locking_progress $auth->{txt07} $record_pos->{c_id} &");
}
$update_pos->{int32} = $record_pos->{int32} + 1;#sms_message sent marker
}elsif($lock_state eq "unlocking"){
$lock_value = 4;
$update_cc->{int20} = "$lock_value";
$update_pos->{int20} = "$lock_value";
if($state){
$booking_values->{response_state} .= " OK: bike " . $q->param('bike') . " unlocking in progress";
$booking_values->{response_text} .= " Aufschließen von Fahrrad Nr. " . $q->param('bike') . " ist im Prozess.";
}else{
$booking_values->{response_state} = "OK: bike " . $q->param('bike') . " unlocking in progress";
$booking_values->{response_text} = "Aufschließen von Fahrrad Nr. " . $q->param('bike') . " ist im Prozess.";
}
}
$dbt->update_record($dbh,$update_pos,$record_pos);
@ -1234,6 +1243,7 @@ sub booking_update(){
$booking_values->{lock_state} = "locked" if($booking->{int20} == 1);
$booking_values->{lock_state} = "unlocked" if($booking->{int20} == 2);
$booking_values->{lock_state} = "locking" if($booking->{int20} == 3);
$booking_values->{lock_state} = "unlocking" if($booking->{int20} == 4);
#fetch tracking distance on Ilockit cloud by summary trip if(tracking && deviceId && available)
if($booking->{int25} == 1 && $booking->{int10} == 1){
@ -1475,6 +1485,7 @@ sub bikes_available(){
$return->{$id}->{lock_state} = "locked" if($record->{$id}->{int20} == 1);
$return->{$id}->{lock_state} = "unlocked" if($record->{$id}->{int20} == 2);
$return->{$id}->{lock_state} = "locking" if($record->{$id}->{int20} == 3);
$return->{$id}->{lock_state} = "unlocking" if($record->{$id}->{int20} == 4);
$return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{main_id}"];
if($record->{$id}->{int11} eq "2"){
@ -1585,6 +1596,7 @@ sub bikes_all(){
$return->{$id}->{lock_state} = "locked" if($record->{$id}->{int20} == 1);
$return->{$id}->{lock_state} = "unlocked" if($record->{$id}->{int20} == 2);
$return->{$id}->{lock_state} = "locking" if($record->{$id}->{int20} == 3);
$return->{$id}->{lock_state} = "unlocking" if($record->{$id}->{int20} == 4);
$return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{main_id}"];
if($record->{$id}->{int11} eq "2"){

View file

@ -282,7 +282,7 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
if($q->param('request') eq "booking_update" && $q->param('state') && $q->param('state') =~ /canceled/){
($rows, my $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner);
$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|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/))){
($rows, my $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner);
$response = {%$response, %$booking_values};

View file

@ -306,7 +306,7 @@ sub selector_class(){
my $value = $opt;
($id,$value) = split /:/,$opt if($opt =~ /\:/);
$des_style = "color:grey;" if(!$id);
if("$sel" eq "$id"){
if($sel && $sel eq $id){
push @selopt, "<option style='$des_style' selected value='$id'>$value</option>\n";
}else{
push @selopt, "<option style='$des_style' value='$id'>$value</option>\n";
@ -326,7 +326,7 @@ sub selector_byidclass(){
my $id = $opt;
my $value = $opt;
($id,$value) = split /:/,$opt if($opt =~ /\w+\:.*/);
if("$sel" eq "$id"){
if($sel && $sel eq $id){
push @selopt, "<option selected value=\"$id\">$value</option>\n";
}else{
push @selopt, "<option value=\"$id\">$value</option>\n";

View file

@ -180,6 +180,7 @@ sub sharee_pricing(){
$return->{lock_state} = "locked" if($ctpos->{int20} == 1);
$return->{lock_state} = "unlocked" if($ctpos->{int20} == 2);
$return->{lock_state} = "locking" if($ctpos->{int20} == 3);
$return->{lock_state} = "unlocking" if($ctpos->{int20} == 4);
}
}
$bw->log("hour computed:",$logging,"");