mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 19:56:29 +01:00
BVB activation-code and auto-coupon
This commit is contained in:
parent
bf83052322
commit
d264925ad5
4 changed files with 72 additions and 12 deletions
|
@ -973,6 +973,37 @@ sub booking_request(){
|
||||||
c_id => $ctt->{c_id},
|
c_id => $ctt->{c_id},
|
||||||
};
|
};
|
||||||
$dbt->update_one($dbh,$update_ctt,"start_time='$now_dt'");
|
$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{
|
}else{
|
||||||
$response_state="Failure 1007: booking request fails";
|
$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";
|
$response_text="Entschuldigung, es ist ein Fehler aufgetreten. Bitte kontaktieren Sie unsere hotline damit wir das Problem lösen können";
|
||||||
|
|
|
@ -115,9 +115,15 @@ sub handler {
|
||||||
print $q->header(-charset=>"$html_charset", -cookie=>$cookie);
|
print $q->header(-charset=>"$html_charset", -cookie=>$cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
(my $aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$R::merchant_id);
|
my $aowner = "";
|
||||||
|
my $return_merchant = {
|
||||||
|
merchant_id => "",
|
||||||
|
project_id => "",
|
||||||
|
};
|
||||||
|
($aowner,$return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$R::merchant_id);
|
||||||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||||
$bw->log("Indexsharee merchant select used with access_owner $aowner",$varenv{merchant_id},"");
|
$varenv{project_id} = $return_merchant->{project_id};
|
||||||
|
$bw->log("Indexsharee merchant select used with merchant_id $varenv{merchant_id}, project_id $varenv{project_id}, access_owner $aowner",$varenv{merchant_id},"");
|
||||||
|
|
||||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ sub save_account(){
|
||||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||||
my %varenv = $cf->envonline();
|
my %varenv = $cf->envonline();
|
||||||
|
|
||||||
$bw->log("save_account by varmerchant_id $varmerch->{merchant_id} on dbname $varenv{dbname}",$q,"");
|
$bw->log("save_account by merchant_id $varmerch->{merchant_id}, project_id $varmerch->{project_id} on dbname $varenv{dbname}",$q,"");
|
||||||
|
|
||||||
my $debug=1;
|
my $debug=1;
|
||||||
my $dbh = "";#keep in mind, empty dbh defaults to local copri-instance dbname
|
my $dbh = "";#keep in mind, empty dbh defaults to local copri-instance dbname
|
||||||
|
@ -210,7 +210,7 @@ sub save_account(){
|
||||||
$valxx = "null"
|
$valxx = "null"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($_ =~ /^txt[\d+]|^int[\d+]|^uri[\d+]|ct_name/){
|
if($_ =~ /^txt\d+|^int\d+|ct_name/){
|
||||||
#PW
|
#PW
|
||||||
if($_ =~ /^txt04/){
|
if($_ =~ /^txt04/){
|
||||||
if($valxx eq "xxxxxxxx"){
|
if($valxx eq "xxxxxxxx"){
|
||||||
|
@ -248,7 +248,7 @@ sub save_account(){
|
||||||
$u_rows = $dbt->update_one("",$update_primary,"$_='$valxx'");
|
$u_rows = $dbt->update_one("",$update_primary,"$_='$valxx'");
|
||||||
}
|
}
|
||||||
|
|
||||||
#txt15=Bonus- oder Antragsnummer (falls vorhanden)=15
|
#txt15=Bonus- oder Freischalcode (falls vorhanden)=15
|
||||||
#only check bonusnr and add operators dbname.
|
#only check bonusnr and add operators dbname.
|
||||||
#bonustarif will be set after operator insert
|
#bonustarif will be set after operator insert
|
||||||
elsif($_ eq "txt15"){
|
elsif($_ eq "txt15"){
|
||||||
|
@ -262,12 +262,27 @@ sub save_account(){
|
||||||
$txt17{$ctadr->{txt17}} = 1;
|
$txt17{$ctadr->{txt17}} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#accept SWK codes without prefix
|
#accept KN codes without prefix
|
||||||
if($valxx && $owner && ($owner == 195 || $owner == 176)){
|
if($valxx && $varmerch->{project_id} && $varmerch->{project_id} eq "Konstanz"){
|
||||||
my $valappend = $valxx;
|
my $valappend = $valxx;
|
||||||
$valxx = "KN-$valappend";
|
$valxx = "KN-$valappend";
|
||||||
print FILE "Prepare SWK Bonusnr by prefix $valxx" . "\n" if($debug);
|
print FILE "Prepare KN Bonusnr by prefix $valxx" . "\n" if($debug);
|
||||||
}
|
}
|
||||||
|
#accept BVB codes also without prefix
|
||||||
|
elsif($valxx && $valxx !~ /-/ && $varmerch->{project_id} && $varmerch->{project_id} eq "Freiburg"){
|
||||||
|
my $operator_conf = "";
|
||||||
|
$operator_conf = $dbt->get_operator_conf("BVB");
|
||||||
|
if(ref($operator_conf) eq "HASH" && ref($operator_conf->{subproject}) eq "HASH" && $R::txt06 =~ /$varmerch->{project_id}/i){
|
||||||
|
my $valappend = $valxx;
|
||||||
|
foreach my $sub (keys %{ $operator_conf->{subproject} }){
|
||||||
|
if($operator_conf->{subproject}->{$sub} && $R::txt03 =~ /$operator_conf->{subproject}->{$sub}/i){
|
||||||
|
$valxx = "BVB-$sub-$valappend";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print FILE "Prepare BVB Bonusnr by prefix $valxx" . "\n" if($debug);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#Freischaltcode format can be "CA-Li-hsze789k" or "CA1234567"
|
#Freischaltcode format can be "CA-Li-hsze789k" or "CA1234567"
|
||||||
if($valxx && ($valxx =~ /^(\w{2,3})-([\w\-]+)/i || $valxx =~ /^(\w{2,3})(\d+)/i)){
|
if($valxx && ($valxx =~ /^(\w{2,3})-([\w\-]+)/i || $valxx =~ /^(\w{2,3})(\d+)/i)){
|
||||||
$valxx =~ s/\s//g;
|
$valxx =~ s/\s//g;
|
||||||
|
@ -711,7 +726,7 @@ sub save_transact(){
|
||||||
}else{
|
}else{
|
||||||
my $ct_id = {c_id => 0};
|
my $ct_id = {c_id => 0};
|
||||||
$ct_id = $dbt->insert_contenttrans($dbh_operator,$ctadr_operator,"300008","218","----",$owner);
|
$ct_id = $dbt->insert_contenttrans($dbh_operator,$ctadr_operator,"300008","218","----",$owner);
|
||||||
$pos_id = $dbt->insert_pos($dbh_operator,$ct_id,$ct,$ctadr_operator,"","",$valxx,"0",$owner);
|
$pos_id = $dbt->insert_pos($dbh_operator,$ct_id,$ct,"",$ctadr_operator,"","",$valxx,"0",$owner);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$ret = "failure::conflict_txt16#top";
|
$ret = "failure::conflict_txt16#top";
|
||||||
|
|
|
@ -87,7 +87,7 @@ Weitere Personen aus Ihrem Haushalt profitieren jedoch ebenfalls, falls Sie weit
|
||||||
if($aowner == 186 || $aowner == 197){
|
if($aowner == 186 || $aowner == 197){
|
||||||
$bonus_desc = "Freischaltcode (falls vorhanden)";
|
$bonus_desc = "Freischaltcode (falls vorhanden)";
|
||||||
$bonus_ak = "Ihr Freischaltcode wurde angenommen. Bitte beachten sie dass der Freischaltcode mit einem Mietradtarif verbunden ist. Der Tarif wird bei der Mietrad Reservierung angezeigt.";
|
$bonus_ak = "Ihr Freischaltcode wurde angenommen. Bitte beachten sie dass der Freischaltcode mit einem Mietradtarif verbunden ist. Der Tarif wird bei der Mietrad Reservierung angezeigt.";
|
||||||
$bonus_avail = "Der Freischaltcode ist nicht vorhanden.";
|
$bonus_avail = "Der Freischaltcode wurde nicht akzeptiert.";
|
||||||
$bonus_conflict = "Der Freischaltcode kann nur einmal verwendet werden.";
|
$bonus_conflict = "Der Freischaltcode kann nur einmal verwendet werden.";
|
||||||
$bonus_saved = "Aktiviert:";
|
$bonus_saved = "Aktiviert:";
|
||||||
|
|
||||||
|
@ -552,12 +552,20 @@ Nach Abschluss der Registrierung erhalten Sie sowohl auf die von Ihnen hinterleg
|
||||||
}
|
}
|
||||||
|
|
||||||
my $saved_coupon = "";
|
my $saved_coupon = "";
|
||||||
$saved_coupon = "$ctadrcoupon->{sharee_kn}->{txt15}" if($ctadrcoupon->{sharee_kn}->{txt15});
|
if($project eq "Konstanz" && $ctadrcoupon->{sharee_kn}->{txt15}){
|
||||||
|
$bonus_desc = "Bonusnummer gespeichert";
|
||||||
|
$saved_coupon = "$ctadrcoupon->{sharee_kn}->{txt15}";
|
||||||
|
}
|
||||||
|
if($project eq "Freiburg" && $ctadrcoupon->{sharee_bvb}->{txt15} && $ctadrcoupon->{sharee_bvb}->{txt15} !~ /-/){
|
||||||
|
$bonus_desc = "Freischaltcode gespeichert";
|
||||||
|
$saved_coupon = "$ctadrcoupon->{sharee_bvb}->{txt15}";
|
||||||
|
}
|
||||||
|
|
||||||
print $q->label({-for=>"$key", -style=>'padding-top:1.5em;'},"$bonus_desc"),"\n";
|
print $q->label({-for=>"$key", -style=>'padding-top:1.5em;'},"$bonus_desc"),"\n";
|
||||||
print "<input id='$key' type='text' class='form-control' name='$key' value='$saved_coupon' override $autofocus />\n";
|
print "<input id='$key' type='text' class='form-control' name='$key' value='$saved_coupon' override $autofocus />\n";
|
||||||
print $q->div(" ");
|
print $q->div(" ");
|
||||||
foreach my $opid (keys(%$ctadrcoupon)){
|
foreach my $opid (keys(%$ctadrcoupon)){
|
||||||
if($ctadrcoupon->{$opid}->{txt15} && ($aowner != 195 && $aowner != 185 && $aowner != 176)){
|
if($ctadrcoupon->{$opid}->{txt15}){
|
||||||
print $q->div("$bonus_saved $ctadrcoupon->{$opid}->{oprefix}-$ctadrcoupon->{$opid}->{txt15}"),"\n";
|
print $q->div("$bonus_saved $ctadrcoupon->{$opid}->{oprefix}-$ctadrcoupon->{$opid}->{txt15}"),"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue