From f852443c6d48802b1c6d43361a31c98b58ba199f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rainer=20G=C3=BCmpelein?= Date: Tue, 1 Feb 2022 20:53:23 +0100 Subject: [PATCH] invoice mailing --- copri4/main/img/images | 1 + copri4/main/src/Mod/APIfunc.pm | 6 ++- copri4/main/src/Mod/APIjsonclient.pm | 5 +- copri4/main/src/Mod/MailTransport.pm | 32 ++++++------- copri4/main/src/Mod/Payment.pm | 3 +- copri4/main/src/Mod/Prelogic.pm | 51 ++++----------------- copri4/main/src/Mod/Printpreview.pm | 50 +++++--------------- copri4/main/src/Mod/Shareework.pm | 15 +++--- copri4/main/src/Tpl/MandantConf.pm | 13 ++++-- copri4/main/src/Tpl/TransPositionen.pm | 41 +++++++++++------ copri4/shareeapp-operator/src/Lib/Mlogic.pm | 3 +- copri4/shareedms-operator/src/Lib/Config.pm | 2 +- copri4/shareeweb-project/src/Lib/Mlogic.pm | 1 + 13 files changed, 97 insertions(+), 126 deletions(-) create mode 120000 copri4/main/img/images diff --git a/copri4/main/img/images b/copri4/main/img/images new file mode 120000 index 0000000..f003779 --- /dev/null +++ b/copri4/main/img/images @@ -0,0 +1 @@ +../../../../sharee.bike/copri-bike/shareeconf/images \ No newline at end of file diff --git a/copri4/main/src/Mod/APIfunc.pm b/copri4/main/src/Mod/APIfunc.pm index daf99b0..9cf3728 100755 --- a/copri4/main/src/Mod/APIfunc.pm +++ b/copri4/main/src/Mod/APIfunc.pm @@ -1477,6 +1477,10 @@ sub bikes_available(){ if($auth->{txt30}){ @adr_tariff = ("$auth->{txt30}"); @adr_tariff = split(/\s+/,$auth->{txt30}) if($auth->{txt30} =~ /\w\s+\w/); + }elsif(ref($tariff_content) eq "HASH"){ + foreach my $tid (keys (%$tariff_content)){ + push(@adr_tariff, "$tariff_content->{$tid}->{barcode}") if($tariff_content->{$tid}->{int18} eq 2); + } } foreach my $id (sort { $record->{$a}->{barcode} <=> $record->{$b}->{barcode} } keys (%$record)){ @@ -1506,7 +1510,7 @@ sub bikes_available(){ } if(ref($tariff_content) eq "HASH"){ foreach my $tid (sort { $tariff_content->{$a}->{barcode} <=> $tariff_content->{$b}->{barcode} } keys (%$tariff_content)){ - #$bw->log("bikes_available tariff_content tariff_description if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $auth->{txt30} =~ /$tariff_content->{$tid}->{barcode}/) BIKE:",$return->{$id}->{bike},""); + $bw->log("bikes_available tariff_content tariff_description $tariff_content->{$tid}->{int12} && $auth->{txt30} =~ /$tariff_content->{$tid}->{barcode}/ BIKE:",$return->{$id}->{bike},""); foreach(@adr_tariff){ if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $_ == $tariff_content->{$tid}->{barcode}){ diff --git a/copri4/main/src/Mod/APIjsonclient.pm b/copri4/main/src/Mod/APIjsonclient.pm index 5af38fc..a58e6d4 100755 --- a/copri4/main/src/Mod/APIjsonclient.pm +++ b/copri4/main/src/Mod/APIjsonclient.pm @@ -75,8 +75,9 @@ sub loop_sharees { $users_serviceapp = $dbt->select_users($dbh_operator,$authraw->{c_id},"and int09=1"); $bw->log("shareetool select_users $return_merchant->{aowner} on $value->{database}->{dbname} $authraw->{c_id} $authraw->{txt17}",$users_serviceapp->{u_id},""); } - - if($value->{operatorApp} && ($return_merchant->{project_id} eq $value->{project} || $users_serviceapp->{u_id})){ + #every sharee client must have a merchant_id which associate a project + #if($value->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $value->{project} || $return_merchant->{project_id} eq "all"))){ + if($value->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $value->{project}))){ $bw->log("--> LOOP-start ($return_merchant->{merchant_id}) jsonclient loop_sharees $key by operatorApp: $value->{operatorApp}, netloc: $netloc if($return_merchant->{project_id} eq $value->{project} || $users_serviceapp->{u_id} > 0)\n","",""); $ret_json = $self->fetch_operator_json($value->{operatorApp},$rest); diff --git a/copri4/main/src/Mod/MailTransport.pm b/copri4/main/src/Mod/MailTransport.pm index ad2ba60..fa1919f 100755 --- a/copri4/main/src/Mod/MailTransport.pm +++ b/copri4/main/src/Mod/MailTransport.pm @@ -45,7 +45,7 @@ sub mail_connect { Port => 465, Hello => 'sharee.bike', Timeout => 30, - Debug => 1, + Debug => 0, SSL => 1, ); @@ -62,7 +62,7 @@ sub mail_transport(){ my $sendref = shift; #print Dumper($smtp); - + my $ret = 1; my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; open(EMA, ">> $dbt->{copri_conf}->{logdir}/mailtransport.log"); @@ -73,9 +73,9 @@ sub mail_transport(){ my ($buf, $picture); my $boundary = 'frontier'; my $pdfpath = "$dbt->{copri_conf}->{basedir}/$sendref->{syshost}/pdf"; - my $attachBinaryFile = "sharee.pdf"; - if(-f "$pdfpath/Rechnung-sharee_fr01-21084-4.pdf"){ - $attachBinaryFile = "Rechnung-sharee_fr01-21084-4.pdf"; + my $attachBinaryFile = ""; + if(-f "$pdfpath/$sendref->{attachment}"){ + $attachBinaryFile = "$sendref->{attachment}"; } if($dbt->{copri_conf}->{stage} eq "test"){ @@ -99,10 +99,8 @@ sub mail_transport(){ if ($smtp->to($mail_to)) { $smtp->data(); $smtp->datasend("To: $mail_to\n"); - #$smtp->datasend("Subject: $subject\nMIME-Version: 1.0\nContent-Type: text/html; charset=UTF-8 \n\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("MIME-Version: 1.0\n"); - #$smtp->datasend("Content-Type: text/html; charset=UTF-8 \n\n"); $smtp->datasend("Content-type: multipart/mixed;\n\tboundary=\"$boundary\"\n"); $smtp->datasend("\n"); @@ -114,15 +112,15 @@ sub mail_transport(){ $smtp->datasend($html); $smtp->datasend("\n"); - $smtp->datasend("--$boundary\n"); - #$smtp->datasend("Content-Type: image/jpeg; name=\"$attachBinaryFile\"\n"); - $smtp->datasend("Content-Type: application/pdf; name=\"$attachBinaryFile\"\n"); + if($attachBinaryFile){ + $smtp->datasend("--$boundary\n"); + #$smtp->datasend("Content-Type: image/jpeg; name=\"$attachBinaryFile\"\n"); + $smtp->datasend("Content-Type: application/pdf; name=\"$attachBinaryFile\"\n"); - $smtp->datasend("Content-Transfer-Encoding: base64\n"); - $smtp->datasend("Content-Disposition: attachment; filename=\"$attachBinaryFile\"\n"); - $smtp->datasend("\n"); + $smtp->datasend("Content-Transfer-Encoding: base64\n"); + $smtp->datasend("Content-Disposition: attachment; filename=\"$attachBinaryFile\"\n"); + $smtp->datasend("\n"); - if(1==1){ open(DAT, "$pdfpath/$attachBinaryFile") || die("Could not open $pdfpath/$attachBinaryFile"); binmode(DAT); local $/=undef; @@ -133,15 +131,16 @@ sub mail_transport(){ $smtp->datasend("\n"); close(DAT); } + $smtp->datasend("--$boundary\r\n\r"); - $smtp->dataend();#doesn't exit + $smtp->dataend(); $smtp->quit; } else { print EMA $smtp->message(); } sleep 1; - #return $?; + $ret = $?; } @@ -150,6 +149,7 @@ sub mail_transport(){ close EMA; $bw->log("Success send_mail","",""); + return $ret; }#end mail_send 1; diff --git a/copri4/main/src/Mod/Payment.pm b/copri4/main/src/Mod/Payment.pm index 8e2dcb3..b208f73 100755 --- a/copri4/main/src/Mod/Payment.pm +++ b/copri4/main/src/Mod/Payment.pm @@ -549,7 +549,8 @@ sub pdfmandat { my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; open(EMA, ">> $varenv->{logdir}/SEPA-PDFprint.log"); print EMA "*** $now_dt trying pdf --> $varenv->{basedir}/pdfinvoice/SEPA-Lastschriftmandat-$varenv->{dbname}-$ctadr->{ct_name}.pdf && $ctadr->{txt27}\n"; - if((! -f "$varenv->{basedir}/pdfinvoice/SEPA-Lastschriftmandat-$varenv->{dbname}-$ctadr->{ct_name}.pdf") && $ctadr->{txt27} && $ctadr->{txt27} =~ /active|pending/){ + #if((! -f "$varenv->{basedir}/pdfinvoice/SEPA-Lastschriftmandat-$varenv->{dbname}-$ctadr->{ct_name}.pdf") && $ctadr->{txt27} && $ctadr->{txt27} =~ /active|pending/){ + if($ctadr->{txt27} && $ctadr->{txt27} =~ /active|pending/){ my $topdf = "$varenv->{basedir}/src/wkhtmltopdf-amd64"; my $print_return = `$topdf --page-size A4 "$varenv->{wwwhost}/PDFGenerator?printer_id=SEPA-Lastschriftmandat\&mandant_main_id=$dbt->{shareedms_conf}->{parent_id}\&id=$ctadr->{c_id}" $varenv->{basedir}/pdfinvoice/SEPA-Lastschriftmandat-$varenv->{dbname}-$ctadr->{ct_name}.pdf 2>&1`; my $exit_code = $?; diff --git a/copri4/main/src/Mod/Prelogic.pm b/copri4/main/src/Mod/Prelogic.pm index 82b521b..19a3446 100755 --- a/copri4/main/src/Mod/Prelogic.pm +++ b/copri4/main/src/Mod/Prelogic.pm @@ -960,9 +960,7 @@ sub preinit(){ $table = "contenttver" if($rel->{ct_table} eq "contenttver"); $table = "contentadr" if($R::printer_id =~ /Adresse|Kunde/);#jbw my $ctt = $db->get_content1($table,$c_id4print); - my $praefix = "$ctt->{txt00}-$varenv{praefix}"; - #$praefix = "$ctt->{txt00}-TINK" if($varenv{wwwhost} =~ /tink|konrad/); - #$praefix = "$ctt->{txt00}-sharee" if($varenv{wwwhost} =~ /sharee/); + my $praefix = "$ctt->{txt00}-$varenv{praefix}";#like Rechnung-sharee_operator ###PRINT @@ -993,11 +991,11 @@ sub preinit(){ } if($R::set_state ne "buchen"){#no redirect if buchen incl. print_pdf - if( -f "$varenv{pdf}/$praefix-$ctt->{ct_name}.pdf" && $varenv{metahost}){ + 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{pdf}/$praefix-$ctt->{ct_name}.pdf"){ + }elsif( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf"){ #print redirect("$varenv{wwwhost}/pdf/$praefix-$ctt->{ct_name}.pdf"); #exit 0; print ""; @@ -1009,17 +1007,13 @@ sub preinit(){ } } - ## ./src/Mod/newsletter_tink.pl '/var/www/copri3/tinkdms' 'https://tinkdms.copri.eu' 'send_invoice' '1842' '2866' - #2018-01-12 - #if(($R::send_invoice && $print_return =~ /Done/ && $exit_code == 0) || ($ib_key eq "send_invoice_again")){ - if(-f "$varenv{pdf}/$praefix-$ctt->{ct_name}.pdf" && (($R::set_state eq "buchen" && $R::send_invoice) || ($ib_key eq "send_invoice_again"))){ + if(-f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf" && (($R::set_state eq "buchen" && $R::send_invoice) || ($ib_key eq "send_invoice_again"))){ #sleep 3;#PDF invoice sending disabled because of partly empty invoices # - #print "$varenv{basedir}/src/Mod/newsletter_tink.pl '$varenv{basedir}' '$varenv{wwwhost}' 'send_invoice' '$ctt->{int10}' '$ctt->{ct_name}'"; - #Last check!!!!! #my $key_pdf; - #$key_pdf = `/usr/bin/pdftotext $varenv{pdf}/$praefix-$ctt->{ct_name}.pdf - | grep "Seite:"`; - system(`$varenv{basedir}/src/Mod/newsletter_tink.pl "$varenv{basedir}" "$varenv{wwwhost}" "send_invoice" "$ctt->{int10}" "$ctt->{ct_name}"`);# if($key_pdf =~ /Seite:/); + #$key_pdf = `/usr/bin/pdftotext $varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf - | grep "Seite:"`; + #system(`$varenv{basedir}/src/Mod/newsletter_tink.pl "$varenv{basedir}" "$varenv{wwwhost}" "send_invoice" "$ctt->{int10}" "$ctt->{ct_name}"`);# if($key_pdf =~ /Seite:/); + system(`$varenv{basedir}/src/scripts/mailTransport.pl "$varenv{syshost}" "send_invoice" "$ctt->{c_id}" "$praefix-$ctt->{ct_name}.pdf"`); } # @@ -1027,19 +1021,8 @@ sub preinit(){ #SET Tagesabschluss if($R::v_abschluss){ - my $journal_tpl="999999"; - my $journal_id="999999"; - my $Xjournal_id="999999"; - if("$R::kind_of_trans" eq "Verkauf"){ - $journal_id=$ctf->{txt23} if($ctf->{txt23}); - $Xjournal_id=$ctf->{txt70} if($ctf->{txt70}); - $journal_tpl=$ctf->{txt26} if($ctf->{txt26}); - } - if($R::kind_of_trans =~ /Faktur|Verleih/){ - $journal_id=$ctf->{txt25} if($ctf->{txt25}); - $Xjournal_id=$ctf->{txt70} if($ctf->{txt70}); - $journal_tpl=$ctf->{txt28} if($ctf->{txt28}); - } + my $journal_tpl="209"; + my $journal_id="300011"; #test node my $n_exist = $db->get_node4multi($journal_id,$lang); @@ -1059,8 +1042,7 @@ sub preinit(){ my $sum_kasse = $R::sum_kasse || "0"; $sum_start = $lb->checkint($sum_start); $sum_kasse = $lb->checkint($sum_kasse); - my $c_id4kasse; - #my $journal_node = $db->get_node3("$parent_trans->{main_id}","Verkaufsjournal","$lang"); + my $c_id4kasse = ""; my $c_id4abschluss = $db->get_content6("$table","close_time","null","state","Kassenbestand","int09","$parent_trans->{parent_id}","","","$s_owner_id"); if($journal_id){ if($c_id4abschluss->{c_id} && $c_id4abschluss->{c_id} > 0){ @@ -1074,10 +1056,7 @@ sub preinit(){ $db->update_content4change("contenttrans",$c_id4kasse,"",$c_id4kasse,"int11");#last_ab $db->update_content4change("contenttrans",$c_id4kasse,"",$journal_id,"int12");#main_id - #2021-04-30, check close_time if fails. 300011 not in main_ids #TODO $db->collect_noderec - #$db->update_content4change("contenttrans",$c_id4kasse,"","now()","close_time"); $db->update_content4change("contenttrans",$c_id4kasse,"",$n_exist->{node_name},"txt00");#node_name - #my $rel_id = $db->insert_relationlist($table,$journal_id,$lang,$c_id4kasse,$journal_tpl,"ct_id"); my $rel_id = $db->insert_relationlist($table,$journal_id,$lang,$c_id4kasse,$tpl_vk,"ct_id"); } $u_rows += $db->update_kasse($table,$c_id4kasse,$sum_kasse,$sum_start); @@ -1086,16 +1065,6 @@ sub preinit(){ my $opos="null"; $u_rows += $db->update_tagesabschluss($table,$c_id4kasse,$journal_id,$journal_tpl,$tpl_vk,$parent_trans->{parent_id},"$main_ids","$s_owner_id","$opos"); - #Move thinks which are in context to closed transactions - if(1==1){ - my $Xlast = $db->collect_Xlast($c_id4kasse,$journal_id,$journal_tpl,$parent_trans->{parent_id}); - foreach my $c_id (keys (%$Xlast)){ - my @Xct_name = split(/-/,$Xlast->{$c_id}->{ct_name}); - foreach(@Xct_name){ - $u_rows += $db->update_Xabschluss($table,$c_id4kasse,$Xjournal_id,$journal_tpl,$tpl_vk,$parent_trans->{parent_id},"$main_ids","$s_owner_id","$_") if($_ > 10); #because of max workflow counter - } - } - } if("$R::kind_of_trans" eq "Verkauf"){ $path =~ s/$R::kind_of_trans.*/$R::kind_of_trans\/Verkaufsjournal/; diff --git a/copri4/main/src/Mod/Printpreview.pm b/copri4/main/src/Mod/Printpreview.pm index b677ce5..69a0ada 100755 --- a/copri4/main/src/Mod/Printpreview.pm +++ b/copri4/main/src/Mod/Printpreview.pm @@ -49,10 +49,9 @@ sub printpre(){ my $ct_name2print=$R::ct_name2print; my $wc= $1 if($R::wc =~ /(\d+\.\d+)/); my $node = $db->get_node4multi($R::main_id,$lang); - #print "$u_id,$c_id,$mandant_main_id,$main_id,$ct_name2print,$wc"; - print $q->start_html(-title=>'COPRIprint', + print $q->start_html(-title=>'', -base=>'true', -target=>'Printpre' ); @@ -156,8 +155,8 @@ td { #payone Bank my $footer_bank = $ctf->{txt19}; - #sparkasse Bank - $footer_bank = $ctf->{txt20} if($ctt->{state} !~ /payone/i); + #manuel Bank + #$footer_bank = $ctf->{txt20} if($ctt->{state} !~ /payone/i); my $ctt_users = $db->get_owner($ctt->{owner}); @@ -178,10 +177,10 @@ td { my $tplf = $db->get_tpl("201");#Firma tpl my @tplf_order = split /,/,$tplf->{tpl_order}; - my $logo = "$ctf->{img01}" || "000empty"; + my $logo = "$ctf->{img01}" || ""; if($printer_id =~ /Briefpapier/){ #Ohne Logo da Briefpapier - $logo = "000empty"; + $logo = ""; } #logging siteformat @@ -259,7 +258,7 @@ td { my $position; my $h_toppx = "$h_top" . "px"; $position = "position:absolute; top: $h_toppx;" if($h_top); - print $q->div({-style=>"$position width:$width;text-align:right;border:0px solid black;margin:0 0 200px 0;"},$q->span({-style=>'margin:0em;'},$q->img({-src=>"$varenv{metahost}/img/$logo",-height=>'120px;'})),$q->span({-style=>'font-size:1em;'},"\n")); + print $q->div({-style=>"$position width:$width;text-align:right;border:0px solid black;margin:0 0 200px 0;"},$q->span({-style=>'margin:0em;'},$q->img({-src=>"$varenv{metahost}/img/images/$logo",-height=>'120px;'})),$q->span({-style=>'font-size:1em;'},"\n")); } #Briefkopf + Adresse @@ -269,7 +268,7 @@ td { my $ctt = $db->get_content1("contenttrans",$c_id); $ctt->{txt01} = $lb->newline($ctt->{txt01},$users->{tiny_mce},"0"); - print $q->div({-style=>"width:$width; text-align:right;border:0px solid black;margin:0 0 200px 0;"},$q->span({-style=>'margin:0em;'},$q->img({-src=>"$varenv{metahost}/img/$logo",-height=>'120px;'})),$q->span({-style=>'font-size:1em;'},"")),"\n"; + print $q->div({-style=>"width:$width; text-align:right;border:0px solid black;margin:0 0 200px 0;"},$q->span({-style=>'margin:0em;'},$q->img({-src=>"$varenv{metahost}/img/images/$logo",-height=>'120px;'})),$q->span({-style=>'font-size:1em;'},"")),"\n"; print $q->start_table({-width=>'100%',-border=>'0',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n"; print "\n"; @@ -293,7 +292,7 @@ td { my $txid = ""; - $txid = "TXID: $ctt->{txt16}" if($ctt->{txt16} && $ctt->{state} =~ /payone/i); + $txid = "Verwendungszweck TXID: $ctt->{txt16}" if($ctt->{txt16} && $ctt->{state} =~ /payone/i); my $mailaccount = ""; $mailaccount = "Account: $ctt->{txt08}" if($ctt->{txt08}); @@ -340,7 +339,6 @@ td { sub data_table(){ my ($h_top,$c_id,$scol,$ctt_dummy,$mandant_main_id,$kind_of_trans,$tpl_order,$break_table_wc,$max_table_wc,$ctt,$sum_break) = @_; - #print "($h_top,$c_id,$scol,$ctt_dummy,$mandant_main_id,$kind_of_trans,$tpl_order,$break_table_wc,$max_table_wc)"; $ctf = $db->get_content1("contentuser","$mandant_main_id"); my $umst1619 = $lb->umst_breaking($ctt,""); @@ -438,7 +436,6 @@ td { if(($gesamt == 0) && ($cttpos_timestamp <= $max_timestamp || $ctt->{int05} == 1) && ($sum_parts19 <= $max_sum)){ $nullcount++; } - #print "if(($gesamt != 0) && ($cttpos_timestamp <= $max_timestamp || $ctt->{int05} == 1) && ($sum_parts19 <= $max_sum)){"; if(($gesamt != 0) && ($cttpos_timestamp <= $max_timestamp || $ctt->{int05} == 1) && ($sum_parts19 <= $max_sum)){ $j++; @@ -455,12 +452,10 @@ td { $gesamt = $lb->cashme($gesamt); #summieren if("$cttpos->{$id}->{int05}" =~ /\d/){ - #print "xxx $gesamt $cttpos->{$id}->{int05} |"; $sum_parts0 += $gesamt if("$cttpos->{$id}->{int05}" == "0"); $sum_parts7 += $gesamt if("$cttpos->{$id}->{int05}" == "7"); $sum_parts19 += $gesamt if("$cttpos->{$id}->{int05}" >= "16"); }else{ - #print "yyy $gesamt $ctf->{txt13} |"; $sum_parts0 += $gesamt if("$ctf->{txt13}" == "0"); $sum_parts7 += $gesamt if("$ctf->{txt13}" == "7"); $sum_parts19 += $gesamt if($ctf->{txt13} >= 16); @@ -525,9 +520,6 @@ td { print $q->td({-class=>'tdint'},"$menge"),"\n"; } - if($ctt->{txt00} =~ /Lieferschein/){ - print $q->td(""),"\n" if($key =~ /int02|int04/); - }else{ if($key =~ /int02/){ if($einzel == "0"){ $einzel=""; @@ -553,21 +545,20 @@ td { print $q->td({-nowrap=>'1',-class=>'tdint'},"$gesamt"),"\n"; } } - } } } } }#end foreach #Zahlungstext Text & Vorbelegungen - my $payment_text; + my $payment_text = ""; foreach(@tplf_order){ my ($key,$des,$size) = split /=/,$_; - if($key =~ /txt52|txt53|txt54|txt55|txt56|txt57|txt58|txt59|txt60/){ + if($key =~ /txt5\d/){ $ctf->{$key} = $q->unescapeHTML("$ctf->{$key}"); - $ctf->{$key} = $lb->newline($ctf->{$key},$users->{tiny_mce},""); + $ctf->{$key} = $lb->newline($ctf->{$key},"",""); $ctt->{state} =~ s/\(payone.*//; - if("$des" =~ /$ctt->{state}/ && ($j <= $max_table_wc || $break_table_wc)){ + if($des =~ /$ctt->{state}/ && ($j <= $max_table_wc || $break_table_wc)){ if($sum_parts19 < 0){ $payment_text = "$ctf->{txt58}"; }else{ @@ -690,23 +681,10 @@ td { my @rechnungstext = split(/\
/,$ctf->{$key}); if($ctt_txt21 =~ /$key/){ foreach(@rechnungstext){ - if($_ =~ /signature/){ - print $q->Tr(); - print $q->td({-style=>'border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:black;'}," "); - print $q->td({-style=>'width:4em;height:2em;'}," "); - print $q->td({-style=>'border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:black;'}," "); - print $q->Tr(); - print $q->td({-class=>'tdpdf3'}, "   Unterschrift Mieterin / Mieter   ","\n"); - print $q->td(" "); - print $q->td({-class=>'tdpdf3'}, "Unterschrift ","\n"); - print $q->Tr(); - print $q->td({-colspan=>3, -style=>'border-bottom-width:2px;border-bottom-style:solid;border-bottom-color:black;'}," "); - }else{ $style = "padding:0.4em;text-align:left;font-size:1em;"; $style = "padding:0.4em;text-align:left;font-size:1em;" if($_ =~ s/\// && $node_name ne "Rückgabe"); print $q->Tr(); print $q->td({-style=>"$style",-colspan=>3},"$_"); - } } } } @@ -756,10 +734,6 @@ td { print $q->start_table({-border=>'0',-align=>'left'}); print $q->Tr(); print $q->td({-class=>'tdpdf2'}, "TEL: $ctf->{txt08}","\n"); - #if($ctf->{txt09}){ - # print $q->Tr(); - # print $q->td({-class=>'tdpdf2'}, "FAX: $ctf->{txt09}","\n"); - #} print $q->Tr(); print $q->td({-class=>'tdpdf2'}, "$ctf->{txt10}","\n"); print $q->Tr(); diff --git a/copri4/main/src/Mod/Shareework.pm b/copri4/main/src/Mod/Shareework.pm index 322ee48..6b05216 100755 --- a/copri4/main/src/Mod/Shareework.pm +++ b/copri4/main/src/Mod/Shareework.pm @@ -814,12 +814,14 @@ sub net_booking(){ #This is the automatic user tariff setter my $tariff_nr = ""; my @adr_tariff = (); - @adr_tariff = ("$ctadr->{txt30}"); - @adr_tariff = split(/\s+/,$ctadr->{txt30}) if($ctadr->{txt30} =~ /\w\s+\w/); - + if($ctadr->{txt30}){ + @adr_tariff = ("$ctadr->{txt30}"); + @adr_tariff = split(/\s+/,$ctadr->{txt30}) if($ctadr->{txt30} =~ /\w\s+\w/); + } if(ref($ct) eq "HASH" && $ct->{main_id}){ foreach my $id (keys (%$tariff_content)){ foreach(@adr_tariff){ + $bw->log("adr_tariff array form $ctadr->{txt30}",$_,""); if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{int12} == $ct->{main_id} && $tariff_content->{$id}->{barcode} && $_ == $tariff_content->{$id}->{barcode}){ $bw->log("1. net_booking tariff loop matches:",$tariff_content->{$id}->{barcode},""); $tariff_nr = $tariff_content->{$id}->{barcode}; @@ -841,10 +843,11 @@ sub net_booking(){ if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{int12} == $ct->{main_id} && $tariff_content->{$id}->{barcode}){ $bw->log("2. net_booking tariff loop matches:",$tariff_content->{$id}->{barcode},""); $tariff_nr = $tariff_content->{$id}->{barcode}; - } - if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{barcode}){ push(@txt30, "$tariff_content->{$id}->{barcode}"); - } + } + #if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{barcode}){ + # push(@txt30, "$tariff_content->{$id}->{barcode}"); + #} } } $bw->log("--> NO user tariff defined, update user account to fallback default public or private or hidden",\@txt30,""); diff --git a/copri4/main/src/Tpl/MandantConf.pm b/copri4/main/src/Tpl/MandantConf.pm index 4373ce6..619a71c 100755 --- a/copri4/main/src/Tpl/MandantConf.pm +++ b/copri4/main/src/Tpl/MandantConf.pm @@ -83,6 +83,7 @@ sub tpl(){ print $q->hidden(-name=>'owner',-override=>'1', -value=>"$users_dms->{u_id}"); print $q->hidden(-name=>'c_id',-override=>'1', -value=>"$ct->{c_id}"); print $q->hidden(-name=>'rel_id',-override=>'1', -value=>"$rel->{rel_id}"); + print $q->hidden(-name=>'main_id',-override=>'1', -value=>"$rel->{main_id}"); print $but->singlesubmit7("rel_edit","save_user","$ib{save}"); print "\n"; }else{ @@ -96,13 +97,13 @@ sub tpl(){ foreach (@tpl_order){ $i++; my ($key,$des,$size) = split /=/,$_; - $size = "60" if($key =~ /ct_name|txt/ && !$size); + $size = "60" if($key =~ /ct_name|txt|img/ && !$size); $ct->{$key} = $q->unescapeHTML("$ct->{$key}"); $ct->{$key} = $lb->newline($ct->{$key}); my $value = ""; if($R::config2edit){ if($size eq "area"){ - $value = ""; + $value = ""; }elsif($size =~ /\w\+\w/){ my ($a,$b) = split /\+/,$size; my $a_checked; @@ -110,18 +111,20 @@ sub tpl(){ $a_checked = "checked" if($ct->{$key} eq "$a" || !$ct->{$key}); $b_checked = "checked" if($ct->{$key} eq "$b"); $value = "$a $b "; - }elsif($key =~ /txt|ct_name/){ + }elsif($key =~ /txt/){ $value = ""; }elsif($key =~ /int/){ $value = ""; }elsif($key =~ /img/){ - $value = ""; + $value = ""; } }else{ $value = "$ct->{$key}"; } print $q->Tr(); - if($key =~ /header/){ + if($key =~ /header01/){ + print $q->td({-class=>'tdval2',-colspan=>'2'},$q->b("
$dbt->{operator}->{$varenv{dbname}}->{project} $dbt->{operator}->{$varenv{dbname}}->{oprefix} $dbt->{operator}->{$varenv{dbname}}->{database}->{dbname}")),"\n"; + }elsif($key =~ /header/){ print $q->td({-class=>'tdval2',-colspan=>'2'},$q->b("
$des")),"\n"; }elsif($users_dms->{u_id} eq $varenv{superu_id}){ print $q->td({-class=>'tdescr2'},"$des ($key)"),"\n"; diff --git a/copri4/main/src/Tpl/TransPositionen.pm b/copri4/main/src/Tpl/TransPositionen.pm index 7b2fbf2..b42d6c4 100755 --- a/copri4/main/src/Tpl/TransPositionen.pm +++ b/copri4/main/src/Tpl/TransPositionen.pm @@ -71,8 +71,10 @@ sub tpl(){ my $vibuchen_mtime = ""; $vibuchen_mtime = "Payone post " . $lb->time4de($ctt->{pay_time},1) . " . " if($ctt->{pay_time}); - my $tpl = $db->get_tpl($ctf->{txt36}); + my $tpl = $db->get_tpl("208"); my @tpl_order = split /,/,$tpl->{tpl_order}; + my $tplf = $db->get_tpl("201");#Firma tpl + my @tplf_order = split /,/,$tplf->{tpl_order}; my $txt20 = $R::txt20 || $ctt->{txt20} || "";#Leistungsdatum my $int05 = $R::int05 || $ctt->{int05} || "";#manuell @@ -233,19 +235,10 @@ EOF $gesamt = $lb->round($gesamt); $gesamt = $lb->cashme($gesamt); - $ctf->{txt13} = $1 if($ctf->{txt13} =~ /(\d+)/); - if($node_name =~ /steuerfrei/){#dirty hack - $sum_parts0 += $gesamt; - }elsif("$cttpos->{$id}->{int05}" =~ /\d/){ - $sum_parts0 += $gesamt if("$cttpos->{$id}->{int05}" == "0"); - $sum_parts7 += $gesamt if("$cttpos->{$id}->{int05}" == "7"); - #$sum_parts19 += $gesamt if("$cttpos->{$id}->{int05}" == "19"); - $sum_parts19 += $gesamt if($cttpos->{$id}->{int05} >= 16); + if($cttpos->{$id}->{int05} =~ /\d/){ + $sum_parts19 += $gesamt; }else{ - #print "yyy $gesamt $ctf->{txt13} |"; - $sum_parts0 += $gesamt if("$ctf->{txt13}" == "0"); - $sum_parts7 += $gesamt if("$ctf->{txt13}" == "7"); - $sum_parts19 += $gesamt if("$ctf->{txt13}" >= "16"); + $sum_parts19 += $gesamt; } #1. Spalte @@ -428,10 +421,30 @@ EOF $sum_umst19 = $lb->cashme($sum_umst19,","); $sum_paid = $lb->cashme($sum_paid,","); + my $payment_text = ""; + foreach(@tplf_order){ + my ($key,$des,$size) = split /=/,$_; + if($key =~ /txt5\d/){ + $ctf->{$key} = $q->unescapeHTML("$ctf->{$key}"); + $ctf->{$key} = $lb->newline($ctf->{$key},"",""); + $ctt->{state} =~ s/\(payone.*//; + if($des =~ /$ctt->{state}/){ + if($sum_parts19 < 0){ + $payment_text = "$ctf->{txt58}"; + }else{ + $payment_text = "$ctf->{$key}"; + } + } + } + } + my $n="5"; my $m= 1 + $k - $n; $m++; - print " \n"; + print "\n"; + print "$payment_text\n"; + print "\n"; + print $q->start_table({-class=>'list',-style=>'border-top:1px;border-style:solid;border-color:black;', -border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n"; print $q->Tr("\n"); print $q->td(" "); diff --git a/copri4/shareeapp-operator/src/Lib/Mlogic.pm b/copri4/shareeapp-operator/src/Lib/Mlogic.pm index 64ca937..dcd64e9 100755 --- a/copri4/shareeapp-operator/src/Lib/Mlogic.pm +++ b/copri4/shareeapp-operator/src/Lib/Mlogic.pm @@ -41,7 +41,8 @@ sub tpl(){ if($users_sharee->{c_id} && $R::sharee_edit ne "delete_account2" && ($users_sharee->{c_id} eq $varenv->{superu_id} || $dbt->{copri_conf}->{stage} eq "test")){ my $coo = $q->cookie('domcookie') || $q->param('sessionid') || ""; - my $api_test = "sharee_kn"; + #my $api_test = "sharee_kn"; + my $api_test = "sharee_fr01"; print $q->div({-style=>'text-align:right;height:25px;padding:6px 15px 6px 0px;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 ] "),"$users_sharee->{txt08}",$q->a({-style=>"color:#$bgcolor1;", -href=>"logout_sharee$session"},"logout")),"\n"; } diff --git a/copri4/shareedms-operator/src/Lib/Config.pm b/copri4/shareedms-operator/src/Lib/Config.pm index 5d4b2f8..bdeb461 100755 --- a/copri4/shareedms-operator/src/Lib/Config.pm +++ b/copri4/shareedms-operator/src/Lib/Config.pm @@ -34,7 +34,7 @@ sub envonline(){ dbuser => $globalconf{$server_type}{$server_key}{database}->{user}, dbpassw => $globalconf{$server_type}{$server_key}{database}->{passwd}, dbhost => $globalconf{$server_type}{$server_key}{database}->{host}, - syshost => $globalconf{$server_type}{$server_key}->{dir_app}, + syshost => $globalconf{$server_type}{$server_key}->{dir_dms}, wwwhost => $globalconf{$server_type}{$server_key}->{operatorDMS}, praefix => $globalconf{$server_type}{$server_key}{database}->{dbname}, systype => "sharee",#(azn) diff --git a/copri4/shareeweb-project/src/Lib/Mlogic.pm b/copri4/shareeweb-project/src/Lib/Mlogic.pm index 77c7c1a..64cc35e 100755 --- a/copri4/shareeweb-project/src/Lib/Mlogic.pm +++ b/copri4/shareeweb-project/src/Lib/Mlogic.pm @@ -48,6 +48,7 @@ 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"; 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"; }