coupon select and feedback

This commit is contained in:
Rainer Gümpelein 2022-02-16 15:56:45 +01:00
parent d2ef211f68
commit 7656e9d291
7 changed files with 67 additions and 58 deletions

View file

@ -656,7 +656,7 @@ sub payone_capture(){
#send_invoice infomail #send_invoice infomail
if(-f "$varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf"){ if(-f "$varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf"){
system(`$varenv->{basedir}/src/scripts/mailTransport.pl "$varenv->{syshost}" "send_invoice" "$ctt->{c_id}" "$praefix-$ctt->{ct_name}.pdf"`); system(`$varenv->{basedir}/src/scripts/mailTransport.pl "$varenv->{syshost}" "send_invoice" "$ctt->{c_id}" "$praefix-$ctt->{ct_name}.pdf"`);
print EMA "---> Sent Invoice Info e-mail\n"; print EMA "---> Sent Invoice e-mail command: $varenv->{basedir}/src/scripts/mailTransport.pl '$varenv->{syshost}' 'send_invoice' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'\n";
} }
close EMA; close EMA;
} }

View file

@ -317,22 +317,24 @@ sub set_usertarif {
print FILE "-1-> txt15: $adr_bonus->{txt15}\n" if($debug); print FILE "-1-> txt15: $adr_bonus->{txt15}\n" if($debug);
$i++; $i++;
foreach my $sourcetarif (@{$adr_bonus->{txt30_array}}){ foreach my $sourcetarif (@{$adr_bonus->{txt30_array}}){
print FILE "-1.2-> activeTarif-source:$sourcetarif | Bonus-source:$bonus_collect->{$id}->{int21} | Bonus-target:$bonus_collect->{$id}->{int22}\n" if($debug); 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}){ if($sourcetarif eq $bonus_collect->{$id}->{int22}){
print FILE "-2.1-> still activ Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}\n" if($debug); 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"; $ret = "success::txt15";
push(@new_txt30,$bonus_collect->{$id}->{int22});
#push(@new_txt30,$sourcetarif); #push(@new_txt30,$sourcetarif);
}elsif($bonus_collect->{$id}->{int21} eq $sourcetarif && $bonus_collect->{$id}->{int22}){ }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 if($id > 3){#means if not file greped with static c_id <= 3
$dbt->update_content4comp($dbh_operator,$bonus_collect->{$id}->{c_id},"-","1"); $dbt->update_content4comp($dbh_operator,$bonus_collect->{$id}->{c_id},"-","1");
} }
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'"); $u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
print FILE "-2.2-> match-update Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}\n" if($debug);
$ret = "success::txt15"; $ret = "success::txt15";
push(@new_txt30,$bonus_collect->{$id}->{int22}); push(@new_txt30,$bonus_collect->{$id}->{int22});
}else{ }else{
print FILE "-2.3-> No matching Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}, keeping sourcetarif\n" if($debug); print FILE "-2.3-> No matching Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}, doing nothing\n" if($debug);
push(@new_txt30,$sourcetarif); #push(@new_txt30,$sourcetarif);
#$ret = "failure::txt15#top1"; #$ret = "failure::txt15#top1";
} }
} }
@ -340,7 +342,6 @@ sub set_usertarif {
if(@new_txt30){ if(@new_txt30){
print FILE "-3-> txt30: @new_txt30\n" if($debug); print FILE "-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,"txt30='@new_txt30'");
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
} }
$ret = "failure::txt30#top2" if(!$adr_bonus->{txt30_array} || $adr_bonus->{txt30_array} !~ /\d/); $ret = "failure::txt30#top2" if(!$adr_bonus->{txt30_array} || $adr_bonus->{txt30_array} !~ /\d/);
} }

View file

@ -917,17 +917,13 @@ sub preinit(){
if(1==1){#debugging if(1==1){#debugging
my $filesize = -s "$varenv{pdf}/$praefix-$ctt->{ct_name}.pdf"; my $filesize = -s "$varenv{pdf}/$praefix-$ctt->{ct_name}.pdf";
open(EMA, ">> $varenv{logdir}/copri-print.log"); open(EMA, ">> $varenv{logdir}/copri-print.log");
print EMA "$today4db\n$topdf --page-size $psize $varenv{wwwhost}$script/Printpreview?printer_id=$R::printer_id\&mandant_main_id=$mandant_main_id\&main_id=$node->{main_id}\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$c_id4print\&u_id=$users_dms->{u_id}\&wc=$wc_line $varenv{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\n"; print EMA "$today4db\n$topdf --page-size $psize $varenv{wwwhost}$script/Printpreview?printer_id=$R::printer_id\&mandant_main_id=$mandant_main_id\&main_id=$node->{main_id}\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$c_id4print\&u_id=$users_dms->{u_id}\&wc=$wc_line $varenv{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\nset_state: $R::set_state\n";
close EMA; close EMA;
#exit 0; #exit 0;
} }
if($R::set_state ne "buchen"){#no redirect if buchen incl. print_pdf if($R::set_state ne "buchen"){#no redirect if buchen incl. print_pdf
if( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf" && $varenv{metahost}){ if( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf"){
#print redirect("$varenv{metahost}$script/pdf/$praefix-$ctt->{ct_name}.pdf");
#exit 0;
print "<script type=\"text/javascript\">window.open('$varenv{metahost}$script/pdf/$praefix-$ctt->{ct_name}.pdf');</script>";
}elsif( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf"){
#print redirect("$varenv{wwwhost}/pdf/$praefix-$ctt->{ct_name}.pdf"); #print redirect("$varenv{wwwhost}/pdf/$praefix-$ctt->{ct_name}.pdf");
#exit 0; #exit 0;
print "<script type=\"text/javascript\">window.open('$varenv{wwwhost}$script/pdf/$praefix-$ctt->{ct_name}.pdf');</script>"; print "<script type=\"text/javascript\">window.open('$varenv{wwwhost}$script/pdf/$praefix-$ctt->{ct_name}.pdf');</script>";

View file

@ -343,17 +343,7 @@ td {
$ctf = $db->get_content1("contentuser","$mandant_main_id"); $ctf = $db->get_content1("contentuser","$mandant_main_id");
#my $umst1619 = $lb->umst_breaking($ctt,""); #my $umst1619 = $lb->umst_breaking($ctt,"");
my $txt20 = $ctt->{txt20};
my $max_timestamp = "210001012359";
if($node->{node_name} !~ /journal/){
if($txt20 =~ /(\d{2})\.(\d{2})\.(\d{4})$/){
$max_timestamp = $3 . $2 . $1 . "2359";
}elsif($ctf->{txt80} =~ /(\d{2})\.(\d{2})\.(\d{4})$/){
$max_timestamp = $3 . $2 . $1 . "2359";
}
}
my $max_sum = $ctf->{int03} || "10000";
my @tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=Mietzeit","int03=Menge","int02=Preis","int07=Rabatt","int04=Gesamt"); my @tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=Mietzeit","int03=Menge","int02=Preis","int07=Rabatt","int04=Gesamt");
my ($cttpos,$rows) = $db->collect_contentpos("contenttrans",$c_id); my ($cttpos,$rows) = $db->collect_contentpos("contenttrans",$c_id);
foreach my $id (keys(%$cttpos)){ foreach my $id (keys(%$cttpos)){
@ -413,14 +403,14 @@ td {
my $unit = $cttpos->{$id}->{txt03}; my $unit = $cttpos->{$id}->{txt03};
($gesamt,$rabatt) = $pri->price2calc($cttpos->{$id}); ($gesamt,$rabatt) = $pri->price2calc($cttpos->{$id});
$gesamt = $lb->round($gesamt);
$gesamt = $lb->cashme($gesamt,",");
#max. Rechnungspositionen if($gesamt == 0){
if(($gesamt == 0) && ($cttpos_timestamp <= $max_timestamp || $ctt->{int05} == 1) && ($sum_parts19 <= $max_sum)){
$nullcount++; $nullcount++;
} }
if(($gesamt != 0) && ($cttpos_timestamp <= $max_timestamp || $ctt->{int05} == 1) && ($sum_parts19 <= $max_sum)){
if($gesamt != 0){
$gesamt = $lb->round($gesamt);
$gesamt = $lb->cashme($gesamt,",");
$j++; $j++;
if($j<=$max_table_wc || $break_table_wc){ if($j<=$max_table_wc || $break_table_wc){
@ -453,10 +443,10 @@ td {
}else{ }else{
$ct_pos = "$cttpos->{$id}->{ct_name}"; $ct_pos = "$cttpos->{$id}->{ct_name}";
} }
print $q->td({-class=>'tdint'},"$ct_pos&nbsp;"),"\n"; print $q->td({-class=>'tdint',-nowrap=>'1'},"$ct_pos&nbsp;"),"\n";
} }
if($key =~ /txt01/){ if($key =~ /txt01/){
print "<td class='tdtxt'>\n"; print "<td class='tdtxt' nowrap=1>\n";
if($cttpos->{$id}->{$key}){ if($cttpos->{$id}->{$key}){
$cttpos->{$id}->{$key} =~ s/\<br \/\>/; &nbsp; /g; $cttpos->{$id}->{$key} =~ s/\<br \/\>/; &nbsp; /g;
print "$cttpos->{$id}->{$key}<br />\n"; print "$cttpos->{$id}->{$key}<br />\n";
@ -481,7 +471,7 @@ td {
$cttpos->{$id}->{int26} =~ s/\./,/; $cttpos->{$id}->{int26} =~ s/\./,/;
$co2saving .= "bei $cttpos->{$id}->{int26} KM"; $co2saving .= "bei $cttpos->{$id}->{int26} KM";
} }
print $q->td({-class=>'tdint'},"$co2saving"); print $q->td({-class=>'tdint',-nowrap=>'1'},"$co2saving");
} }
if($key =~ /int03/){ if($key =~ /int03/){
$cttpos->{$id}->{$key} =~ s/\./,/; $cttpos->{$id}->{$key} =~ s/\./,/;
@ -498,16 +488,9 @@ td {
} }
if($key =~ /int04/){ if($key =~ /int04/){
if($gesamt == "0"){
$gesamt="";
}else{
$gesamt .= " €"; $gesamt .= " €";
$gesamt =~ s/\./,/;
}
if($rabatt != 0){ if($rabatt != 0){
my $proz="%"; print $q->td({-nowrap=>'1',-class=>'tdint'},"(Rabatt $rabatt) $gesamt"),"\n";
$proz = "€" if($cttpos->{$id}->{int08} == 1);
print $q->td({-nowrap=>'1',-class=>'tdint'},"(Rabatt $rabatt $proz) $gesamt"),"\n";
}else{ }else{
print $q->td({-nowrap=>'1',-class=>'tdint'},"$gesamt"),"\n"; print $q->td({-nowrap=>'1',-class=>'tdint'},"$gesamt"),"\n";
} }

View file

@ -358,6 +358,8 @@ sub save_account(){
}; };
print FILE "operator adr update preview with bonusnr:\n" . Dumper($adr_bonus) . "\n"; print FILE "operator adr update preview with bonusnr:\n" . Dumper($adr_bonus) . "\n";
$ret = $pl->set_usertarif($dbh,$operator_conf->{database}->{dbname},$adr_bonus,$bonus_collect); $ret = $pl->set_usertarif($dbh,$operator_conf->{database}->{dbname},$adr_bonus,$bonus_collect);
}else{
$ret = "failure::txt15#top7";
} }
}else{ }else{
$ret = "failure::txt15#top5"; $ret = "failure::txt15#top5";

View file

@ -88,10 +88,11 @@ sub tpl(){
$cttpos_count++; $cttpos_count++;
} }
my $ctt_all = {};
#$ctt = $db->collect_content2("contenttrans","int10",$ctrel->{c_id}) if($ctrel->{c_id}); #$ctt = $db->collect_content2("contenttrans","int10",$ctrel->{c_id}) if($ctrel->{c_id});
# #
#loop operator hash to get invoices for each operator #loop operator hash to get invoices for each operator
my $ctt_all = {};
my $ctadrcoupon = {};
foreach my $sharee_operator (keys (%$operator_hash)){ foreach my $sharee_operator (keys (%$operator_hash)){
my $dbh_operator = $dbt->dbconnect_extern("$sharee_operator"); my $dbh_operator = $dbt->dbconnect_extern("$sharee_operator");
my $pref = { my $pref = {
@ -101,6 +102,7 @@ sub tpl(){
keyfield => "c_id", keyfield => "c_id",
}; };
if($ctrel->{c_id}){ if($ctrel->{c_id}){
my $ctt = $dbt->fetch_tablerecord($dbh_operator,$pref); my $ctt = $dbt->fetch_tablerecord($dbh_operator,$pref);
foreach my $id (keys(%$ctt)){ foreach my $id (keys(%$ctt)){
@ -109,6 +111,15 @@ sub tpl(){
#print "$ctt->{$id}->{praefix}|"; #print "$ctt->{$id}->{praefix}|";
} }
$ctt_all = { %$ctt_all, %$ctt }; $ctt_all = { %$ctt_all, %$ctt };
my $prefcoupon = {
table => "contentadr",
fetch => "one",
txt15 => "~::\\w",
c_id => "$ctrel->{c_id}",
};
$ctadrcoupon->{$sharee_operator} = $dbt->fetch_tablerecord($dbh_operator,$prefcoupon);
} }
} }
@ -501,11 +512,28 @@ Nach Abschluss der Registrierung erhalten Sie sowohl auf die von Ihnen hinterleg
# $label_des = "<span style=color:$red>Das Passwort ist zu kurz.</span>"; # $label_des = "<span style=color:$red>Das Passwort ist zu kurz.</span>";
#} #}
elsif($key eq "txt15" && ($R::failure && $R::failure =~ /conflict_txt15/)){ elsif($key eq "txt15"){
if($R::failure){
$autofocus = "autofocus"; $autofocus = "autofocus";
$label_des = "<span style=color:$red>Die Bonusnummer ist leider nicht vorhanden. Bei nicht vorhandener Nummer das Feld bitte leer lassen.</span>";
}
if($R::failure =~ /conflict_txt15/){#TODO
$label_des = "<span style=color:$red>Die Bonusnummer kann pro Registrierung nur einmal verwendet werden. So wird verhindert dass weitere Personen von den 30-Freiminuten widerrechtlich Gebrauch nehmen.<br /> $label_des = "<span style=color:$red>Die Bonusnummer kann pro Registrierung nur einmal verwendet werden. So wird verhindert dass weitere Personen von den 30-Freiminuten widerrechtlich Gebrauch nehmen.<br />
Weitere Personen aus Ihrem Haushalt profitieren jedoch ebenfalls, falls Sie weitere Produkte (Gas, SeeConnect, Fähre- oder Bus-Zeitkarten) nutzen. Dann könnte sich die zweite Person mit der weiteren Nummer registrieren.</span>"; Weitere Personen aus Ihrem Haushalt profitieren jedoch ebenfalls, falls Sie weitere Produkte (Gas, SeeConnect, Fähre- oder Bus-Zeitkarten) nutzen. Dann könnte sich die zweite Person mit der weiteren Nummer registrieren.</span>";
} }
my $saved_coupon = "";
$saved_coupon = "$ctadrcoupon->{sharee_kn}->{txt15}" if($ctadrcoupon->{sharee_kn}->{txt15});
print $q->label({-for=>"$key", -style=>'padding-top:1.5em;'},"$label_des"),"\n";
print "<input id='$key' type='text' class='form-control' name='$key' value='$saved_coupon' override placeholder='$des' $autofocus />\n";
print $q->div("&nbsp");
foreach my $opid (keys(%$ctadrcoupon)){
if($ctadrcoupon->{$opid}->{txt15} && ($aowner != 195 && $aowner != 185 && $aowner != 176)){
print $q->div("Gespeicherte Bonusnummer: $ctadrcoupon->{$opid}->{txt15}"),"\n";
}
}
}
elsif($key eq "txt04" && $R::failure && $R::failure =~ /confirm_txt04/){ elsif($key eq "txt04" && $R::failure && $R::failure =~ /confirm_txt04/){
$autofocus = "autofocus"; $autofocus = "autofocus";
$label_des = "<span style=color:$red>Die Passwort Wiederholung ist fehlerhaft. Bitte korrigieren Sie Ihre Eingabe.</span>"; $label_des = "<span style=color:$red>Die Passwort Wiederholung ist fehlerhaft. Bitte korrigieren Sie Ihre Eingabe.</span>";
@ -515,14 +543,13 @@ Weitere Personen aus Ihrem Haushalt profitieren jedoch ebenfalls, falls Sie weit
$label_des = "<span style=color:$red>Bitte \"$des\" Angabe korrigieren</span>"; $label_des = "<span style=color:$red>Bitte \"$des\" Angabe korrigieren</span>";
$label_des = "<span style=color:$red>Für das \"$des\" liegt ein Fehler vor.</span>" if($key eq "txt04"); $label_des = "<span style=color:$red>Für das \"$des\" liegt ein Fehler vor.</span>" if($key eq "txt04");
$label_des = "<span style=color:$red>Bitte mobile Telefon Nr. mit Ländervorwahl, Beispiel: +49 170 12345678</span>" if($key eq "txt07"); $label_des = "<span style=color:$red>Bitte mobile Telefon Nr. mit Ländervorwahl, Beispiel: +49 170 12345678</span>" if($key eq "txt07");
$label_des = "<span style=color:$red>Die Bonusnummer ist leider nicht vorhanden. Bei nicht vorhandener Nummer das Feld bitte leer lassen.</span>" if($key =~ /txt15/);
} }
#if($R::success eq $key){ #if($R::success eq $key){
# $label_des = "<span>Das hat geklappt. Der \"$des\" wurde erfolgreich hinzugefügt, s.u..</span>"; # $label_des = "<span>Das hat geklappt. Der \"$des\" wurde erfolgreich hinzugefügt, s.u..</span>";
#} #}
if($key eq "txt04"){ elsif($key eq "txt04"){
my $pw = "xxxxxxxx"; my $pw = "xxxxxxxx";
$pw = "" if(!$ctrel->{c_id}); $pw = "" if(!$ctrel->{c_id});
print $q->label({-for=>"$key", -style=>'padding-top:1.5em;'},"$label_des"),"\n"; print $q->label({-for=>"$key", -style=>'padding-top:1.5em;'},"$label_des"),"\n";

View file

@ -47,8 +47,8 @@ sub tpl(){
if($users_sharee->{c_id} && $R::sharee_edit ne "delete_account2" && ($users_sharee->{c_id} eq $varenv->{superu_id} || $users_sharee->{c_id} eq "22262" || $dbt->{copri_conf}->{stage} eq "test")){ if($users_sharee->{c_id} && $R::sharee_edit ne "delete_account2" && ($users_sharee->{c_id} eq $varenv->{superu_id} || $users_sharee->{c_id} eq "22262" || $dbt->{copri_conf}->{stage} eq "test")){
my $coo = $q->cookie('domcookie') || $q->param('sessionid') || ""; my $coo = $q->cookie('domcookie') || $q->param('sessionid') || "";
#my $api_test = "sharee_kn"; my $api_test = "sharee_kn";
my $api_test = "sharee_fr01"; #my $api_test = "sharee_fr01";
print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test", -target=>'_blank'}," [ $api_test ] ")),"\n"; print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test", -target=>'_blank'}," [ $api_test ] ")),"\n";
} }