BVB activation-code and auto-coupon

This commit is contained in:
ragu 2023-04-27 15:09:16 +02:00
parent bf83052322
commit d264925ad5
4 changed files with 72 additions and 12 deletions

View file

@ -973,6 +973,37 @@ sub booking_request(){
c_id => $ctt->{c_id},
};
$dbt->update_one($dbh,$update_ctt,"start_time='$now_dt'");
#BVB once auto-coupon until 2023-08-31
if($varenv->{dbname} eq "sharee_bvb"){
#BVB 3-Stunden-Freifahrt
my $auto_coupon = "123";
my $pref_co = {
table => "content",
fetch => "one",
template_id => "224",
int03 => ">::0",
barcode => "$auto_coupon",
};
my $ct_co = { c_id => 0 };
$ct_co = $dbt->fetch_record($dbh,$pref_co);
$ct_co->{int02} *= -1 if($ct_co->{int02} > 0);#coupon price must be negate
my $pos_co = {
table => "contenttranspos",
fetch => "one",
ca_id => "$auth->{c_id}",
barcode => "$auto_coupon",
};
my $co_pos = { c_id => 0 };
$co_pos = $dbt->fetch_tablerecord($dbh,$pos_co);
if($ct_co->{c_id} && !$co_pos->{c_id}){
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct_co,"",$auth,"","","","0",$owner);
$dbt->update_content4comp($dbh,$ct_co->{c_id},"-","1");
}
}#end BVB auto-coupon
}else{
$response_state="Failure 1007: booking request fails";
$response_text="Entschuldigung, es ist ein Fehler aufgetreten. Bitte kontaktieren Sie unsere hotline damit wir das Problem lösen können";