sig feedback counter select fix

This commit is contained in:
ragu 2022-06-29 20:03:56 +02:00
parent 8bcc46416c
commit 39e3a0568e
3 changed files with 20 additions and 25 deletions

View file

@ -565,7 +565,7 @@ sub service_update(){
my $update_pos = {
table => "contenttranspos",
mtime => "now()",
int28 => "null",
int28 => "1",
};
$dbt->update_record($dbh,$update_pos,$ctpos);
@ -1572,7 +1572,7 @@ sub booking_update(){
#user_miniquest_count
my $user_miniquest_count = $auth->{int23} || 0;
if($user_miniquest_count <= 4){
if($user_miniquest_count <= 3){
$user_miniquest_count++;
my $update_op = {
table => "contentadr",
@ -1731,7 +1731,7 @@ sub user_bikes_occupied(){
my $self = shift;
my $q = shift;
my $auth = shift;
#my $station_lock_state = shift || "";
my $show_dialog = shift || "";
my $pref = {
table => "contenttrans",
@ -1745,10 +1745,9 @@ sub user_bikes_occupied(){
"ct.close_time" => "is::null",
};
#station_lock_stat enables a OR condition to view available as requested/occupied
##selects also station_lock_state=locking bikes to view once miniquery
#true if not defined! it will only defined on booking_request, because there must be available
#$pref->{station_lock_state} = "3" if(!$station_lock_state);
##selects also int28 > 0 bikes to view once miniquery
#it will only defined on booking_request, because there must be available
$pref->{show_dialog} = "1" if($show_dialog);
my $record = $dbt->collect_post($dbh,$pref);
return $record;
}#end user_bikes_occupied
@ -1794,7 +1793,7 @@ sub rentals(){
if($record->{$id}->{int28}){
$return->{$id}->{state} = "returned";
#$return->{$id}->{state} = "returned";
#only for project=Bayern and developer enabled
if($dbt->{operator}->{$varenv{dbname}}->{project} eq "Bayern" && $auth->{int23} < 4){

View file

@ -209,9 +209,7 @@ elsif($q->param('request') eq "booking_request"){
$bike_id = $1 if($bike_id =~ /(\d+)/);
#check count of occcupied/requested bikes
#"station_lock_state" disables a OR condition to view available as requested/occupied
#my $record = $apif->user_bikes_occupied($q,$authraw,"station_lock_state");
my $record = $apif->user_bikes_occupied($q,$authraw);
my $record = $apif->user_bikes_occupied($q,$authraw,"");
my $count=0;
my $still_requested = 0;
foreach my $id (keys(%$record)){
@ -308,9 +306,7 @@ elsif($q->param('request') eq "booking_request"){
}
#return list of occupied/requested bikes
#"station_lock_state" disables a OR condition to view available as requested/occupied
#$record = $apif->user_bikes_occupied($q,$authraw,"station_lock_state");
$record = $apif->user_bikes_occupied($q,$authraw);
$record = $apif->user_bikes_occupied($q,$authraw,"");
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");#returns JSON rental values
}#end still_requested
@ -390,16 +386,19 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
$response = {%$response, %$booking_values};
my $record = $apif->user_bikes_occupied($q,$authraw,"show_dialog");
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");
#update on Ilockit
}else{
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
$response = {%$response, %$booking_values};
my $record = $apif->user_bikes_occupied($q,$authraw,"");
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");
}
}#end occupied|available
my $record = $apif->user_bikes_occupied($q,$authraw);
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");
}else{
$response->{response_state} = "Failure: no bike defined";
$response->{response_text} = "Abbruch, es wurde keine Fahrrad Nummer angegeben";
@ -431,7 +430,7 @@ elsif($q->param('request') eq "user_bikes_occupied"){
my ($auth,$authraw) = $apif->auth_verify($q);
if(ref($auth) eq "HASH" && $auth->{authcookie}){
$response = { %$response, %$auth };
my $record = $apif->user_bikes_occupied($q,$authraw);
my $record = $apif->user_bikes_occupied($q,$authraw,"show_dialog");
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");
}else{
$response->{response_state} = "Failure 1001: authcookie not defined";

View file

@ -625,13 +625,10 @@ 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')" && $fetch->{station_lock_state}){
#$cp_where .= " and (cp.$key $op $value OR cp.int28 = 3)";
}elsif($key eq "int10" && $value eq "('3','2')"){
#selects also push event=RENTAL_END station_lock_state bikes to view miniquery
#that means in bikes_occupied context, that also rentals with int28>0
#keep in mind: OR!!!-)
$cp_where .= " and (cp.$key $op $value OR cp.int28 > 0)";
}
#selects also push event=RENTAL_END station_lock_state bikes to view feedback and miniquery
elsif($key eq "int10" && $value eq "('3','2')" && $fetch->{show_dialog}){
$cp_where .= " and (cp.$key $op $value OR cp.int28 = 3)";#select only if no dialog saved
}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){