sig rental fix2

This commit is contained in:
ragu 2022-06-21 21:30:47 +02:00
parent 087fe3da9c
commit ec95e0db06
3 changed files with 10 additions and 18 deletions

View file

@ -963,6 +963,7 @@ sub booking_request(){
my $return = { my $return = {
bike => "$bike", bike => "$bike",
pos_id => "$pos_id",
state => "requested", state => "requested",
response_state => "$response_state", response_state => "$response_state",
response_text => "$response_text" response_text => "$response_text"

View file

@ -296,7 +296,7 @@ elsif($q->param('request') eq "booking_request"){
#usecase with reservationId (in ctpos) is in sig not defined, thats because using ct_bike.txt22 #usecase with reservationId (in ctpos) is in sig not defined, thats because using ct_bike.txt22
#$sig_book = $si->sig_booking(\%varenv,"rental",$authraw,$ct_bike,$ctpos); #$sig_book = $si->sig_booking(\%varenv,"rental",$authraw,$ct_bike,$ctpos);
#we have to use $ct_bike->{txt22} because we doesn't using sig reserve in this case #we have to use $ct_bike->{txt22} because we doesn't using sig reserve in this case
system("$varenv{basedir}/src/scripts/sig_client.pl $varenv{syshost} 'rental' $authraw->{c_id} $ct_bike->{txt22} '' &"); system("$varenv{basedir}/src/scripts/sig_client.pl $varenv{syshost} 'rental' $authraw->{c_id} $ct_bike->{txt22} $ctpos->{c_id} &");
$sig_book->{rentalId} = "$R::rentalId" if($R::rentalId);#only for cmd tests $sig_book->{rentalId} = "$R::rentalId" if($R::rentalId);#only for cmd tests
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book); ($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
$response = {%$response, %$booking_values}; $response = {%$response, %$booking_values};
@ -379,7 +379,7 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
#update on sig #update on sig
if($ctpos->{int11} == 3){ if($ctpos->{int11} == 3){
if($q->param('state') eq "occupied"){ if($q->param('state') eq "occupied"){
system("$varenv{basedir}/src/scripts/sig_client.pl $varenv{syshost} 'rental' $authraw->{c_id} '' $ctpos->{c_id} &"); system("$varenv{basedir}/src/scripts/sig_client.pl $varenv{syshost} 'rental' $authraw->{c_id} $ctpos->{txt22} $ctpos->{c_id} &");
} }
#rental/end will be done by sig push-notification #rental/end will be done by sig push-notification
#if($q->param('state') eq "available"){ #if($q->param('state') eq "available"){

View file

@ -372,16 +372,7 @@ sub sig_booking {
print FILE "<--- $now_dt failure sig_booking sig_post $todo , reset sig_book hash to empty\n"; print FILE "<--- $now_dt failure sig_booking sig_post $todo , reset sig_book hash to empty\n";
} }
my $posref = { if($ctpos->{c_id}){
table => "contenttranspos",
fetch => "one",
ca_id => "$ctadr->{c_id}",
txt11 => "$sig_book->{rentalId}",
};
my $ctpos2 = { c_id => 0 };
$ctpos2 = $dbt->fetch_tablerecord($dbh,$posref) if(1==1);
if($ctpos2->{c_id}){
my $rows = 0; my $rows = 0;
my $update_pos = { my $update_pos = {
table => "contenttranspos", table => "contenttranspos",
@ -392,7 +383,7 @@ $ctpos2 = $dbt->fetch_tablerecord($dbh,$posref) if(1==1);
table => "content", table => "content",
mtime => "now()", mtime => "now()",
owner => "169", owner => "169",
c_id => $ctpos2->{cc_id}, c_id => $ctpos->{cc_id},
}; };
#rentalId will be only on success! #rentalId will be only on success!
@ -415,13 +406,13 @@ $ctpos2 = $dbt->fetch_tablerecord($dbh,$posref) if(1==1);
} }
#keep in mind, all other states will be done on REST, hopefully #keep in mind, all other states will be done on REST, hopefully
$update_pos->{txt25} = "$ctpos2->{txt25}\n$sig_book->{return_state}";# if($sig_book->{return_state}); $update_pos->{txt25} = "$ctpos->{txt25}\n$sig_book->{return_state}";# if($sig_book->{return_state});
$rows = $dbt->update_record($dbh,$update_pos,$ctpos2); $rows = $dbt->update_record($dbh,$update_pos,$ctpos);
print FILE "<--- rows: $rows, update_pos: $ctpos2->{c_id}, with:" . Dumper($update_pos) . "\n"; print FILE "<--- rows: $rows, update_pos: $ctpos->{c_id}, with:" . Dumper($update_pos) . "\n";
if($ctpos2->{cc_id}){ if($ctpos->{cc_id}){
$rows = $dbt->update_record($dbh,$update_content,$update_content); $rows = $dbt->update_record($dbh,$update_content,$update_content);
print FILE "<--- rows: $rows, update_content: $ctpos2->{cc_id}, with:" . Dumper($update_content) . "\n"; print FILE "<--- rows: $rows, update_content: $ctpos->{cc_id}, with:" . Dumper($update_content) . "\n";
} }
} }