csv export fix

This commit is contained in:
Rainer Gümpelein 2022-01-14 19:41:45 +01:00
parent 4262462fc8
commit 597284c6a9
4 changed files with 23 additions and 54 deletions

View file

@ -19,6 +19,7 @@ use Mod::APIfunc;
use Digest::MD5 qw(md5 md5_hex);
use Digest::SHA qw(sha1_base64);
use Scalar::Util qw(looks_like_number);
use URI::Encode;
use Mod::Prelib;
use Mod::Basework;
use Mod::Payment;
@ -39,6 +40,7 @@ my $payone = new Payment;
my $smstrans = new SMSTransport;
my $q = new CGI;
my $uri_encode = URI::Encode->new( { encode_reserved => 1 } );
sub new {
my $class = shift;
@ -274,6 +276,7 @@ sub save_account(){
$txt17{$ctadr->{txt17}} = 1;
}
#TODO, check if merchant_id for KN and set $bonus_prefix
if($valxx && ($valxx =~ /^(\w{2,3})-(\w+)/ || $valxx =~ /^(\w{2,3})(\d+)/)){
$valxx =~ s/\s//g;
my $bonus_prefix = uc($1),
@ -292,6 +295,10 @@ sub save_account(){
ct_name => "$bonusnr",
};
my $bonus_record = $dbt->fetch_record($dbh_operator,$pref_bo);
if(!$bonus_record->{c_id} && $operator_conf->{database}->{dbname} eq "sharee_kn"){
my $swk_code = "";
$swk_code = $lb->grep_filecontent("$varenv{basedir}/ftp/SWK_codes/got_last.csv","$bonusnr");
}
#add operators dbname only if Bonusnr matches
print FILE "txt15=$bonusnr requested on web Bonustarif on: $operator_conf->{database}->{dbname} --> barcode:$bonus_record->{barcode} --> txt21:$bonus_record->{int21} --> txt22:$bonus_record->{int22}\n" if($debug);
@ -332,7 +339,7 @@ sub save_account(){
owner => $owner,
ret => $ret,
};
print FILE "adr_bonus" . Dumper($adr_bonus) . "\n";
print FILE "adr_bonus preview which will be set if matches\n" . Dumper($adr_bonus) . "\n";
$ret = $pl->set_usertarif($dbh,$operator_conf->{database}->{dbname},$adr_bonus);
}
}else{
@ -373,7 +380,8 @@ sub save_account(){
$lastnum = $1 if($valxx =~ /(\d{9})$/);
my $phone_check = &check_account("","txt07","~",$lastnum,"c_id","!=",$c_id);
if($phone_check->{c_id} && $phone_check->{c_id} != $c_id){
$ret_conflict = "failure::conflict_$_=$valxx#top";
my $encoded_val = $uri_encode->encode($valxx);
$ret_conflict = "failure::conflict_$_=$encoded_val#top";
}
#smsAck reset
if($valxx ne $ctadr->{txt07}){
@ -394,7 +402,8 @@ sub save_account(){
my $account_check = &check_account("","txt08","ilike",$valxx,"c_id","!=",$c_id);
print FILE "$account_check->{c_id} && $account_check->{c_id} != $c_id\n" if($debug);
if($account_check->{c_id} && $account_check->{c_id} != $c_id){
$ret_conflict = "failure::conflict_$_=$valxx#top";
my $encoded_val = $uri_encode->encode($valxx);
$ret_conflict = "failure::conflict_$_=$encoded_val#top";
}
#mailAck reset
if($valxx ne $ctadr->{txt08}){