mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-11 22:37:27 +02:00
prepaid account coding. Some minor fixes.
This commit is contained in:
parent
b6100696a5
commit
01a9f06617
17 changed files with 296 additions and 121 deletions
|
@ -921,8 +921,8 @@ sub booking_request(){
|
|||
fetch => "one",
|
||||
main_id => 300008,
|
||||
template_id => 218,
|
||||
#ca_id => "$auth->{c_id}",#future change
|
||||
int10 => "$auth->{c_id}",
|
||||
ca_id => "$auth->{c_id}",
|
||||
#int10 => "$auth->{c_id}",#deprecated
|
||||
state => "null",
|
||||
close_time => "is::null",
|
||||
};
|
||||
|
@ -1482,10 +1482,15 @@ sub booking_update(){
|
|||
int23 => $user_miniquest_count,
|
||||
atime => "now()",
|
||||
};
|
||||
$rows = $dbt->update_record($dbh,$update23,$auth_prim) if($dbt->{copri_conf}->{contributors} && $auth_prim->{c_id} !~ /$dbt->{copri_conf}->{contributors}/);
|
||||
$rows = $dbt->update_record($dbh,$update23,$auth_prim) if($auth_prim->{c_id} && !$dbt->{copri_conf}->{betau_id}->{$auth_prim->{c_id}});
|
||||
}
|
||||
}#end mini_quest
|
||||
|
||||
#reponse-log
|
||||
if($booking_values->{response_text}){
|
||||
my $response_log = $booking->{txt29} . "\n- $log_stamp $booking_values->{response_text}";
|
||||
$dbt->update_one($dbh,$booking_pos,"txt29='$response_log'");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ($rows,$booking_values);
|
||||
|
@ -3174,7 +3179,7 @@ sub authcookie_manager {
|
|||
}
|
||||
$registered_cookies =~ s/\|$//;
|
||||
|
||||
#$bw->log("generated authcookie",$authcookie,"");
|
||||
$bw->log("generated authcookie",$authcookie,"");
|
||||
|
||||
#return still existing authcookie
|
||||
if($registered_cookies && $registered_cookies =~ /$authcookie/){
|
||||
|
|
|
@ -68,7 +68,7 @@ my $response = {
|
|||
apiserver => "$apiserver",
|
||||
response => "$respreq",
|
||||
uri_primary => "$dbt->{primary}->{sharee_primary}->{primaryApp}",
|
||||
copri_version => "4.1.23.17",
|
||||
copri_version => "4.1.23.18",
|
||||
user_id => "",
|
||||
authcookie => "",
|
||||
new_authcoo => "0",
|
||||
|
@ -123,6 +123,7 @@ if(!$coo && !$q->param('merchant_id')){
|
|||
$response->{bike_info_html} = "$dbt->{project_conf}->{Freiburg}->{bike_info_html}";
|
||||
if($lang ne "de"){
|
||||
$response->{tariff_info_html} =~ s/\.html/_en\.html/;
|
||||
$response->{bike_info_html} =~ s/\.html/_en\.html/;
|
||||
}
|
||||
}
|
||||
elsif($return_merchant->{project_id} eq "Konstanz"){
|
||||
|
|
|
@ -133,7 +133,7 @@ sub isuser_rentable {
|
|||
my $varenv = shift;
|
||||
|
||||
my $rentable_check=0;
|
||||
if($auth->{int03} && $auth->{ct_name} && ($auth->{int03} == 1 && $auth->{ct_name} =~ /\w{2}-\d+/) || ($auth->{int03} == 2 && length($auth->{ct_name}) >= 19) || ($auth->{int03} == 3 && $auth->{ct_name} =~ /Prepaid-\d+/i)){
|
||||
if($auth->{int03} && $auth->{ct_name} && ($auth->{int03} == 1 && $auth->{ct_name} =~ /\w{2}-\d+/) || ($auth->{int03} == 2 && length($auth->{ct_name}) >= 19) || ($auth->{int03} == 3 && $auth->{ct_name} =~ /Prepay-\d+/i)){
|
||||
$rentable_check=1;
|
||||
if($auth->{txt08} && $auth->{int04} == 1 && $auth->{int13} == 1 && !$auth->{int12} && $auth->{int14}){
|
||||
$rentable_check=2;#if 2 then everything should be alright. rental is enabled
|
||||
|
|
|
@ -243,9 +243,9 @@ sub selector(){
|
|||
|
||||
my @selopt = ();
|
||||
foreach my $opt (@selval){
|
||||
my $id = $opt;
|
||||
my $value = $opt;
|
||||
($id,$value) = split /:/,$opt if($opt =~ /\w+\:.*/);
|
||||
my $id = $opt || "";
|
||||
my $value = $opt || "";
|
||||
($id,$value) = split /:/,$opt if($opt && $opt =~ /\w+\:.*/);
|
||||
if($sel eq $id){
|
||||
push @selopt, "<option selected value=\"$id\">$value</option>\n";
|
||||
}else{
|
||||
|
@ -259,14 +259,18 @@ sub selector(){
|
|||
# select tag with class
|
||||
sub selector_class(){
|
||||
my $self = shift;
|
||||
my ($column,$class,$style,$sel,@selval) = @_;
|
||||
my $column = shift;
|
||||
my $class = shift || "";
|
||||
my $style = shift || "";
|
||||
my $sel = shift || "";
|
||||
my @selval = @_;
|
||||
|
||||
my @selopt = ();
|
||||
foreach my $opt (@selval){
|
||||
my $des_style = "";
|
||||
my $id = $opt;
|
||||
my $value = $opt;
|
||||
($id,$value) = split /:/,$opt if($opt =~ /\:/);
|
||||
my $id = $opt || "";
|
||||
my $value = $opt || "";
|
||||
($id,$value) = split /:/,$opt if($opt && $opt =~ /\:/);
|
||||
$des_style = "color:grey;" if(!$id);
|
||||
if($sel eq $id){
|
||||
push @selopt, "<option style='$des_style' selected value='$id'>$value</option>\n";
|
||||
|
|
|
@ -705,7 +705,11 @@ sub collect_post(){
|
|||
$cp_where .= " and cp.$key $op $value";
|
||||
}
|
||||
}elsif($key =~ /^(c_id|ca_id|ct_id|owner|barcode|int\d+)$/ && $value){
|
||||
if($value eq "null"){
|
||||
$cp_where .= " and (cp.$key is null OR cp.$key = 0)";
|
||||
}else{
|
||||
$cp_where .= " and cp.$key $op $value";
|
||||
}
|
||||
}elsif($fetch->{catch} && $key eq "template_id" && $value){
|
||||
$cp_where .= " and cp.$key $op $value";
|
||||
#}elsif(!$fetch->{catch} && $key =~ /main_id|template_id/ && $value){
|
||||
|
@ -831,9 +835,9 @@ sub fetch_record(){
|
|||
|
||||
#ct.* because of nd.txt01 and ct.txt01 .
|
||||
my $sql = "SELECT ct.*,rel.*,nd.node_name,nd.parent_id,nd.type_id,nd.energy_id FROM $fetch->{table} ct, relation rel, nodes nd $where $order";
|
||||
#$bw->log("DBtank fetch_record : ",$sql,"") if($debug);
|
||||
my $sth = $dbh->prepare($sql);
|
||||
my $rc = $sth->execute();
|
||||
#$bw->log("DBtank fetch_record : $rc",$sql,"") if($debug);
|
||||
|
||||
my $record = { c_id => 0 };
|
||||
if($fetch->{fetch} eq "all" && $fetch->{keyfield}){
|
||||
|
@ -1021,7 +1025,7 @@ sub update_record(){
|
|||
}
|
||||
if($key =~ /^(barcode|contentadr_id|int\d+|time\d+|owner|owner_end|start_at\d+|end_at\d+)$/){
|
||||
$value =~ s/,/\./ if($value);
|
||||
if($key =~ /int\d+|time\d+|start_at\d+|end_at\d+/ && $value && $value =~ /\d+:\d+/){#azn time format
|
||||
if($key =~ /time\d+|start_at\d+|end_at\d+/ && $value && $value =~ /\d+:\d+/){#azn time format
|
||||
$set .= " $key='$value',";
|
||||
}elsif(looks_like_number($value) || ($value && $value eq "null")){
|
||||
$set .= " $key=$value,";
|
||||
|
@ -1045,7 +1049,7 @@ sub update_record(){
|
|||
my $sql = "UPDATE $update->{table} set $set $where";
|
||||
my $sth = $dbh->prepare($sql);
|
||||
$rows = $sth->execute();
|
||||
#$bw->log("DBtank update_record : $rows",$sql,"") if($debug);
|
||||
$bw->log("DBtank update_record : $rows",$sql,"") if($debug);
|
||||
}
|
||||
return $rows;
|
||||
}#update_record
|
||||
|
@ -1565,7 +1569,7 @@ sub insert_pos(){
|
|||
if($ct->{template_id} && $ct->{template_id} == 205){#Leihrad_list
|
||||
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt01,txt08,txt02,txt09,txt12,itime,start_time,end_time,int01,int02,int03,int06,txt05,txt06,txt07,int10,int12,template_id,int13,owner,int07,txt04,int09,int17,int15,int11,int18,int19,txt17,txt18,int20,int25,int29,int34,txt22,txt11,int35,int36,int37,int42,time01,time02) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','$ct->{barcode}','$ct->{txt01}','$user_name','$ct->{txt02}','$ctadr->{txt09}','$prefix',now(),now(),'$endRental','1','$unit_price','$menge','$start_station','$ct->{txt06}','$ct->{txt06}','$ct->{txt07}','$status','$from_main_id','$from_template_id','$deviceId','$owner','$rabatt','$tariff_desc','$tariff_nr','$daymax_price','$abo_price','$ct->{int11}','$sharing_type','$bike_charge','$ct->{txt17}','$ct->{txt18}','1','$trackon','$bike_type_id','$staff','$sig_book->{bikeId}','$sig_book->{rentalId}','$unit_price1','$unit_price2','$start_price','$aa_station','$unit_time','$free_time') RETURNING c_id");
|
||||
}else{
|
||||
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt08,txt09,itime,int01,int02,int03,txt01,txt06,txt07,int10,int12,int16,template_id,owner) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','$ct->{barcode}','$user_name','$ctadr->{txt09}',now(),'1','$unit_price','1','$ct->{txt01}','$ct->{txt06}','$ct->{txt07}','0','$from_main_id','$fibumark','$from_template_id','$owner') RETURNING c_id");
|
||||
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt08,txt09,itime,int01,int02,int03,txt01,int10,int12,int16,template_id,owner) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','$ct->{barcode}','$user_name','$ctadr->{txt09}',now(),'1','$unit_price','1','$ct->{txt01}','0','$from_main_id','$fibumark','$from_template_id','$owner') RETURNING c_id");
|
||||
}
|
||||
my $rows = $sth->execute();
|
||||
my $last_id;
|
||||
|
@ -1594,8 +1598,12 @@ sub insert_contenttrans(){
|
|||
my $invoice_nr = shift || "----";
|
||||
my $owner = shift || 0;
|
||||
|
||||
my $doc_name = "Rechnung";
|
||||
$doc_name = "Prepaid Account" if($tpl_id == 219);
|
||||
$owner="199" if(!$owner);
|
||||
my $sth = $dbh->prepare("INSERT INTO contenttrans (ct_name,txt00,int10,txt02,txt01,txt03,txt06,txt07,txt08,txt10,txt11,owner,itime) VALUES('$invoice_nr','Rechnung','$ctadr->{c_id}','$ctadr->{txt02}','$ctadr->{txt01}','$ctadr->{txt03}','$ctadr->{txt06}','$ctadr->{txt07}','$ctadr->{txt08}','$ctadr->{txt10}','$ctadr->{txt11}','$owner','now()') RETURNING c_id");
|
||||
#int10 will be substituted by ca_id.
|
||||
#keep in mind int10 will be mainly used by Prelogic and Printpreview, thats because we save it also
|
||||
my $sth = $dbh->prepare("INSERT INTO contenttrans (ct_name,txt00,ca_id,int10,txt02,txt01,txt03,txt06,txt07,txt08,txt10,txt11,owner,itime) VALUES('$invoice_nr','$doc_name','$ctadr->{c_id}','$ctadr->{c_id}','$ctadr->{txt02}','$ctadr->{txt01}','$ctadr->{txt03}','$ctadr->{txt06}','$ctadr->{txt07}','$ctadr->{txt08}','$ctadr->{txt10}','$ctadr->{txt11}','$owner','now()') RETURNING c_id");
|
||||
|
||||
my $rows = $sth->execute();
|
||||
my $last_id;
|
||||
|
|
|
@ -435,14 +435,21 @@ sub handler {
|
|||
#print redirect("mailto:$sendref->{mail_to}?subject=$sendref->{subject}\&body=$sendref->{message}");
|
||||
#exit 0;
|
||||
|
||||
}elsif($R::detail_search && $R::detail_search eq "operator_accounting"){
|
||||
}
|
||||
elsif($R::detail_search && $R::detail_search eq "operator_accounting"){
|
||||
my $ck4ex = "@R::ck4ex" || "";
|
||||
$return = $pl->operator_accounting($q,$users_dms,$users_sharee,$R::accounting_type,$ck4ex);
|
||||
}elsif($R::ct_trans || $R::set_state || $R::v_abschluss || $R::trans2edit){
|
||||
#should do all else invoice text save , without positions and booking payment
|
||||
}
|
||||
#on prepaid account
|
||||
elsif($R::ct_trans eq "save_pos" && $R::tpl_id4trans == 219 && $R::c_idpos){
|
||||
$feedb = $pl->save_contenttranspos($q,$R::c_idpos,$users_dms->{u_id});
|
||||
}
|
||||
#should do all else invoice text save , without positions and booking payment
|
||||
elsif($R::ct_trans || $R::set_state || $R::v_abschluss || $R::trans2edit){
|
||||
if($R::ct_trans !~ /_pos|open/ && looks_like_number($R::c_id4trans) && !$R::v_abschluss && !$R::trans2edit){
|
||||
$feedb = $pl->save_text2contenttrans($q,$users_dms,$R::c_id4trans);
|
||||
}
|
||||
#in future the prelogic modul should be disabled at all
|
||||
$return .= "|";
|
||||
$return .= $pre->preinit($q,$node_meta,$users_dms);
|
||||
}
|
||||
|
@ -728,19 +735,21 @@ sub handler {
|
|||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?failure=$users_sharee->{txt31}$session_and#top");
|
||||
exit 0;
|
||||
}elsif(!$payable_check){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}$session");
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}?cum=3$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}else{
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=3$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}elsif($users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/Anmelden|$varenv{mandant}\/$varenv{profile}/)){
|
||||
}
|
||||
#disabled
|
||||
elsif(1==2 && $users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/Anmelden|$varenv{mandant}\/$varenv{profile}/)){
|
||||
if(!$users_sharee->{int14}){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?cum=4$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}elsif(!$payable_check){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}$session");
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}?cum=4$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}else{
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=4$session_and\&$returnwww");
|
||||
|
|
|
@ -49,6 +49,74 @@ my %varenv = $cf->envonline();
|
|||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $debug=1;
|
||||
|
||||
#payment-type prepaid request
|
||||
sub prepaid_request {
|
||||
my $self = shift;
|
||||
my $dbh = shift;
|
||||
my $ctadr = shift;
|
||||
my $owner = shift;
|
||||
|
||||
my $feedb = {
|
||||
u_rows => 0,
|
||||
prepaid_account => "",
|
||||
prepaid_id => 0,
|
||||
message => "",
|
||||
};
|
||||
|
||||
my $pref_ctt = {
|
||||
table => "contenttrans",
|
||||
fetch => "one",
|
||||
main_id => 300023,
|
||||
template_id => 219,#prepaid tpl
|
||||
ca_id => "$ctadr->{c_id}",
|
||||
state => "is::null",
|
||||
close_time => "is::null",
|
||||
};
|
||||
my $ctt_prepaid = { c_id => 0 };
|
||||
$ctt_prepaid = $dbt->fetch_record($dbh,$pref_ctt);
|
||||
if(!$ctt_prepaid->{c_id}){
|
||||
my $ct_id = $dbt->insert_contenttrans($dbh,$ctadr,"300023","219","----","$owner");
|
||||
$pref_ctt->{c_id} = $ct_id;
|
||||
$ctt_prepaid = $dbt->fetch_record($dbh,$pref_ctt) if($pref_ctt->{c_id});
|
||||
}
|
||||
|
||||
my $pos_id = 0;
|
||||
my $cttpos = { c_id => 0 };
|
||||
if($ctt_prepaid->{c_id} > 0){
|
||||
|
||||
my $posref = {
|
||||
table => "contenttrans",
|
||||
table_pos => "contenttranspos",
|
||||
fetch => "one",
|
||||
keyfield => "c_id",
|
||||
ca_id => "$ctadr->{c_id}",
|
||||
int02 => "is::null",#0
|
||||
};
|
||||
$cttpos = $dbt->collect_post($dbh,$posref);
|
||||
|
||||
if(!$cttpos->{c_id}){
|
||||
#pseudo part. not available in content
|
||||
my $ct = {
|
||||
c_id => 0,
|
||||
barcode => 0,
|
||||
ca_id => $ctadr->{c_id},
|
||||
ct_id => $ctt_prepaid->{c_id},
|
||||
int02 => 0,#prepaid price on request is 0
|
||||
txt01 => 'Prepaid Position',
|
||||
int16 => 3,#fibumark for prepaid
|
||||
template_id => 219,
|
||||
};
|
||||
|
||||
$cttpos->{c_id} = $dbt->insert_pos($dbh,$ctt_prepaid->{c_id},$ct,"",$ctadr,"","","","0",$owner,"");
|
||||
$dbt->update_one($dbh,{table => 'contenttranspos',c_id => $cttpos->{c_id}},"barcode = $cttpos->{c_id},ct_name = '$cttpos->{c_id}'");
|
||||
}
|
||||
}
|
||||
|
||||
$feedb->{prepaid_account} = $ctt_prepaid->{c_id};
|
||||
$feedb->{prepaid_id} = $cttpos->{c_id};
|
||||
return $feedb;
|
||||
}
|
||||
|
||||
#select rentals for messaging user if bike > 12h ... occupied
|
||||
sub longterm_occupied {
|
||||
my $self = shift;
|
||||
|
@ -605,7 +673,7 @@ sub save_contenttranspos {
|
|||
table => "contenttrans",
|
||||
table_pos => "contenttranspos",
|
||||
fetch => "one",
|
||||
template_id => "218",#Mietjournal tpl_id
|
||||
template_id => "218",#open invoice tpl_id
|
||||
c_id => $c_id,
|
||||
"ct.state" => "is::null",
|
||||
};
|
||||
|
@ -673,7 +741,7 @@ sub save_contenttranspos {
|
|||
table => "contenttrans",
|
||||
table_pos => "contenttranspos",
|
||||
fetch => "one",
|
||||
template_id => "218",#Mietjournal tpl_id
|
||||
template_id => "218",#open invoice tpl_id
|
||||
start_time => ">::$end_time",
|
||||
barcode => $ctpos->{barcode},
|
||||
"ct.state" => "is::null",
|
||||
|
@ -737,7 +805,7 @@ sub save_contenttranspos {
|
|||
table => "contenttrans",
|
||||
table_pos => "contenttranspos",
|
||||
fetch => "one",
|
||||
template_id => "218",#Mietjournal tpl_id
|
||||
template_id => "IN::(218,219)",#open invoices and prepaid tpl_id
|
||||
c_id => $c_id,
|
||||
"ct.state" => "is::null",
|
||||
};
|
||||
|
@ -756,11 +824,25 @@ sub save_contenttranspos {
|
|||
};
|
||||
if($ctpos->{c_id}){
|
||||
$u_rows += $dbt->update_record($dbh,$update_pos,$ctpos);
|
||||
#prepaid account Vde management by booking prepaid amount
|
||||
if($R::tpl_id4trans && $R::tpl_id4trans == 219){
|
||||
my $update_adr = {
|
||||
table => "contentadr",
|
||||
owner => $owner,
|
||||
mtime => "now()",
|
||||
c_id => $ctpos->{ca_id},
|
||||
int12 => "0",
|
||||
};
|
||||
my $ctadr = { c_id => $ctpos->{ca_id} };
|
||||
$u_rows += $dbt->update_record($dbh,$update_adr,$ctadr);#check int12=0 update
|
||||
#$dbt->update_one($dbh,$update_adr,"int12=0");#Vde
|
||||
$dbt->update_operatorsloop($varenv{dbname},$ctadr->{c_id},"update");
|
||||
}
|
||||
}else{
|
||||
$feedb->{message} = "failure::Fehler, Änderung abgelehnt da Rechnung bereits gebucht";
|
||||
}
|
||||
}else{
|
||||
$feedb->{message} = "failure::Fehler, es sind nur numerische Werte erlaubt.";
|
||||
$feedb->{message} = "failure::Fehler, es sind nur numerische Werte erlaubt ($c_id && $R::int02 && $R::int03).";
|
||||
}
|
||||
}else{
|
||||
$feedb->{message} = "failure::Fehler, fehlerhafte Eingaben oder Datensatz nicht gefunden!";
|
||||
|
|
|
@ -67,7 +67,7 @@ sub count_freedrental {
|
|||
print FILE "--> pos.c_id:$pos->{c_id}, user:$pos->{ca_id}, bike:$pos->{ct_name} rental_minute_all: $pricing->{rentalog}->{rental_minute_all} > 0\n" if($debug);
|
||||
|
||||
#freed mangement will be only dony on accountable rental
|
||||
if($pricing->{rentalog}->{rental_minute_all} > 0){
|
||||
if($pricing->{rentalog}->{rental_minute_all} > 0 && $ca_id == $pos->{ca_id}){
|
||||
my $pref_pos = {
|
||||
table => "contenttranspos",
|
||||
fetch => "all",
|
||||
|
@ -88,6 +88,7 @@ sub count_freedrental {
|
|||
my ($nyear,$nmon,$nday) = Add_Delta_YMD($year,$mon,$day, 0,0,1);
|
||||
$pref_pos->{time_range} = "((start_time >= '$year-$mon-$day' and start_time < '$nyear-$nmon-$nday' and start_time != end_time) OR int10=3)";
|
||||
}
|
||||
|
||||
my $record_pos = { c_id => 0 };
|
||||
$record_pos = $dbt->fetch_tablerecord($dbh,$pref_pos);
|
||||
foreach my $pid (sort { $record_pos->{$a}->{c_id} <=> $record_pos->{$b}->{c_id} } keys (%$record_pos)){
|
||||
|
|
|
@ -133,11 +133,15 @@ sub save_account(){
|
|||
my $c_id = shift;
|
||||
my $varmerch = shift || "";
|
||||
my $owner = shift || 0;
|
||||
my $feedb = { message => "" };
|
||||
my $table = "contentadr";
|
||||
$q->import_names('R');
|
||||
my @keywords = $q->param;
|
||||
|
||||
my $feedb = {
|
||||
u_rows => 0,
|
||||
prepaid_id => 0,
|
||||
message => "",
|
||||
};
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my %varenv = $cf->envonline();
|
||||
|
||||
|
@ -163,9 +167,10 @@ sub save_account(){
|
|||
template_id => "202",
|
||||
c_id => "$c_id",
|
||||
};
|
||||
my $ctadr = $dbt->fetch_record($dbh,$authref);
|
||||
my $ctadr = { c_id => 0 };
|
||||
$ctadr = $dbt->fetch_record($dbh,$authref) if($c_id > 0);
|
||||
|
||||
my $update_primary = {
|
||||
my $update_adr = {
|
||||
table => "contentadr",
|
||||
mtime => "now()",
|
||||
owner => "$owner",
|
||||
|
@ -208,7 +213,7 @@ sub save_account(){
|
|||
}elsif(length($valxx) >= 8){
|
||||
my $pwmd5 = md5_hex($valxx) || "";
|
||||
my $pwsha256=sha256_base64($pwmd5) || "";
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt04='$pwsha256'") if(length($pwsha256) > 20);
|
||||
$update_adr->{txt04} = "$pwsha256" if(length($pwsha256) > 20);
|
||||
}
|
||||
}
|
||||
#operators, only if saved by operator DMS
|
||||
|
@ -227,15 +232,15 @@ sub save_account(){
|
|||
foreach my $keys (keys %txt17) {
|
||||
push(@operators,$keys);
|
||||
}
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt17='@operators'");
|
||||
$update_adr->{txt17} = "@operators";
|
||||
}
|
||||
#Rabatt|payone cron-intervall|Ilockit-Admin|miniq
|
||||
elsif($_ =~ /int07|int16|int19|int23/){
|
||||
$u_rows = $dbt->update_one("",$update_primary,"$_=$valxx");
|
||||
$update_adr->{$_} = $valxx;
|
||||
}
|
||||
#Text Sonstiges
|
||||
elsif($_ =~ /txt29/){
|
||||
$u_rows = $dbt->update_one("",$update_primary,"$_='$valxx'");
|
||||
$update_adr->{$_} = "$valxx";
|
||||
}
|
||||
|
||||
#txt15=Bonus- oder Freischalcode (falls vorhanden)=15
|
||||
|
@ -326,7 +331,7 @@ sub save_account(){
|
|||
push(@operators,$keys) if($keys =~/sharee_/);
|
||||
}
|
||||
print FILE "txt17 saving operators on primary: @operators\n" if($debug);
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt17='@operators'");
|
||||
$update_adr->{txt17} = "@operators";
|
||||
|
||||
#collect operator addr with existing tariff setting
|
||||
my $ctadr_operator = $dbt->fetch_record($dbh_operator,$authref);
|
||||
|
@ -418,14 +423,14 @@ sub save_account(){
|
|||
}else{
|
||||
#smsAck reset
|
||||
if($phone ne $ctadr->{txt07}){
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"int13=0");
|
||||
$update_adr->{int13} = 0;
|
||||
}
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"$_='$phone'");
|
||||
$update_adr->{$_} = "$phone";
|
||||
$email = $q->escapeHTML("$R::txt08");
|
||||
$email =~ s/\s//g;
|
||||
my $confirm_digest = sha1_base64($email . $phone);
|
||||
$confirm_digest =~ s/[I1LO0]//ig;
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt34='$confirm_digest'");
|
||||
$update_adr->{txt34} = "$confirm_digest";
|
||||
}
|
||||
print FILE "confirm_digest input after substitution: $email . $phone\n" if($debug);
|
||||
#user alias email
|
||||
|
@ -450,37 +455,32 @@ sub save_account(){
|
|||
}
|
||||
#mailAck reset
|
||||
if($valxx ne $ctadr->{txt08}){
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"int04=0");
|
||||
$update_adr->{int04} = 0;
|
||||
}
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"$_='$valxx'");
|
||||
$update_adr->{$_} = "$valxx";
|
||||
}
|
||||
}elsif($_ eq "int05"){#Web-login
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"$_=$valxx");
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt05=null") if($valxx != 1);
|
||||
$update_adr->{$_} = $valxx;
|
||||
$update_adr->{txt05} = "" if($valxx != 1);#delete also cookies
|
||||
}elsif($_ eq "int12" && $varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
|
||||
my $vde_on_fail = 0;
|
||||
$vde_on_fail = 2 if($valxx && $valxx == 1);
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"$_=$vde_on_fail");
|
||||
$update_adr->{$_} = $vde_on_fail;
|
||||
}elsif($_ =~ /^int|barcode/){
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"$_=$valxx");
|
||||
$update_adr->{$_} = $valxx;
|
||||
}elsif($_ eq "ct_name" && $R::base_edit){
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"$_='$valxx'");
|
||||
$update_adr->{$_} = "$valxx";
|
||||
}elsif($_ =~ /txt22|txt23/){
|
||||
$valxx =~ s/\s//g;
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"$_='$valxx'");
|
||||
$update_adr->{$_} = "$valxx";
|
||||
}elsif($_ !~ /ct_name|txt15/){
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"$_='$valxx'");
|
||||
$update_adr->{$_} = "$valxx";
|
||||
}
|
||||
|
||||
#Additionals after default updater
|
||||
#on IBAN/BIC change set override Mandantsreferenz to c_id to trigger payone
|
||||
if(($_ eq "txt22" && $valxx ne $ctadr->{txt22}) || ($_ eq "txt23" && $valxx ne $ctadr->{txt23})){
|
||||
$u_rows += $dbt->update_one($dbh,$update_primary,"ct_name='$c_id'");
|
||||
}
|
||||
if($_ =~ /txt22/ && $valxx){
|
||||
my $currency = "EUR";
|
||||
#$currency = "CHF" if($valxx =~ /^(CH)/i);
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt24='$currency'");
|
||||
$update_adr->{ct_name} = "$c_id";
|
||||
}
|
||||
|
||||
print FILE "-----> $_: $valxx\n" if($debug);
|
||||
|
@ -512,11 +512,16 @@ sub save_account(){
|
|||
print FILE "ret: $ret | ret_conflict: $ret_conflict\n" if($debug && ($ret || $ret_conflict));
|
||||
}#end foreach keyword
|
||||
|
||||
$u_rows = 0;
|
||||
#reread after update
|
||||
if($ctadr->{c_id} > 0){
|
||||
$u_rows = $dbt->update_record($dbh,$update_adr,$ctadr);
|
||||
$ctadr = $dbt->fetch_record($dbh,$authref);
|
||||
}
|
||||
|
||||
#payone only if SEPA Mandat checked
|
||||
#Testbuchhung mit 1 € preauthorization and 0 € capture
|
||||
$ctadr = $dbt->fetch_record($dbh,$authref);
|
||||
print FILE "+++ $R::request && $ctadr->{int03} == 1 && $ctadr->{ct_name} eq $ctadr->{c_id} \n" if($debug);
|
||||
|
||||
#print FILE "+++ $R::request && $ctadr->{int03} == 1 && $ctadr->{ct_name} eq $ctadr->{c_id} \n" if($debug);
|
||||
#if($R::request eq "managemandate" && $ctadr->{int03} == 1 && $ctadr->{ct_name} eq $ctadr->{c_id})
|
||||
#fraud workaround
|
||||
my $iban = $ctadr->{txt22} || "";
|
||||
|
@ -564,17 +569,21 @@ sub save_account(){
|
|||
|
||||
$ctt->{txt16} = "$payone_txid";
|
||||
$vde_on_fail = 0 if($vde_on_fail != 2);
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"int12=$vde_on_fail");#Vde
|
||||
$u_rows = $dbt->update_one($dbh,$update_adr,"int12=$vde_on_fail");#Vde
|
||||
#$payone_txid = $payone->captureSEPA_main(\%varenv,$ctadr,$ctt,$owner);
|
||||
#int12=0 should be set after capture success in payment module
|
||||
|
||||
}else{
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"int12=$vde_on_fail");#Vde
|
||||
$u_rows = $dbt->update_one($dbh,$update_adr,"int12=$vde_on_fail");#Vde
|
||||
}
|
||||
}else{
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"int12=$vde_on_fail");#Vde
|
||||
$u_rows = $dbt->update_one($dbh,$update_adr,"int12=$vde_on_fail");#Vde
|
||||
}
|
||||
#$u_rows = $dbt->update_one($dbh,$update_primary,"int12=3");#Vde test fail
|
||||
}
|
||||
#prepaid
|
||||
elsif($ctadr->{int03} == 3){
|
||||
$feedb = $pl->prepaid_request($dbh,$ctadr,$owner);
|
||||
$u_rows = $dbt->update_one($dbh,$update_adr,"ct_name='Prepay-$feedb->{prepaid_account}'");#Vde
|
||||
}
|
||||
|
||||
if($R::txt04 && $R::confirm_txt04 && $R::txt04 ne $R::confirm_txt04){
|
||||
|
@ -587,10 +596,10 @@ sub save_account(){
|
|||
$rval =~ s/confirm_//g;#PW confirm
|
||||
$rval =~ s/conflict_//g;#conflict
|
||||
print FILE "ret: $ret | rval: $rval\n" if($debug);
|
||||
$dbt->update_one($dbh,$update_primary,"txt31='$rval'");
|
||||
$dbt->update_one($dbh,$update_adr,"txt31='$rval'");
|
||||
}elsif($fkeys =~ /$ctadr->{txt31}/){
|
||||
print FILE " No failure and empty txt31 (fkeys: $fkeys =~ /$ctadr->{txt31}/) \n" if($debug);
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt31=''");
|
||||
$u_rows = $dbt->update_one($dbh,$update_adr,"txt31=''");
|
||||
}
|
||||
|
||||
$ret = $ret_conflict if($ret_conflict);
|
||||
|
@ -715,10 +724,10 @@ sub save_transact(){
|
|||
my $pref = {
|
||||
table => "contenttrans",
|
||||
fetch => "one",
|
||||
main_id => 300008,#must be Rechnung (and not Storno)
|
||||
main_id => 300008,
|
||||
template_id => 218,
|
||||
#ca_id => "$ctadr->{c_id}",
|
||||
int10 => "$ctadr_operator->{c_id}",
|
||||
ca_id => "$ctadr_operator->{c_id}",
|
||||
#int10 => "$ctadr_operator->{c_id}",#deprecated
|
||||
state => "is::null",
|
||||
close_time => "is::null",
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue