2021-12-30 12:05:56 +01:00
package Address3 ;
#
##
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
#
use strict ;
use warnings ;
use CGI ;
use CGI::Carp qw( fatalsToBrowser ) ;
use CGI ':standard' ;
use Lib::Config ;
use Mod::Buttons ;
use Mod::Libenz ;
use Mod::Libenzdb ;
use Mod::DBtank ;
use Tpl::TransPositionen ;
sub new {
my $ class = shift ;
my $ self = { } ;
bless ( $ self , $ class ) ;
return $ self ;
}
#Template
sub tpl () {
my ( $ node_meta , $ users_dms , $ return ) = @ _ ;
my $ q = new CGI ;
my $ cf = new Config ;
my $ lb = new Libenz ;
my $ db = new Libenzdb ;
my $ dbt = new DBtank ;
my $ but = new Buttons ;
my $ transp = new TransPositionen ;
my % varenv = $ cf - > envonline ( ) ;
my $ script = $ q - > script_name ( ) ;
my $ path_info = $ q - > path_info ( ) ;
my $ path = $ path_info ;
#with meta_host,
if ( "$varenv{metahost}" ) {
$ path = "$script" . "$path_info" ;
$ script = "" ;
}
my $ u_id = $ users_dms - > { u_id } ;
my $ lang = "de" ;
my $ users = $ db - > select_users ( $ u_id ) ;
my $ user_agent = $ q - > user_agent ( ) ;
my % ib = $ but - > ibuttons ( ) ;
my $ line_count1 ;
#get Firma
my $ ctf = $ db - > get_content1 ( "contentuser" , $ dbt - > { shareedms_conf } - > { parent_id } ) ;
2022-01-10 12:33:49 +01:00
my $ rel4tpl = { c_id = > 0 } ;
if ( $ R:: c_id4trans && $ R:: tpl_id4trans && $ users_dms - > { u_id } > 0 ) {
$ rel4tpl = $ db - > get_rel4tpl ( "" , $ lang , $ R:: c_id4trans , $ R:: tpl_id4trans ) ;
$ db - > update_users4trans ( $ R:: c_id4trans , $ R:: tpl_id4trans , $ R:: kind_of_trans , $ users_dms - > { u_id } ) ;
}
2021-12-30 12:05:56 +01:00
my @ tpl_order = split /,/ , $ rel4tpl - > { tpl_order } ;
my $ node = $ db - > get_node4multi ( $ rel4tpl - > { main_id } , $ lang ) if ( $ rel4tpl - > { main_id } ) ;
if ( ! $ node - > { main_id } && $ users - > { owner } ) {
2022-01-10 12:33:49 +01:00
$ db - > update_users4trans ( "0" , "0" , $ R:: kind_of_trans , $ users_dms - > { u_id } ) ;
2021-12-30 12:05:56 +01:00
$ users = $ db - > select_users ( $ u_id ) ;
}
#edit marker for "question save" dialog
if ( $ u_id && $ R:: trans2edit && $ R:: c_id4trans ) {
$ db - > users_up ( "c_id4edit" , "$R::c_id4trans" , "$users->{owner}" ) ;
}
2022-01-10 12:33:49 +01:00
my $ ctx = $ db - > get_content1 ( "contenttrans" , $ R:: c_id4trans ) ;
2021-12-30 12:05:56 +01:00
my $ c_idadr = $ ctx - > { int10 } ; #c_id orig from contentadr
my $ ctadr = $ db - > get_content1 ( "contentadr" , $ c_idadr ) ;
my $ rel_adr = $ db - > get_rel4tpl ( "" , "$lang" , "$c_idadr" , "202" ) ;
#print "\nc_idadr Got it from contenttrans.int10: $c_idadr\n";
#
#my $c_kdnr = $ctx->{txt14};
#my $mandat;
#$mandat = " | Mandat $ctx->{txt26}" if($ctx->{txt26});
my $ ctt = $ ctx ;
if ( ( "$R::trans2edit" eq "client" && $ R:: c_idadr ) || ( $ R:: ct_trans eq "add_transadr" ) ) {
$ ctt = $ db - > get_content1 ( "contentadr" , $ R:: c_idadr ) ;
$ c_idadr = $ ctt - > { c_id } ;
#print "c_idadr Got it from contentadr.c_id: $c_idadr\n";
#$mandat = " | Mandat $ctt->{ct_name}" if($ctt->{ct_name});
#$c_kdnr = $ctt->{ct_name};
}
print << EOF
<style>
. ui - autocomplete {
text - align:left ;
background: #eeeeee;
border:1px solid silver ;
}
</style>
<script>
\ $ ( function ( ) {
\ $( '#json_selectadr' ) . autocomplete ( {
source: '/ajax_json?main_id=$dbt->{shareedms_conf}->{parent_id}&table=contentadr' ,
minLength: 2 ,
select : function ( event , ui ) {
\ $( '#vorname_name' ) . val ( ui . item . vorname_name ) ;
\ $( '#c_idadr' ) . val ( ui . item . c_id ) ;
}
} ) ;
} ) ;
</script>
EOF
;
my $ main_id = $ rel4tpl - > { main_id } || $ ctx - > { int12 } ;
my $ set_main_id = $ ctf - > { txt22 } ;
my @ formular_relations = ( "$set_main_id:Typ auswählen ..." ) ;
my @ workflow_relations = ( "$set_main_id:Typ auswählen ..." ) ;
my $ nodes = $ db - > collect_node ( $ dbt - > { shareedms_conf } - > { faktura } , "$lang" ) ;
my $ depends = "irgendeinzeichen" ;
#$depends = "Storno" if(!$ctx->{close_time});
foreach my $ id ( sort { $ nodes - > { $ a } - > { node_name } cmp $ nodes - > { $ b } - > { node_name } } keys ( %$ nodes ) ) {
push ( @ formular_relations , "$id:$nodes->{$id}->{node_path}" ) if ( ( $ main_id eq $ id ) || ( $ nodes - > { $ id } - > { node_path } !~ /journal|bericht|offen|Storno|Vorauszahlungsrechnung|letzte|langzeit|OPOS|$depends/ ) ) ;
push ( @ workflow_relations , "$id:$nodes->{$id}->{node_path}" ) if ( $ nodes - > { $ id } - > { node_path } !~ /journal|bericht|offen|Schlussrechnung|letzte|langzeit|OPOS|$node->{node_name}$|$ctx->{txt00}|$depends/ ) ;
}
print "\n<div style='position:absolute;text-align:left;background-color:white;width:100%;'>\n" ;
2022-01-10 12:33:49 +01:00
if ( ! $ R:: c_id4trans || ! $ R:: tpl_id4trans ) {
2021-12-30 12:05:56 +01:00
$ lb - > failure3 ( "Das Formular wurde gelöscht bzw. ist nicht vorhanden" ) ;
}
#######Verkauf Header
print $ q - > start_form ( ) , "\n" ;
print "\n<div style='background-color:#a7a18f;padding:0.2em 0.5em;text-align:left;width:100%;' nowrap=1>\n" ;
#submit Header
my $ invoice_time = "" ;
if ( $ ctt - > { invoice_time } ) { #since 2020-03-16 will be set on Printpreview
$ invoice_time = $ lb - > time4de ( $ ctt - > { invoice_time } , 1 ) ;
} else {
$ invoice_time = $ lb - > time4de ( $ ctt - > { mtime } , 1 ) ;
}
my $ channel_map = $ dbt - > channel_map ( ) ;
my $ buchen_users = { txt01 = > "" } ;
if ( $ channel_map - > { $ ctt - > { owner } } ) {
$ buchen_users = { txt01 = > "$channel_map->{$ctt->{owner}}" } ;
} else {
$ buchen_users = $ db - > get_content1 ( "contentadr" , $ ctt - > { owner } ) ;
}
$ set_main_id = $ main_id if ( $ rel4tpl - > { main_id } > "300000" ) ;
if ( ! $ ctx - > { close_time } && ( $ ctx - > { txt00 } !~ /Storno/ ) ) {
my $ ebutton = "ebutton" ;
$ ebutton = "ebutton4" if ( $ ctx - > { ct_name } !~ /\d+/ && $ R:: trans2edit ne "client" ) ;
print $ but - > singlesubmit1 ( "set_relation" , "set_relation" , "$ebutton" , "" , "Generiert RechnungNr. incl. payone Vorautorisierung (txid)" ) ;
print $ but - > selector ( "set_main_id" , "11em" , $ set_main_id , @ formular_relations ) ;
} else {
print $ q - > hidden ( - name = > 'set_main_id' , - override = > '1' , - value = > "$set_main_id" ) ;
print $ q - > span ( { - style = > 'padding:0.05em 3em;background-color:white;border:solid thin gray;' } , "$ctx->{txt00}" ) ;
}
print $ q - > b ( "\# $ctx->{ct_name}" ) ;
print $ q - > span ( { - style = > 'margin:0 0.2em;' } , " | " ) ;
if ( $ ctx - > { ct_name } =~ /\d+/ ) {
print $ but - > singlesubmit1 ( "set_workflow" , "set_workflow" ) ;
print $ but - > selector ( "set_main_id4workflow" , "11em" , "" , @ workflow_relations ) ;
print $ q - > span ( { - style = > 'margin:0 0.2em;' } , " | " ) ;
}
print $ but - > singlesubmit1 ( "ct_trans" , "print_pdf" ) ;
print $ q - > hidden ( - name = > 'printer_id' , - override = > '1' , - value = > "PDF" ) ;
if ( ! $ ctt - > { int01 } || $ ctt - > { ct_name } =~ /-/ ) {
print $ q - > span ( { - style = > 'margin:0 0.2em;position:absolute;right:3px;' } , " $buchen_users->{txt01} / $invoice_time " , $ but - > singlesubmit7 ( "ct_trans" , "remove_chk4rel" , "$ib{remove_chk4rel}" , "" ) ) , "\n" ;
print $ q - > hidden ( - name = > 'c_id' , - override = > '1' , - value = > "$rel4tpl->{content_id}" ) ;
print $ q - > hidden ( - name = > 'template_id' , - override = > '1' , - value = > "$rel4tpl->{template_id}" ) ;
print $ q - > hidden ( - name = > 'main_id' , - override = > '1' , - value = > "$rel4tpl->{main_id}" ) ;
print $ q - > hidden ( - name = > 'rel_id' , - override = > '1' , - value = > "$rel4tpl->{rel_id}" ) ;
} else {
print $ q - > span ( { - style = > 'margin:0 0.2em;position:absolute;right:3px;' } , " $buchen_users->{txt01} / $invoice_time " ) , "\n" ;
}
print "</div>\n" ;
print $ q - > hidden ( - name = > 'owner' , - override = > '1' , - value = > "$users->{owner}" ) ;
print $ q - > hidden ( - name = > 'c_idadr' , - override = > '1' , - value = > "$c_idadr" ) ;
print $ q - > hidden ( - name = > 'offset' , - override = > '1' , - value = > "$R::offset" ) ;
print $ q - > hidden ( - name = > 'limit' , - override = > '1' , - value = > "$R::limit" ) ;
print $ q - > hidden ( - name = > 'relids' , - override = > '1' , - value = > "$R::relids" ) ;
print $ q - > hidden ( - name = > 'ct_name4workflow' , - override = > 1 , - value = > "$ctx->{ct_name}" ) ;
print $ q - > hidden ( - name = > 'p_template' , - override = > '1' , - value = > "$node->{node_path}" ) ;
print $ q - > hidden ( - name = > 'c_id4trans' , - override = > '1' , - value = > "$ctx->{c_id}" ) ;
print $ q - > hidden ( - name = > 'c_id4copy' , - override = > '1' , - value = > "$ctx->{c_id}" ) ;
print $ q - > hidden ( - name = > 'close_time' , - override = > '1' , - value = > "$ctx->{close_time}" ) ;
print $ q - > end_form , "\n" ;
print $ q - > div ( { - style = > 'position:fixed;bottom:2%;right:1%;z-index:10;font-size:13px;' } , " (c_id: $ctx->{c_id} | rel_id: $rel4tpl->{rel_id} | tpl_id: $rel4tpl->{tpl_id})" ) , "\n" if ( $ u_id eq $ varenv { superu_id } ) ;
##########
#Form for AdressData
print $ q - > start_form ( - name = > 'addressform' ) , "\n" ;
#Big table
print $ q - > start_table ( { - class = > 'list' , - border = > '0' , - width = > '100%' , - align = > 'left' , - cellpadding = > '3' , - cellspacing = > '0' } ) , "\n" ;
print "<tr><td width='50%' style='font-size:1em;'>\n" ;
print $ q - > start_table ( { - class = > 'list' , - height = > '10em' , - border = > '0' , - width = > '100%' , - align = > 'left' , - cellpadding = > '0' , - cellspacing = > '0' } ) , "\n" ;
###Content #Edit Address --> template=Adressenliste
$ ctt - > { txt01 } = $ q - > unescapeHTML ( "$ctt->{txt01}" ) ;
if ( $ u_id && ( $ R:: trans2edit eq "client" || $ R:: ct_trans eq "add_transadr" ) ) {
my @ _anrede = ( "" , "Frau" , "Herr" , "Firma" ) ;
print $ q - > hidden ( - name = > 'c_id4trans' , - override = > '1' , - value = > "$ctx->{c_id}" ) , "\n" ; #c_id from contenttrans
print $ q - > hidden ( - name = > 'int10' , - override = > '1' , - value = > "$c_idadr" ) , "\n" ;
#print $q->hidden(-name=>'txt26', -override=>'1', -value=>"$mandat"),"\n";
print $ q - > hidden ( - name = > 'c_idadr' , - override = > '1' , - value = > "$c_idadr" ) , "\n" ;
print $ q - > hidden ( - name = > 'rel_id' , - override = > '1' , - value = > "$rel4tpl->{rel_id}" ) , "\n" ;
print $ q - > hidden ( - name = > 'u_id' , - override = > '1' , - value = > "$u_id" ) , "\n" ;
print $ q - > Tr ( ) , "\n" ;
print "<td class='tdtxt' nowrap>" ;
print $ but - > singlesubmit7 ( "ct_trans" , "save_adr" , "$ib{save_adr}" , "" , "" , "ebutton4" ) , "\n" ;
#print $q->span($q->a({-class=>"ebutton3",-href=>'javascript:history.back()'}, " back "));
print "</td>\n" ;
print $ q - > td ( { - class = > 'tdval' , - nowrap = > 1 } , $ but - > selector ( "txt02" , "60px" , $ ctt - > { txt02 } , @ _anrede ) ) , "\n" ;
#print $q->td({-class=>'tdval'}," ID $c_idadr $mandat"),"\n";
print $ q - > td ( { - class = > 'tdval' } , "Kunden ID $c_idadr" ) , "\n" ;
$ ctt - > { txt01 } = $ lb - > newline ( $ ctt - > { txt01 } , "" , "1" ) ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "Vorname Name<br />Zusatz" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - colspan = > '2' } , $ q - > textarea ( - class = > 'autos' , - style = > 'border:1px solid #ededed;background-color: #ededed;' , - name = > 'txt01' , - default = > "$ctt->{txt01}" , - rows = > 1 , - columns = > 38 ) ) , "\n" ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "Straße Nr." ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - colspan = > '2' , - nowrap = > 1 } , $ q - > textfield ( - class = > 'etxt' , - name = > 'txt03' , - default = > "$ctt->{txt03}" , - size = > '34' , maxlength = > '45' ) ) , "\n" ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "PLZ Ort" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - colspan = > '2' } , $ q - > textfield ( - class = > 'etxt' , - name = > 'txt06' , - default = > "$ctt->{txt06}" , - size = > '34' , maxlength = > '45' ) ) , "\n" ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "eMail" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - colspan = > '2' } , $ q - > textfield ( - class = > 'etxt' , - name = > 'txt08' , - default = > "$ctt->{txt08}" , - size = > '34' , maxlength = > '45' ) ) , "\n" ;
} elsif ( $ u_id ) {
print $ q - > Tr ( ) , "\n" ;
if ( ! $ ctx - > { close_time } ) {
print "<td class='tdtxt' style='width:8em;' nowrap>" ;
print $ but - > singlesubmit2glyph ( "trans2edit" , "client" , "Kunden bearbeiten" , "background-color:white;" ) , "\n" ;
print $ q - > hidden ( - name = > 'c_id4trans' , - override = > '1' , - value = > "$ctx->{c_id}" ) , "\n" ;
#from json_selectadr
print $ q - > hidden ( - id = > 'c_idadr' , - name = > "c_idadr" , - override = > '1' ) , "\n" ;
print $ q - > hidden ( - id = > 'vorname_name' , - name = > "vorname_name" , - override = > '1' ) , "\n" ;
print $ q - > textfield ( - style = > 'border:1px solid silver;vertical-align: top;' , - id = > "json_selectadr" , - name = > "json_selectadr" , - value = > "" ) , "\n" ;
print "</td>\n" ;
} else {
print $ q - > td ( { - class = > 'tdtxt' } , " " ) , "\n" ;
}
print $ q - > td ( { - class = > 'tdval' } , "$ctt->{txt02}" ) , "\n" ;
if ( $ c_idadr && $ rel_adr - > { rel_id } ) {
print $ q - > td ( { - class = > 'tdval' } , $ q - > span ( { - style = > "background-color:#dcd77f;" } , $ q - > a ( { - class = > "linknav" , - href = > "/$users->{fullurl}/Kunden?node2edit=editpart\&mode=manager\&rel_id=$rel_adr->{rel_id}\&tpl_id=202" , - title = > "Kunden Stammdaten öffnen" } , " Kunden ID $c_idadr " ) ) , $ q - > span ( { - style = > "color:red;" } , " $ctadr->{int12}" ) ) , "\n" ;
}
if ( $ ctt - > { txt01 } || $ ctt - > { txt02 } || $ ctt - > { txt07 } || $ ctt - > { txt08 } ) {
$ ctt - > { txt01 } = $ lb - > newline ( $ ctt - > { txt01 } , "" , "" ) ;
print $ q - > Tr ( ) , "\n" ; $ line_count1 + + ;
print $ q - > td ( { - class = > 'tdtxt' } , " " ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - colspan = > 2 } , "$ctt->{txt01}" ) , "\n" ;
print $ q - > Tr ( ) , "\n" ; $ line_count1 + + ;
print $ q - > td ( { - class = > 'tdtxt' } , " " ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - colspan = > 2 } , "$ctt->{txt03}" ) , "\n" ;
print $ q - > Tr ( ) , "\n" ; $ line_count1 + + ;
print $ q - > td ( { - class = > 'tdtxt' } , " " ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - colspan = > 2 } , "$ctt->{txt06}" ) , "\n" ;
print $ q - > Tr ( ) , "\n" ; $ line_count1 + + ;
print $ q - > td ( { - class = > 'tdtxt' } , " " ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - colspan = > 2 } , "$ctt->{txt08}" ) , "\n" ;
}
}
print $ q - > end_table ;
print "</td>\n" ;
my $ txt20 = $ ctt - > { txt20 } || $ ctf - > { txt80 } ;
my $ int05 = "" ;
$ int05 = "(manuell)" if ( $ ctt - > { int05 } ) ;
print "<td width='50%' style='font-size:1em;'>\n" ;
print $ q - > start_table ( { - class = > 'list' , - border = > '0' , - width = > '100%' , - align = > 'left' , - cellpadding = > '0' , - cellspacing = > '0' } ) , "\n" ;
if ( $ u_id && ( $ R:: trans2edit eq "client" || $ R:: ct_trans eq "add_transadr" ) ) {
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "RFID" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' } , $ q - > textfield ( - class = > 'etxt' , - name = > 'txt09' , - default = > "$ctt->{txt09}" , - size = > '25' , maxlength = > '40' ) ) , "\n" ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "Telefon" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' } , $ q - > textfield ( - class = > 'etxt' , - name = > 'txt07' , - default = > "$ctt->{txt07}" , - size = > '25' , maxlength = > '40' ) ) , "\n" ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "Leistungsdatum" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' } , $ q - > textfield ( - class = > 'etxt' , - name = > 'txt20' , - default = > "$txt20" , - size = > '25' , maxlength = > '60' ) , $ but - > checkbox ( "1" , "int05" , "$ctt->{int05}" ) , "manuell" ) , "\n" ;
print $ q - > hidden ( - name = > "int05" , - override = > 1 , - value = > "" ) ;
} else {
if ( $ ctt - > { txt09 } ) {
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "RFID" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' } , "$ctt->{txt09}" ) , "\n" ;
}
if ( $ ctt - > { txt07 } ) {
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "Telefon" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - style = > 'min-width:20em;' } , "$ctt->{txt07}" ) , "\n" ;
}
if ( $ txt20 ) {
print $ q - > Tr ( ) , "\n" ; $ line_count1 + + ;
print $ q - > td ( { - class = > 'tdescr' } , "Leistungsdatum" ) , "\n" ;
if ( $ ctt - > { txt20 } ) {
print $ q - > td ( { - class = > 'tdval' } , "$ctt->{txt20} $int05" ) , "\n" ;
} else {
print $ q - > td ( { - class = > 'tdval' } , "Zur Info: Anhand der Einstellung werden nur Positionen bis Buchungsdatum \"$ctf->{txt80}\" erfasst. Für Buchungen neueren Datums wird nach dem \"buchen\" eine weitere Rechnung generiert." ) , "\n" ;
}
}
}
#payone is working?
#keep in mind
#$ctx is primarly contenttrans
#$ctt = $ctx
#$ctt will partly overwritten by contentadr if address changes
my $ pay_sequence = " | sequencenr: $ctt->{int18}" if ( $ ctt - > { int18 } ) ;
if ( $ ctt - > { int03 } && $ ctt - > { txt16 } ) {
my @ _paymentstate = split ( /\|/ , $ varenv { Zahlungsweise } ) ;
my $ kind_of_payment = "fehlt" ;
$ kind_of_payment = "$_paymentstate[0]" if ( $ ctt - > { int03 } == 1 ) ;
$ kind_of_payment = "$_paymentstate[1]" if ( $ ctt - > { int03 } == 2 ) ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "Payone Zahlungsart" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' } , "$kind_of_payment" ) , "\n" ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "Payone TXID" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' } , "$ctt->{txt16}" ) , "\n" ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "Payone Saldo" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' } , "$ctt->{int16} $pay_sequence" ) , "\n" ;
if ( $ ctt - > { txt28 } =~ /error/i ) {
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "payone error" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' } , "(transaction) $ctt->{txt28}" ) , "\n" ;
}
} else {
#check payone status
if ( $ ctt - > { txt28 } =~ /error/i ) {
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "payone error" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' } , "(transaction) $ctt->{txt28}" ) , "\n" ;
} elsif ( $ ctadr - > { txt28 } =~ /error/i ) {
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdescr' } , "payone error" ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' } , "(address) $ctadr->{txt28}" ) , "\n" ;
}
}
print $ q - > end_table ;
print "</td></tr>\n" ;
###end
print $ q - > end_form , "\n" ;
###Content #Edit Parts
print "<tr><td colspan='5' style='font-size:1em;'>\n" ;
#require "Tpl/TransPositionen.pm";
my $ line_count2 = $ transp - > tpl ( $ node_meta , $ users_dms , $ set_main_id , $ rel4tpl - > { main_id } , $ rel4tpl - > { rel_id } , $ ctx - > { c_id } , $ u_id , $ lang , "$return" , "$node->{node_name}" ) ;
print "</td></tr>\n" ;
###end Edit Parts
#Text & Vorbelegungen
my $ tplf = $ db - > get_tpl ( "201" ) ; #Firma tpl
my @ tplf_order = split /,/ , $ tplf - > { tpl_order } ;
print $ q - > start_form ( ) , "\n" ;
print "<tr><td colspan='5' style='font-size:1.1em;padding-top:1em;'>\n" ;
print $ q - > start_table ( { - class = > 'list' , - border = > '0' , - width = > '100%' , - align = > 'left' , - cellpadding = > '0' , - cellspacing = > '0' } ) , "\n" ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdval4' , - colspan = > "2" } , $ q - > span ( { - style = > 'font-weight:bold;' } , "Internas und Bearbeitungstatus" ) ) , "\n" ;
if ( $ varenv { order_state } ) {
print $ q - > Tr ( ) , "\n" ;
my @ _orderstate = split ( /\|/ , $ varenv { order_state } ) ;
print $ q - > td ( { - class = > 'tdval4' , - colspan = > 2 } , $ but - > selector ( "txt22" , "180px" , $ ctt - > { txt22 } , @ _orderstate ) ) , "\n" ;
}
$ ctt - > { txt23 } = $ q - > unescapeHTML ( "$ctt->{txt23}" ) if ( $ ctt - > { txt23 } ) ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdval4' , - colspan = > '2' } , $ q - > textarea ( - class = > 'etxt' , - name = > 'txt23' , - default = > "$ctt->{txt23}" , - rows = > 4 , - columns = > 90 ) ) , "\n" ;
print $ q - > hidden ( - name = > 'c_id4trans' , - override = > '1' , - value = > "$ctx->{c_id}" ) ;
print $ q - > hidden ( - name = > 'set_main_id' , - override = > '1' , - value = > "$set_main_id" ) , "\n" ;
my $ ebutton = "ebutton" ;
$ ebutton = "ebutton4" if ( $ ctx - > { ct_name } && $ ctx - > { ct_name } =~ /\d+/ && ! $ R:: trans2edit && ! $ ctt - > { txt12 } && $ ctt - > { txt21 } && $ ctt - > { txt21 } !~ /\,/ ) ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - colspan = > 2 } , $ but - > singlesubmit7 ( "ct_trans" , "save_text_internas" , "$ib{save_text}" , "" , "" , "$ebutton" ) ) , "\n" if ( $ ctx - > { close_time } ) ;
if ( $ ctx - > { close_time } ) {
print $ q - > end_form , "\n" ;
print $ q - > start_form ( ) , "\n" ;
}
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdval4' , - colspan = > "2" } , $ q - > span ( { - style = > 'font-weight:bold;' } , "PDF Formular Texte " ) , $ q - > span ( { - style = > 'color:silver;font-weight:normal;' } , " ( z.T. Definitionen aus Einstellung/Firma )" ) ) , "\n" ;
#Zahlungstexte
foreach ( @ tplf_order ) {
my ( $ key , $ des , $ size ) = split /=/ , $ _ ;
if ( $ key =~ /txt5/ && $ ctf - > { $ key } ) {
my @ line_txt = split ( /\n/ , $ ctf - > { $ key } ) ;
$ line_count1 += scalar ( @ line_txt ) ;
$ ctf - > { $ key } = $ q - > unescapeHTML ( "$ctf->{$key}" ) ;
$ ctf - > { $ key } = $ lb - > newline ( $ ctf - > { $ key } , "" , "" ) ;
if ( "$des" =~ /$ctt->{state}/ ) {
print $ q - > Tr ( ) , "\n" ; $ line_count1 + + ;
if ( $ ctt - > { int01 } < 0 ) {
#print $q->td({-class=>'tdval4',-style=>'width:8em;'},"Gutschrift Text"),"\n";
print $ q - > td ( { - class = > 'tdval4' , - colspan = > 2 } , "$ctf->{txt58}" ) , "\n" ;
} else {
#print $q->td({-class=>'tdval4',-style=>'width:8em;'},"$des"),"\n";
print $ q - > td ( { - class = > 'tdval4' , - colspan = > 2 } , "$ctf->{$key}" ) , "\n" ;
}
}
}
}
$ ctt - > { txt12 } = $ q - > unescapeHTML ( $ ctt - > { txt12 } ) || "" ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdval4' , - colspan = > '2' } , $ q - > textarea ( - class = > 'etxt' , - name = > 'txt12' , - default = > "$ctt->{txt12}" , - rows = > 4 , - columns = > 90 ) ) , "\n" ;
print $ q - > Tr ( ) , "\n" ; $ line_count1 + + ;
my @ line_txt12 = split ( /\n/ , $ ctt - > { txt12 } ) ;
$ line_count1 += scalar ( @ line_txt12 ) ;
#Vorbelegung-Text
my $ formular_text = "" ;
my $ set_text_id ;
#at first empty checkbox definition (txt21='txt61,txt62,...')
print $ q - > hidden ( - name = > "off_txt21" , - override = > 1 , - value = > "" ) ;
foreach ( @ tplf_order ) {
my ( $ key , $ des , $ size ) = split /=/ , $ _ ;
if ( $ key =~ /txt6/ && $ ctf - > { $ key } ) {
$ ctf - > { $ key } = $ q - > unescapeHTML ( "$ctf->{$key}" ) ;
my $ substrtxt = $ lb - > sub4txt ( $ ctf - > { $ key } , "0" , "14" ) ;
my $ check = "" ;
$ check = 1 if ( $ ctt - > { txt21 } && $ ctt - > { txt21 } =~ /$key/ ) ;
$ formular_text . = " [ $key $substrtxt..." . $ but - > checkbox ( "$key" , "$key" , "$check" , "$ctf->{$key}" ) . " ] " ;
if ( $ ctt - > { txt21 } && $ ctt - > { txt21 } =~ /$key/ ) {
my @ line_key = split ( /\n/ , $ ctf - > { $ key } ) ;
$ line_count1 += scalar ( @ line_key ) ;
$ ctf - > { $ key } = $ lb - > newline ( $ ctf - > { $ key } , "" , "" ) ;
print $ q - > Tr ( ) ; $ line_count1 + + ;
print $ q - > td ( { - class = > 'tdval4' , - colspan = > 2 } , "$ctf->{$key}" ) , "\n" ;
}
}
}
###
print $ q - > hidden ( - name = > 'c_id4trans' , - override = > '1' , - value = > "$ctx->{c_id}" ) , "\n" ;
print $ q - > hidden ( - name = > 'set_main_id' , - override = > '1' , - value = > "$set_main_id" ) , "\n" ;
my $ ebutton = "ebutton" ;
$ ebutton = "ebutton4" if ( $ ctx - > { ct_name } && $ ctx - > { ct_name } =~ /\d+/ && ! $ R:: trans2edit && ! $ ctt - > { txt12 } && $ ctt - > { txt21 } !~ /\,/ ) ;
print $ q - > Tr ( ) , "\n" ;
print $ q - > td ( { - class = > 'tdval' , - colspan = > 2 } , $ but - > singlesubmit7 ( "ct_trans" , "save_text" , "$ib{save_text}" , "" , "" , "$ebutton" ) , "$formular_text" ) , "\n" if ( ! $ ctx - > { close_time } ) ;
print $ q - > end_table , "\n" ;
print "</td></tr>\n" ;
print $ q - > end_form , "\n" ;
print $ q - > end_table , "\n" ;
###end Big
$ line_count2 = "0" . "$line_count2" if ( $ line_count2 < 10 ) ;
my $ line_count = "$line_count1.$line_count2" ;
#print $q->div({style=>'font-size:0.81em;'},"line to print -> address+text: $line_count1 | table: $line_count2"),"\n";
print "</div>\n" ;
$ db - > update_content4change2 ( "contenttrans" , $ ctx - > { c_id } , "$line_count" , "int04" ) if ( $ ctx - > { c_id } ) ;
return $ line_count ;
}
1 ;