set multi public tariff on booking

This commit is contained in:
Rainer Gümpelein 2022-01-18 13:30:05 +01:00
parent 235b788024
commit 4a0cc8aacb
2 changed files with 35 additions and 12 deletions

View file

@ -775,6 +775,13 @@ sub net_booking(){
my $ctadr = $db->get_contentrow("contentadr",$auth->{c_id});
my $update_adr = {
table => "contentadr",
mtime => "now()",
owner => "$owner",
c_id => "$ctadr->{c_id}",
};
my $pref = {
table => "contenttrans",
fetch => "one",
@ -815,6 +822,7 @@ sub net_booking(){
foreach my $id (keys (%$tariff_content)){
foreach(@adr_tariff){
if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{int12} == $ct->{main_id} && $tariff_content->{$id}->{barcode} && $_ == $tariff_content->{$id}->{barcode}){
$bw->log("1. net_booking tariff loop matches:",$tariff_content->{$id}->{barcode},"");
$tariff_nr = $tariff_content->{$id}->{barcode};
}
}
@ -822,6 +830,7 @@ sub net_booking(){
#2021-07-10, if no tarif then update user account to fallback default public or private or hidden tarif
#if(!$tariff_nr && !$ctadr->{txt30})
if(!$tariff_nr){
my @txt30 = ();
foreach my $id (keys (%$tariff_content)){
# #int18
#<sharing_type>
@ -830,13 +839,17 @@ sub net_booking(){
# 4 = "hidden-lv"
#</sharing_type>
if($tariff_content->{$id}->{int18} && ($tariff_content->{$id}->{int18} == 2 || $tariff_content->{$id}->{int18} == 3 || $tariff_content->{$id}->{int18} == 4)){
if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{int12} == $ct->{main_id} && $tariff_content->{$id}->{barcode}){
if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{int12} == $ct->{main_id} && $tariff_content->{$id}->{barcode}){
$bw->log("2. net_booking tariff loop matches:",$tariff_content->{$id}->{barcode},"");
$tariff_nr = $tariff_content->{$id}->{barcode};
}
if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{barcode}){
push(@txt30, "$tariff_content->{$id}->{barcode}");
}
}
}
$bw->log("--> NO user tariff defined, update user account to fallback default public or private or hidden",$tariff_nr,"");
$db->updater("contentadr","c_id",$ctadr->{c_id},"txt30","$tariff_nr",$owner);
$bw->log("--> NO user tariff defined, update user account to fallback default public or private or hidden",\@txt30,"");
$dbt->update_one($dbh,$update_adr,"txt30='@txt30'");
}else{
$bw->log("--> user tariff selected",$tariff_nr,"");
}