From 7656e9d291167bcf0d1131c23f75f0a7798f00b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rainer=20G=C3=BCmpelein?= Date: Wed, 16 Feb 2022 15:56:45 +0100 Subject: [PATCH] coupon select and feedback --- copri4/main/src/Mod/Payment.pm | 2 +- copri4/main/src/Mod/Prelib.pm | 13 ++--- copri4/main/src/Mod/Prelogic.pm | 8 +-- copri4/main/src/Mod/Printpreview.pm | 49 ++++++------------- copri4/main/src/Mod/Shareework.pm | 2 + copri4/shareeapp-operator/src/Tpl/FormEdit.pm | 47 ++++++++++++++---- copri4/shareeweb-project/src/Lib/Mlogic.pm | 4 +- 7 files changed, 67 insertions(+), 58 deletions(-) diff --git a/copri4/main/src/Mod/Payment.pm b/copri4/main/src/Mod/Payment.pm index ed7cbf3..415974d 100755 --- a/copri4/main/src/Mod/Payment.pm +++ b/copri4/main/src/Mod/Payment.pm @@ -656,7 +656,7 @@ sub payone_capture(){ #send_invoice infomail 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"`); - 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; } diff --git a/copri4/main/src/Mod/Prelib.pm b/copri4/main/src/Mod/Prelib.pm index 7fe04d3..1d847ce 100755 --- a/copri4/main/src/Mod/Prelib.pm +++ b/copri4/main/src/Mod/Prelib.pm @@ -317,22 +317,24 @@ sub set_usertarif { print FILE "-1-> txt15: $adr_bonus->{txt15}\n" if($debug); $i++; 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}){ 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}); #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 $dbt->update_content4comp($dbh_operator,$bonus_collect->{$id}->{c_id},"-","1"); } $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"; push(@new_txt30,$bonus_collect->{$id}->{int22}); }else{ - print FILE "-2.3-> No matching Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}, keeping sourcetarif\n" if($debug); - push(@new_txt30,$sourcetarif); + print FILE "-2.3-> No matching Bonusnr ct_name: $bonus_collect->{$id}->{ct_name}, doing nothing\n" if($debug); + #push(@new_txt30,$sourcetarif); #$ret = "failure::txt15#top1"; } } @@ -340,7 +342,6 @@ sub set_usertarif { if(@new_txt30){ 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,"txt15='$adr_bonus->{txt15}'"); } $ret = "failure::txt30#top2" if(!$adr_bonus->{txt30_array} || $adr_bonus->{txt30_array} !~ /\d/); } diff --git a/copri4/main/src/Mod/Prelogic.pm b/copri4/main/src/Mod/Prelogic.pm index 983bf5a..5709243 100755 --- a/copri4/main/src/Mod/Prelogic.pm +++ b/copri4/main/src/Mod/Prelogic.pm @@ -917,17 +917,13 @@ sub preinit(){ if(1==1){#debugging my $filesize = -s "$varenv{pdf}/$praefix-$ctt->{ct_name}.pdf"; 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; #exit 0; } 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}){ - #print redirect("$varenv{metahost}$script/pdf/$praefix-$ctt->{ct_name}.pdf"); - #exit 0; - print ""; - }elsif( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf"){ + if( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf"){ #print redirect("$varenv{wwwhost}/pdf/$praefix-$ctt->{ct_name}.pdf"); #exit 0; print ""; diff --git a/copri4/main/src/Mod/Printpreview.pm b/copri4/main/src/Mod/Printpreview.pm index c3f63b5..d1a2a1d 100755 --- a/copri4/main/src/Mod/Printpreview.pm +++ b/copri4/main/src/Mod/Printpreview.pm @@ -343,17 +343,7 @@ td { $ctf = $db->get_content1("contentuser","$mandant_main_id"); #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 ($cttpos,$rows) = $db->collect_contentpos("contenttrans",$c_id); foreach my $id (keys(%$cttpos)){ @@ -406,21 +396,21 @@ td { foreach my $id (sort { $cttpos->{$b}->{$scol} cmp $cttpos->{$a}->{$scol} } keys(%$cttpos)){ my $cttpos_timestamp = $1 . $2 . $3 . "0000" if($cttpos->{$id}->{itime} =~ /(\d+)\-(\d+)\-(\d+)/); - my $gesamt = 0; - my $rabatt = ""; - my $einzel = $cttpos->{$id}->{int02}; - my $menge = $cttpos->{$id}->{int03} || 0; - my $unit = $cttpos->{$id}->{txt03}; + my $gesamt = 0; + my $rabatt = ""; + my $einzel = $cttpos->{$id}->{int02}; + my $menge = $cttpos->{$id}->{int03} || 0; + my $unit = $cttpos->{$id}->{txt03}; - ($gesamt,$rabatt) = $pri->price2calc($cttpos->{$id}); - $gesamt = $lb->round($gesamt); - $gesamt = $lb->cashme($gesamt,","); + ($gesamt,$rabatt) = $pri->price2calc($cttpos->{$id}); - #max. Rechnungspositionen - if(($gesamt == 0) && ($cttpos_timestamp <= $max_timestamp || $ctt->{int05} == 1) && ($sum_parts19 <= $max_sum)){ + if($gesamt == 0){ $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++; if($j<=$max_table_wc || $break_table_wc){ @@ -453,10 +443,10 @@ td { }else{ $ct_pos = "$cttpos->{$id}->{ct_name}"; } - print $q->td({-class=>'tdint'},"$ct_pos "),"\n"; + print $q->td({-class=>'tdint',-nowrap=>'1'},"$ct_pos "),"\n"; } if($key =~ /txt01/){ - print "\n"; + print "\n"; if($cttpos->{$id}->{$key}){ $cttpos->{$id}->{$key} =~ s/\
/;   /g; print "$cttpos->{$id}->{$key}
\n"; @@ -481,7 +471,7 @@ td { $cttpos->{$id}->{int26} =~ s/\./,/; $co2saving .= "bei $cttpos->{$id}->{int26} KM"; } - print $q->td({-class=>'tdint'},"$co2saving"); + print $q->td({-class=>'tdint',-nowrap=>'1'},"$co2saving"); } if($key =~ /int03/){ $cttpos->{$id}->{$key} =~ s/\./,/; @@ -498,16 +488,9 @@ td { } if($key =~ /int04/){ - if($gesamt == "0"){ - $gesamt=""; - }else{ - $gesamt .= " €"; - $gesamt =~ s/\./,/; - } + $gesamt .= " €"; if($rabatt != 0){ - my $proz="%"; - $proz = "€" if($cttpos->{$id}->{int08} == 1); - print $q->td({-nowrap=>'1',-class=>'tdint'},"(Rabatt $rabatt $proz) $gesamt"),"\n"; + print $q->td({-nowrap=>'1',-class=>'tdint'},"(Rabatt $rabatt) $gesamt"),"\n"; }else{ print $q->td({-nowrap=>'1',-class=>'tdint'},"$gesamt"),"\n"; } diff --git a/copri4/main/src/Mod/Shareework.pm b/copri4/main/src/Mod/Shareework.pm index 975aa07..6466966 100755 --- a/copri4/main/src/Mod/Shareework.pm +++ b/copri4/main/src/Mod/Shareework.pm @@ -358,6 +358,8 @@ sub save_account(){ }; 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); + }else{ + $ret = "failure::txt15#top7"; } }else{ $ret = "failure::txt15#top5"; diff --git a/copri4/shareeapp-operator/src/Tpl/FormEdit.pm b/copri4/shareeapp-operator/src/Tpl/FormEdit.pm index 52e3625..fd4cd55 100755 --- a/copri4/shareeapp-operator/src/Tpl/FormEdit.pm +++ b/copri4/shareeapp-operator/src/Tpl/FormEdit.pm @@ -88,19 +88,21 @@ sub tpl(){ $cttpos_count++; } - my $ctt_all = {}; #$ctt = $db->collect_content2("contenttrans","int10",$ctrel->{c_id}) if($ctrel->{c_id}); # #loop operator hash to get invoices for each operator + my $ctt_all = {}; + my $ctadrcoupon = {}; foreach my $sharee_operator (keys (%$operator_hash)){ my $dbh_operator = $dbt->dbconnect_extern("$sharee_operator"); my $pref = { - table => "contenttrans", - fetch => "all", - int10 => "$ctrel->{c_id}", - keyfield => "c_id", + table => "contenttrans", + fetch => "all", + int10 => "$ctrel->{c_id}", + keyfield => "c_id", }; + if($ctrel->{c_id}){ my $ctt = $dbt->fetch_tablerecord($dbh_operator,$pref); foreach my $id (keys(%$ctt)){ @@ -109,6 +111,15 @@ sub tpl(){ #print "$ctt->{$id}->{praefix}|"; } $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,10 +512,27 @@ Nach Abschluss der Registrierung erhalten Sie sowohl auf die von Ihnen hinterleg # $label_des = "Das Passwort ist zu kurz."; #} - elsif($key eq "txt15" && ($R::failure && $R::failure =~ /conflict_txt15/)){ - $autofocus = "autofocus"; - $label_des = "Die Bonusnummer kann pro Registrierung nur einmal verwendet werden. So wird verhindert dass weitere Personen von den 30-Freiminuten widerrechtlich Gebrauch nehmen.
+ elsif($key eq "txt15"){ + if($R::failure){ + $autofocus = "autofocus"; + $label_des = "Die Bonusnummer ist leider nicht vorhanden. Bei nicht vorhandener Nummer das Feld bitte leer lassen."; + } + if($R::failure =~ /conflict_txt15/){#TODO + $label_des = "Die Bonusnummer kann pro Registrierung nur einmal verwendet werden. So wird verhindert dass weitere Personen von den 30-Freiminuten widerrechtlich Gebrauch nehmen.
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.
"; + } + + 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 "\n"; + print $q->div(" "); + 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/){ $autofocus = "autofocus"; @@ -515,14 +543,13 @@ Weitere Personen aus Ihrem Haushalt profitieren jedoch ebenfalls, falls Sie weit $label_des = "Bitte \"$des\" Angabe korrigieren"; $label_des = "Für das \"$des\" liegt ein Fehler vor." if($key eq "txt04"); $label_des = "Bitte mobile Telefon Nr. mit Ländervorwahl, Beispiel: +49 170 12345678" if($key eq "txt07"); - $label_des = "Die Bonusnummer ist leider nicht vorhanden. Bei nicht vorhandener Nummer das Feld bitte leer lassen." if($key =~ /txt15/); } #if($R::success eq $key){ # $label_des = "Das hat geklappt. Der \"$des\" wurde erfolgreich hinzugefügt, s.u.."; #} - if($key eq "txt04"){ + elsif($key eq "txt04"){ my $pw = "xxxxxxxx"; $pw = "" if(!$ctrel->{c_id}); print $q->label({-for=>"$key", -style=>'padding-top:1.5em;'},"$label_des"),"\n"; diff --git a/copri4/shareeweb-project/src/Lib/Mlogic.pm b/copri4/shareeweb-project/src/Lib/Mlogic.pm index 12a025b..64cc35e 100755 --- a/copri4/shareeweb-project/src/Lib/Mlogic.pm +++ b/copri4/shareeweb-project/src/Lib/Mlogic.pm @@ -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")){ my $coo = $q->cookie('domcookie') || $q->param('sessionid') || ""; - #my $api_test = "sharee_kn"; - my $api_test = "sharee_fr01"; + my $api_test = "sharee_kn"; + #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"; }