mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 19:56:29 +01:00
bonus collct fix
This commit is contained in:
parent
23f513bef3
commit
556809afb7
3 changed files with 23 additions and 36 deletions
|
@ -599,44 +599,25 @@ sub set_usertarif {
|
|||
int03 => ">::0",
|
||||
ct_name => "ilike::$adr_bonus->{txt15}",
|
||||
};
|
||||
|
||||
foreach my $sourcetarif (@{$adr_bonus->{txt30_array}}){
|
||||
$tarif_hash{$sourcetarif} = 1;
|
||||
}
|
||||
|
||||
$bonus_collect = $dbt->fetch_record($dbh_operator,$pref_cc) if(ref($bonus_collect->{1}) ne "HASH");
|
||||
print FILE "Prelib bonus_collect:\n" . Dumper($bonus_collect) . "\n";
|
||||
foreach my $id (keys (%$bonus_collect)){
|
||||
print FILE "-1-> loop bonus_collect and find $bonus_collect->{$id}->{ct_name} = $adr_bonus->{txt15}\n|==>Take and insert Tarif $bonus_collect->{$id}->{int22}\n" if($debug);
|
||||
$tarif_hash{$bonus_collect->{$id}->{int22}} = 1;
|
||||
$i++;
|
||||
foreach my $sourcetarif (@{$adr_bonus->{txt30_array}}){
|
||||
print FILE "-1.2-> activeTarif:$sourcetarif | Bonus-source:$bonus_collect->{$id}->{int21} | Bonus-target:$bonus_collect->{$id}->{int22}\n" if($debug);
|
||||
if($sourcetarif eq $bonus_collect->{$id}->{int22}){
|
||||
print FILE "-2.1-> still activ Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}\n" if($debug);
|
||||
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
|
||||
$ret = "success::txt15";
|
||||
#push(@new_txt30,$bonus_collect->{$id}->{int22});
|
||||
$tarif_hash{$bonus_collect->{$id}->{int22}} = 1;
|
||||
}elsif($sourcetarif eq $bonus_collect->{$id}->{int21} && $bonus_collect->{$id}->{int22}){
|
||||
print FILE "-2.2-> match-update Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}\n" if($debug);
|
||||
if($id > 3){#means if not file greped with static c_id <= 3
|
||||
$dbt->update_content4comp($dbh_operator,$bonus_collect->{$id}->{c_id},"-","1");
|
||||
}
|
||||
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
|
||||
$ret = "success::txt15";
|
||||
#push(@new_txt30,$bonus_collect->{$id}->{int22});
|
||||
$tarif_hash{$bonus_collect->{$id}->{int22}} = 1;
|
||||
}else{
|
||||
#if no matching Bonusnr then keep sourcetarif
|
||||
print FILE "-2.3-> No matching Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}, doing nothing and keep sourcetarif\n" if($debug);
|
||||
#push(@new_txt30,$sourcetarif);
|
||||
if($sourcetarif && $sourcetarif =~ /\w\s\w/){
|
||||
%tarif_hash = map { $_ => 1 } split(/\s+/,$sourcetarif);
|
||||
}else{
|
||||
$tarif_hash{$sourcetarif} = 1;
|
||||
}
|
||||
}
|
||||
print FILE "$i)-1-> loop bonus_collect and find $bonus_collect->{$id}->{ct_name} = $adr_bonus->{txt15}\n|==>Take and insert Tarif $bonus_collect->{$id}->{int22}\n" if($debug);
|
||||
$tarif_hash{$bonus_collect->{$id}->{int22}} = 1;
|
||||
if($tarif_hash{$bonus_collect->{$id}->{int21}} && $tarif_hash{$bonus_collect->{$id}->{int21}} != $tarif_hash{$bonus_collect->{$id}->{int22}}){
|
||||
delete $tarif_hash{$bonus_collect->{$id}->{int21}};
|
||||
}
|
||||
|
||||
}
|
||||
@new_txt30 = keys %tarif_hash;
|
||||
if(@new_txt30){
|
||||
print FILE "-3-> txt30: @new_txt30\n" if($debug);
|
||||
print FILE "Final -3-> txt30: @new_txt30\n" if($debug);
|
||||
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt30='@new_txt30'");
|
||||
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
|
||||
}
|
||||
|
|
|
@ -289,7 +289,8 @@ sub save_account(){
|
|||
int03 => ">::0",
|
||||
ct_name => "ilike::$bonusnr",
|
||||
};
|
||||
my $bonus_record = $dbt->fetch_record($dbh_operator,$pref_bo);
|
||||
my $bonus_record = { c_id => 0 };
|
||||
$bonus_record = $dbt->fetch_record($dbh_operator,$pref_bo);
|
||||
my $bonus_collect = {};#will be hash on matchin SWK bonus
|
||||
#also if SWK file matches
|
||||
if(!$bonus_record->{c_id} && $operator_conf->{database}->{dbname} eq "sharee_kn"){
|
||||
|
@ -304,7 +305,10 @@ sub save_account(){
|
|||
$bonus_collect->{2}->{ct_name} = $bonus_record->{ct_name};
|
||||
$bonus_collect->{2}->{int21} = 3428;
|
||||
$bonus_collect->{2}->{int22} = 3432;
|
||||
@txt30_op = ("$bonus_collect->{1}->{int22}","$bonus_collect->{2}->{int22}");
|
||||
$bonus_collect->{3}->{ct_name} = $bonus_record->{ct_name};
|
||||
$bonus_collect->{3}->{int21} = 3433;
|
||||
$bonus_collect->{3}->{int22} = 3434;
|
||||
@txt30_op = ("$bonus_collect->{1}->{int22}","$bonus_collect->{2}->{int22}","$bonus_collect->{3}->{int22}");
|
||||
}
|
||||
print FILE "SWK bonus_collect:\n" . Dumper($bonus_collect) . "\n";
|
||||
}
|
||||
|
@ -337,17 +341,19 @@ sub save_account(){
|
|||
owner => "198",
|
||||
};
|
||||
my $c_id_op = $dbt->insert_contentoid($dbh_operator,$insert_op,"reset_adropkeys");
|
||||
if($bonus_record->{c_id} > 3){#means if not file greped with static c_id <= 3
|
||||
if($bonus_record->{c_id} > 3){#means if not file greped with static kn c_id
|
||||
$dbt->update_content4comp($dbh_operator,$bonus_record->{c_id},"-","1");
|
||||
}
|
||||
|
||||
if($bonus_collect->{1}->{int22} && $bonus_collect->{2}->{int22}){
|
||||
@txt30_op = ("$bonus_collect->{1}->{int22}","$bonus_collect->{2}->{int22}");
|
||||
if($bonus_collect->{1}->{int22} && $bonus_collect->{2}->{int22} && $bonus_collect->{3}->{int22}){
|
||||
@txt30_op = ("$bonus_collect->{1}->{int22}","$bonus_collect->{2}->{int22}","$bonus_collect->{3}->{int22}");
|
||||
print FILE "SWK bonus_collect on adr insert:\n" . Dumper($bonus_collect) . "\n";
|
||||
}elsif($bonus_record->{int22}){
|
||||
@txt30_op = ("$bonus_record->{int22}");
|
||||
print FILE "bonus_record on adr insert:\n" . Dumper($bonus_record) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
#address hash wit bonusnr
|
||||
my $adr_bonus = {
|
||||
table => "contentadr",
|
||||
|
|
|
@ -668,7 +668,7 @@ Nach Abschluss der Registrierung erhalten Sie sowohl auf die von Ihnen hinterleg
|
|||
print $q->hidden(-name=>"tinkc_id",-override=>1,-value=>"$ctrel->{c_id}");
|
||||
print $q->div({-style=>'margin-top:1em;text-align:center;'},"<button type='submit' name='sharee_edit' value='save_account' class='btn btn-primary btn-lg btn-block' style='border:1px solid #$bgcolor1;background-color:#$bgcolor1;'>$button_name</button>"),"\n";
|
||||
if($path =~ /$varenv->{accounting_1}/){
|
||||
print $q->div({-style=>'margin-top:3em;text-align:center;'},$q->a({-style=>"color:#$bgcolor1;font-size:1.2em;", -role=>"button", -href=>"/$viewsel[0]/Account?sharee_edit=delete_account1$session_and"}, "Daten löschen?")),"\n";# if($ctrel->{txt08});
|
||||
print $q->div({-style=>'margin-top:3em;text-align:center;'},$q->a({-style=>"color:#$bgcolor1;font-size:1.2em;", -role=>"button", -href=>"/$viewsel[0]/Account?sharee_edit=delete_account1$session_and"}, "Delete account?")),"\n";
|
||||
}
|
||||
}else{
|
||||
print $q->div({-style=>'margin-top:1em;text-align:center;'},"<button type='submit' name='sharee_edit' value='create_account' class='btn btn-primary btn-lg btn-block' style='border:1px solid #$bgcolor1;background-color:#$bgcolor1;'>Weiter</button>"),"\n";
|
||||
|
|
Loading…
Add table
Reference in a new issue