mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-07-02 12:16:28 +02:00
minor accounting and journaling fix
This commit is contained in:
parent
0ac2e784ca
commit
2e2c824dbe
17 changed files with 223 additions and 300 deletions
|
@ -1998,8 +1998,8 @@ sub bikes_all(){
|
|||
fetch => "all",
|
||||
keyfield => "barcode",#2018-02-21 changed to bike id
|
||||
template_id => "205",#Leihrad_liste
|
||||
int10 => "!=::3",
|
||||
};
|
||||
#int10 => "!=::3",#changed to select also occupied bikes in servicetool
|
||||
|
||||
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
||||
my $main_ids = join(",",@{$bike_node});
|
||||
|
|
|
@ -1170,7 +1170,13 @@ sub collect_theftpos {
|
|||
|
||||
my $where = "where 1=1";
|
||||
foreach my $key (keys (%$search)){
|
||||
$search->{$key} =~ s/\s//g;
|
||||
$search->{$key} =~ s/\s//g;
|
||||
if($search->{$key} =~ /::/ && $key =~ /int\d+/){
|
||||
my $op = "=";
|
||||
my $value = $search->{$key};
|
||||
($op, $value) = split(/::/, $search->{$key});
|
||||
$where .= " and $key $op $value";
|
||||
}else{
|
||||
$where .= " and cp.c_id = $search->{$key}" if($key eq "cttpos_id" && $search->{$key});
|
||||
$where .= " and cp.end_time >= '$search->{$key}'" if($key eq "start_date_time");
|
||||
$where .= " and cp.end_time <= '$search->{$key}'" if($key eq "end_date_time");
|
||||
|
@ -1182,7 +1188,9 @@ sub collect_theftpos {
|
|||
$where .= " and cp.$key = $search->{$key}" if($key eq "int12" && looks_like_number($search->{$key}));#flot_id
|
||||
$where .= " and cp.$key = $search->{$key}" if($key eq "int13" && looks_like_number($search->{$key}));#deviceId
|
||||
$where .= " and cp.$key = $search->{$key}" if($key eq "owner" && looks_like_number($search->{$key}));
|
||||
}
|
||||
}
|
||||
|
||||
$where .= " ORDER BY cp.c_id DESC LIMIT $search->{limit} OFFSET $search->{offset}" if($search->{limit});
|
||||
my $sth = $dbh->prepare("SELECT cp.* from $search->{table} cp $where");
|
||||
my $rc = $sth->execute();
|
||||
|
|
|
@ -43,6 +43,11 @@ sub printpre(){
|
|||
my $printer_id=$R::printer_id;
|
||||
my $mandant_main_id = $R::mandant_main_id;
|
||||
my $id=$R::id;
|
||||
my $pkey = $R::pkey || "";
|
||||
|
||||
my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg";
|
||||
my $aconf = Config::General->new($api_file);
|
||||
my %apikeyconf = $aconf->getall;
|
||||
|
||||
my $payone_conf = $dbt->{operator}->{$varenv{dbname}}->{payone_conf} || $dbt->{payone_conf};
|
||||
my $ctf = $db->get_content1("contentuser","$mandant_main_id");
|
||||
|
@ -87,6 +92,11 @@ body,html {
|
|||
//--></style>","\n";
|
||||
}
|
||||
|
||||
if(!$apikeyconf{pdfprinter}->{pkey} || !$pkey || $apikeyconf{pdfprinter}->{pkey} ne $pkey){
|
||||
print "Failure: access denied, api-key doesn't match";
|
||||
return Apache2::Const::OK;
|
||||
exit 0;
|
||||
}
|
||||
print $q->div({-style=>'font-size:1.2em;font-weight:bold;padding:1em 0.1em;'},"SEPA-Lastschriftmandat"),"\n";
|
||||
print $q->div({-class=>'Oline'},""),"\n";
|
||||
|
||||
|
|
|
@ -591,12 +591,15 @@ sub rpc {
|
|||
|
||||
#SEPA PDFGenerator
|
||||
sub pdfmandat {
|
||||
my $self = shift;
|
||||
my $varenv = shift;
|
||||
my $c_id = shift || 0;
|
||||
|
||||
my $dbh = "";
|
||||
my $authref = {
|
||||
my $self = shift;
|
||||
my $varenv = shift;
|
||||
my $c_id = shift || 0;
|
||||
my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg";
|
||||
my $aconf = Config::General->new($api_file);
|
||||
my %apikeyconf = $aconf->getall;
|
||||
|
||||
my $dbh = "";
|
||||
my $authref = {
|
||||
table => "contentadr",
|
||||
fetch => "one",
|
||||
template_id => "202",
|
||||
|
@ -607,13 +610,12 @@ sub pdfmandat {
|
|||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
open(EMA, ">> $varenv->{logdir}/copri-print.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($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 $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}\&pkey=$apikeyconf{pdfprinter}->{pkey}" $varenv->{basedir}/pdfinvoice/SEPA-Lastschriftmandat-$varenv->{dbname}-$ctadr->{ct_name}.pdf 2>&1`;
|
||||
my $exit_code = $?;
|
||||
my $filesize = -s "$varenv->{basedir}/pdfinvoice/SEPA-Lastschriftmandat-$varenv->{dbname}-$ctadr->{ct_name}.pdf";
|
||||
print EMA "$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\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\n";
|
||||
print EMA "$topdf --page-size A4 '$varenv->{wwwhost}/PDFGenerator?printer_id=SEPA-Lastschriftmandat\&mandant_main_id=$dbt->{shareedms_conf}->{parent_id}\&id=$ctadr->{c_id}\&pkey=$apikeyconf{pdfprinter}->{pkey}' $varenv->{basedir}/pdfinvoice/SEPA-Lastschriftmandat-$varenv->{dbname}-$ctadr->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\n";
|
||||
}
|
||||
close EMA;
|
||||
return "$varenv->{basedir}/pdfinvoice/SEPA-Lastschriftmandat-$varenv->{dbname}-$ctadr->{ct_name}.pdf";
|
||||
|
@ -638,6 +640,9 @@ sub payone_capture(){
|
|||
my $retval = "";
|
||||
my $return_text = "";
|
||||
my $dbh = "";
|
||||
my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg";
|
||||
my $aconf = Config::General->new($api_file);
|
||||
my %apikeyconf = $aconf->getall;
|
||||
|
||||
my $update_ctt = {
|
||||
table => "contenttrans",
|
||||
|
@ -727,18 +732,17 @@ sub payone_capture(){
|
|||
#wkhtml
|
||||
if(1==1){
|
||||
my $praefix = "$ctt->{txt00}-$varenv->{praefix}";#like Rechnung-sharee_operator
|
||||
my $wc_line= $ctt->{int04};#Adresse.Tabelle
|
||||
my $topdf = "$varenv->{basedir}/src/wkhtmltopdf-amd64";
|
||||
my $exit_code = 1;
|
||||
my $print_return = "";
|
||||
$print_return = `$topdf --page-size A4 "$varenv->{wwwhost}/Printpreview?printer_id=PDF\&mandant_main_id=$mandant_id\&main_id=$main_id\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$ctt->{c_id}\&u_id=$owner\&wc=$wc_line" $varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf 2>&1`;
|
||||
$print_return = `$topdf --page-size A4 "$varenv->{wwwhost}/Printpreview?printer_id=PDF\&mandant_main_id=$mandant_id\&main_id=$main_id\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$ctt->{c_id}\&u_id=$owner\&pkey=$apikeyconf{pdfprinter}->{pkey}" $varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf 2>&1`;
|
||||
$exit_code = $?;
|
||||
sleep 2;
|
||||
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $filesize = -s "$varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf";
|
||||
open(EMA, ">> $varenv->{logdir}/copri-print.log");
|
||||
print EMA "\n$now_dt\n$topdf --page-size A4 \"$varenv->{wwwhost}/Printpreview?printer_id=PDF\&mandant_main_id=$mandant_id\&main_id=$main_id\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$ctt->{c_id}\&u_id=$owner\&wc=$wc_line\" $varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\n";
|
||||
print EMA "\n$now_dt\n$topdf --page-size A4 \"$varenv->{wwwhost}/Printpreview?printer_id=PDF\&mandant_main_id=$mandant_id\&main_id=$main_id\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$ctt->{c_id}\&u_id=$owner\&pkey=$apikeyconf{pdfprinter}->{pkey}\" $varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\n";
|
||||
|
||||
#send_invoice infomail, only if eMail never sent
|
||||
if(-f "$varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf" && !$ctt->{txt30}){
|
||||
|
|
|
@ -75,6 +75,9 @@ sub preinit(){
|
|||
my $u_rows=0;
|
||||
my $d_rows=0;
|
||||
my $dbh = "";
|
||||
my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg";
|
||||
my $aconf = Config::General->new($api_file);
|
||||
my %apikeyconf = $aconf->getall;
|
||||
|
||||
if(!$users_dms->{u_id}){
|
||||
return "failure::Fehler<br /> Die Anwender Authentifikation wurde unterbrochen.";
|
||||
|
@ -464,21 +467,8 @@ sub preinit(){
|
|||
|
||||
#delete ask
|
||||
if("$ib_key" eq "remove_chk4rel" && $R::main_id && $R::c_id && $R::template_id && $R::rel_id){
|
||||
my $rel4nd = $db->collect_rel4nodes("",$R::c_id,$R::template_id);
|
||||
my $rel4tpl = $db->get_rel4tpl($R::main_id,$lang,"","","",$R::rel_id);
|
||||
my $node_names; my $i=0;
|
||||
my $delete_key = "";
|
||||
$delete_key = "delete_trans" if($rel4tpl->{ct_table} eq "contenttrans");
|
||||
$delete_key = "delete_tver" if($rel4tpl->{ct_table} eq "contenttver");
|
||||
foreach my $rid (sort { lc($rel4nd->{$a}->{node_name}) cmp lc($rel4nd->{$b}->{node_name}) } keys (%$rel4nd)){
|
||||
$i++;
|
||||
$node_names .= "• $rel4nd->{$rid}->{node_name}</br>" if($rel4nd->{$rid}->{node_name});
|
||||
}
|
||||
if($i == 1){
|
||||
return "failure::Datensatz wirklich löschen. ::?ct_trans=$delete_key\&exit_box2=1\&xml_export=$R::xml_export\&c_id=$R::c_id\&rel_id=$R::rel_id ::löschen"
|
||||
}else{
|
||||
return "failure::Es gibt hier zwei Möglichkeiten. Nur die Relation löschen oder den Content komplett löschen. ::?ct_trans=delete_rel4ct\&exit_box2=1\&main_id=$R::main_id\&rel_id=$R::rel_id ::Relation löschen ::?rel_edit=$delete_key\&exit_box2=1\&xml_export=$R::xml_export\&c_id=$R::c_id\&rel_id=$R::rel_id ::Content löschen"
|
||||
}
|
||||
return "failure::Datensatz wirklich löschen. ::?ct_trans=delete_trans\&exit_box2=1\&c_id=$R::c_id\&rel_id=$R::rel_id ::löschen"
|
||||
}
|
||||
|
||||
#delete Only relation ... without content
|
||||
|
@ -501,12 +491,7 @@ sub preinit(){
|
|||
$table = "contenttrans" if($ib_key =~ /delete_trans/);
|
||||
my $ctt = $db->get_content1("$table","$c_id4del");
|
||||
|
||||
my ($cttpos,$rows) = $db->collect_contentpos("$table","$c_id4del");
|
||||
foreach my $id (sort { lc($cttpos->{$a}->{sort}) cmp lc($cttpos->{$b}->{sort}) } keys(%$cttpos)){
|
||||
$db->update_content4comp("content",$cttpos->{$id}->{ct_name},"$cttpos->{$id}->{cc_id}","+","$cttpos->{$id}->{int03}","$users_dms->{kind_of_trans}","$cttpos->{$id}->{txt12}");
|
||||
}
|
||||
|
||||
$d_rows += $db->delete_content("$table","$c_id4del");
|
||||
$d_rows += $db->delete_content($table,$ctt->{c_id});
|
||||
$db->update_users4trans("0","0","",$users_dms->{u_id});
|
||||
print $q->div({-class=>'elementwhite'},"2... redirecting to ... or CLICK ", $q->a({href=>"$varenv{wwwhost}$script$path"},"$varenv{wwwhost}$script$path"));
|
||||
print redirect("$varenv{wwwhost}$script$path?redirected=1\&return=0-0-0|$i_rows-$u_rows-$d_rows");
|
||||
|
@ -690,20 +675,18 @@ sub preinit(){
|
|||
$psize="A5";
|
||||
#-B 0 -T 0 -L 0 -R 0 # testing paper-margin=0
|
||||
}
|
||||
my $wc_line=0;
|
||||
$wc_line= $ctt->{int04};#Adresse.Tabelle
|
||||
my ($sysname, $nodename, $release, $version, $machine) = uname();
|
||||
my $topdf = "$varenv{basedir}/src/wkhtmltopdf-amd64";
|
||||
|
||||
if("$R::printer_id" =~ /PDF/){
|
||||
#without system() because we have to wait until PDF is ready
|
||||
$print_return = `$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 2>&1`;
|
||||
$print_return = `$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}\&pkey=$apikeyconf{pdfprinter}->{pkey}" $varenv{pdf}/$praefix-$ctt->{ct_name}.pdf 2>&1`;
|
||||
$exit_code = $?;
|
||||
|
||||
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\nset_state: $R::set_state\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}\&pkey=$apikeyconf{pdfprinter}->{pkey} $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;
|
||||
}
|
||||
|
|
|
@ -899,37 +899,6 @@ sub maininit(){
|
|||
}
|
||||
###
|
||||
|
||||
###PDFout Generator
|
||||
if("$ib_key" =~ /PDFout|Upload/){
|
||||
$db->users_up("time4csv","$time",$users_dms->{u_id});
|
||||
$users_dms = $db->select_users($users_dms->{u_id});
|
||||
my ($sysname, $nodename, $release, $version, $machine) = uname();
|
||||
#print "($sysname, $nodename, $release, $version, $machine)";
|
||||
my $topdf = "$varenv{basedir}/src/wkhtmltopdf-i386";
|
||||
$topdf = "$varenv{basedir}/src/wkhtmltopdf-amd64" if($machine =~ /_64/);
|
||||
$topdf = "$varenv{basedir}/src/wkhtmltopdf.app/Contents/MacOS/wkhtmltopdf" if($sysname =~ /Darwin/);
|
||||
|
||||
#my @ck_ids = $R::rel_id;
|
||||
#foreach(@keywords){
|
||||
# @ck_ids = $q->param($_) if($_ =~ /ckid/);#because of $R::ckid_rel as array
|
||||
#}
|
||||
#my $ck4ex = join(',',@ck_ids);
|
||||
my $ck4ex = "$users_dms->{checked4dragg}";
|
||||
if($ck4ex && $R::template_id && $R::main_id){
|
||||
my $psize="A4";
|
||||
my $wc_line=0;
|
||||
my $node = $db->get_node4multi($R::main_id,$lang);
|
||||
system(`$topdf --page-size $psize "$varenv{wwwhost}$script/Printpreview?printer_id=$R::printer_id\&main_id=$node->{main_id}\&template_id=$R::template_id\&ck4ex=$ck4ex\&ct_name2print=$node->{node_name}\&u_id=$users_dms->{u_id}\&wc=$wc_line" $varenv{pdf}/$users_dms->{u_id}-$users_dms->{time4csv}.pdf`);
|
||||
|
||||
#print "$topdf --page-size $psize \"$varenv{wwwhost}$script/Printpreview?printer_id=$R::printer_id\&main_id=$node->{main_id}\&template_id=$R::template_id\&ck4ex=$ck4ex\&ct_name2print=$node->{node_name}\&u_id=$users_dms->{u_id}\&wc=$wc_line\" $varenv{pdf}/$users_dms->{u_id}-$users_dms->{time4csv}.pdf\n";
|
||||
if( -f "$varenv{pdf}/$users_dms->{u_id}-$users_dms->{time4csv}.pdf" && $varenv{metahost}){
|
||||
print redirect(-uri=>"$varenv{metahost}/pdf/$users_dms->{u_id}-$users_dms->{time4csv}.pdf", -target=>'_blank');
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
###
|
||||
|
||||
###CSV Generator
|
||||
if("$ib_key" =~ /XLSout/ && $R::template_id){
|
||||
$db->users_up("time4csv","$time",$users_dms->{u_id});
|
||||
|
|
|
@ -49,8 +49,13 @@ sub printpre(){
|
|||
my $mandant_main_id=$R::mandant_main_id;
|
||||
my $main_id=$R::main_id;
|
||||
my $ct_name2print=$R::ct_name2print;
|
||||
my $pkey = $R::pkey || "";
|
||||
my $debug = 0;#print line to doc if debug
|
||||
|
||||
my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg";
|
||||
my $aconf = Config::General->new($api_file);
|
||||
my %apikeyconf = $aconf->getall;
|
||||
|
||||
print $q->start_html(-title=>'',
|
||||
-base=>'true',
|
||||
-target=>'Printpre',
|
||||
|
@ -156,6 +161,12 @@ td {
|
|||
open(PMA, ">> $varenv{logdir}/Printpreview.log");
|
||||
print PMA "\n-->$now_dt --> $varenv{dbname}-$ct_name2print\n";
|
||||
|
||||
if(!$apikeyconf{pdfprinter}->{pkey} || !$pkey || $apikeyconf{pdfprinter}->{pkey} ne $pkey){
|
||||
print "Failure: access denied, api-key doesn't match";
|
||||
return Apache2::Const::OK;
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $site=1;
|
||||
my $site_all=1;
|
||||
|
||||
|
@ -426,14 +437,14 @@ td {
|
|||
#int9x are not in db
|
||||
#operator invoice
|
||||
if($ctt->{txt00} eq "Rechnung"){
|
||||
@tpl_order = ("c_id=ID","int01=Summe Erlös","state=Zahlungsart","int93=TeilRad Gebühren","int98=19% UmSt","int100=Summe");
|
||||
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int93=TeilRad Gebühren","int100=Summe");
|
||||
}
|
||||
#operator accounting
|
||||
else{
|
||||
if($varenv->{dbname} eq "sharee_sx"){
|
||||
@tpl_order = ("c_id=ID","int01=Summe Erlös","state=Zahlungsart","int94=payone Disagio","int02=Summe Gutschrift");
|
||||
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int94=payone Disagio","int02=Summe Gutschrift");
|
||||
}else{
|
||||
@tpl_order = ("c_id=ID","int01=Summe Erlös","state=Zahlungsart","int94=payone Disagio","int95=payone Transaktion","int96=payone Zahlungsmeldung","int97=payone Kreditkarte Zuordnung","int02=Summe Gutschrift");
|
||||
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int94=payone Disagio","int95=payone Transaktion","int96=payone Zahlungsmeldung","int97=payone Kreditkarte Zuordnung","int02=Summe Gutschrift");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -489,10 +500,6 @@ td {
|
|||
foreach (@tpl_order){
|
||||
my ($key,$val) = split /=/,$_;
|
||||
$cttpos->{$id}->{$key} = $q->unescapeHTML($cttpos->{$id}->{$key});
|
||||
my $txtstyle = "text-align:left;min-width:100px;";
|
||||
if($key =~ /int\d+/){
|
||||
$txtstyle = "text-align:right;min-width:50px;";
|
||||
}
|
||||
|
||||
if(1==1){
|
||||
if($key =~ /ct_name/){
|
||||
|
@ -503,9 +510,9 @@ td {
|
|||
elsif($key =~ /c_id/){
|
||||
print CSV "$cttpos->{$id}->{$key};";
|
||||
if($debug){
|
||||
print $q->td({-class=>'tdint',-nowrap=>1},"$i) $cttpos->{$id}->{$key}"),"\n";
|
||||
print $q->td({-class=>'tdint'},"$i) $cttpos->{$id}->{$key}"),"\n";
|
||||
}else{
|
||||
print $q->td({-class=>'tdint',-nowrap=>1},"$cttpos->{$id}->{$key}"),"\n";
|
||||
print $q->td({-class=>'tdint'},"$cttpos->{$id}->{$key}"),"\n";
|
||||
}
|
||||
}
|
||||
elsif($key =~ /int/){
|
||||
|
@ -562,7 +569,7 @@ td {
|
|||
print $q->Tr(),"\n";
|
||||
print $q->td({-class=>'Oline',-colspan=>$tc}," "),"\n";
|
||||
|
||||
my $cs = $tc - 3;
|
||||
my $cs = $tc - 2;
|
||||
my $payment_text = "";
|
||||
foreach(@tplf_order){
|
||||
my ($key,$des,$size) = split /=/,$_;
|
||||
|
@ -589,23 +596,23 @@ td {
|
|||
#Summe Betreiber Rechnung
|
||||
if($ctt->{template_id} != 208){#not equal Abrechnung
|
||||
print $q->Tr("\n");
|
||||
print $q->td({-class=>'tdint',-colspan=>2},"Nettobetrag");
|
||||
print $q->td({-class=>'tdint',-colspan=>1},"Nettobetrag");
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_netto19 €");
|
||||
|
||||
if($sum_netto19 != 0){
|
||||
print $q->Tr("\n");
|
||||
print $q->td({-class=>'tdint',-colspan=>2,-nowrap=>"1"},"19% UmSt auf $sum_netto19 €");
|
||||
print $q->td({-class=>'tdint',-colspan=>1,-nowrap=>"1"},"19% UmSt auf $sum_netto19 €");
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_umst19 €");
|
||||
}
|
||||
|
||||
print $q->Tr("\n");
|
||||
print $q->td({-class=>'tdsum',-colspan=>2},"Summe $ctt->{state}");
|
||||
print $q->td({-class=>'tdsum',-colspan=>1},"Gesamtbetrag");
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_paid €");
|
||||
}
|
||||
#Summe Betreiber Abrechnung (Gutschrift)
|
||||
else{
|
||||
print $q->Tr("\n");
|
||||
print $q->td({-class=>'tdsum',-colspan=>2},"Summe $ctt->{state}");
|
||||
print $q->td({-class=>'tdsum',-colspan=>1},"Summe");
|
||||
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_operatorcredit €");
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,13 @@ use warnings;
|
|||
use strict;
|
||||
use POSIX;
|
||||
use CGI;
|
||||
use CGI::Cookie ();
|
||||
use Apache2::Const -compile => qw(OK );
|
||||
use DBI;
|
||||
use JSON;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::DBtank;
|
||||
use Mod::APIfunc;
|
||||
use Lib::Config;
|
||||
use Data::Dumper;
|
||||
|
||||
|
@ -19,6 +22,8 @@ sub handler {
|
|||
my $q = new CGI;
|
||||
$q->import_names('R');
|
||||
my $db = new Libenzdb;
|
||||
my $dbt = new DBtank;
|
||||
my $apif = new APIfunc;
|
||||
my $cf = new Config;
|
||||
my %varenv = $cf->envonline();
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
|
@ -29,36 +34,47 @@ sub handler {
|
|||
my @keywords = $q->param;
|
||||
my @query_output = ();
|
||||
my $debug=1;
|
||||
my $dbh = "";
|
||||
my $coo = $q->cookie('domcookie');
|
||||
my $users_sharee = { c_id => 0 };
|
||||
my $users_dms = { u_id => 0 };
|
||||
my $api_return = { authcookie => '' };
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||
if($users_sharee->{c_id} && $varenv{orga} eq "dms" && $coo && length($coo) > 20){
|
||||
$users_dms = $dbt->select_users($dbh,$users_sharee->{c_id},"and cookie='$coo'");
|
||||
}
|
||||
|
||||
print $q->header(-type => "application/json", -charset => "utf-8");
|
||||
|
||||
open(FILE,">>/var/log/copri-bike/ajax_json.log") if($debug);
|
||||
print FILE "$now_dt|$main_id\n" if($debug);
|
||||
print FILE "$now_dt| u_id:$users_dms->{u_id}|$main_id\n" if($debug);
|
||||
|
||||
foreach(@keywords){
|
||||
if($users_dms->{u_id} && $users_dms->{int07} == 2){
|
||||
foreach(@keywords){
|
||||
my @val = $q->param($_);
|
||||
my $valxx = $q->escapeHTML("@val");
|
||||
if($_ eq "c_idadr"){
|
||||
$search = $valxx;
|
||||
}
|
||||
print FILE "$_: $valxx\n" if($debug);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($table eq "content"){
|
||||
if($table eq "content"){
|
||||
my $sth = $db->search_json("$table","$lang","$search","$main_id");
|
||||
while ( my $row = $sth->fetchrow_hashref ){
|
||||
push @query_output, $row;
|
||||
}
|
||||
print FILE Dumper(\@query_output) if($debug);
|
||||
print JSON::to_json(\@query_output);
|
||||
}elsif($table eq "contentadr"){
|
||||
}elsif($table eq "contentadr"){
|
||||
my $sth = $db->search_jsonadr("$table","$lang","$search","$main_id","");
|
||||
while ( my $row = $sth->fetchrow_hashref ){
|
||||
push @query_output, $row;
|
||||
}
|
||||
print FILE Dumper(\@query_output) if($debug);
|
||||
print JSON::to_json(\@query_output);
|
||||
}
|
||||
}
|
||||
close(FILE) if($debug);
|
||||
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
package Mod::ajax_post;
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX;
|
||||
use CGI ':standard';
|
||||
use Apache2::Const -compile => qw(OK );
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
use Lib::Config;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::Libenz;
|
||||
|
||||
sub handler {
|
||||
my ($r) = @_;
|
||||
my $q = new CGI();
|
||||
$q->import_names('R');
|
||||
my @keywords = $q->param;
|
||||
my $cf = new Config;
|
||||
my $db = new Libenzdb;
|
||||
my $lb = new Libenz;
|
||||
my %varenv = $cf->envonline();
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $lang = "de";
|
||||
print $q->header(-charset=>'utf-8');
|
||||
|
||||
open(FILE,">>$varenv{logdir}/ajax_post.log");
|
||||
print FILE "\n\nPost-start: $now_dt\n";
|
||||
foreach my $xkey (@keywords){
|
||||
my @val;
|
||||
my $matrix_val;
|
||||
my $tpl_id;
|
||||
my $xval;
|
||||
if($xkey =~ /^matrix_/){
|
||||
@val = $q->param($xkey);
|
||||
foreach(@val){
|
||||
my ($key,$des,$size,$interval,$service_type) = split /=/,$_;
|
||||
#print FILE "$key,$des,$size,$interval,$service_type\n";
|
||||
|
||||
my $interval = 0;
|
||||
$interval = $q->param("interval_$key") if(looks_like_number($q->param("interval_$key")));
|
||||
my $service_type = 0;
|
||||
$service_type = $q->param("servicetype_$key") if(looks_like_number($q->param("servicetype_$key")));
|
||||
print FILE "\n$key --> interval: $interval | service_type: $service_type\n";
|
||||
$matrix_val .= "$_=$interval=$service_type,";# if($interval =~ /(\d+)/);
|
||||
}
|
||||
$matrix_val =~ s/,$//;
|
||||
#print FILE "$xkey: @val\n";
|
||||
#print FILE "matrix_val: $matrix_val\n";
|
||||
#}elsif($_ =~ /^ckid_rel|ckid_main|edit_main|post_request/){
|
||||
}else{
|
||||
my @xval = $q->param($xkey);
|
||||
foreach(@xval){
|
||||
$xval .= "$_," if($_);
|
||||
}
|
||||
$xval =~ s/,$//;
|
||||
print FILE "$xkey: $xval (owner: $R::owner)\n";
|
||||
}
|
||||
|
||||
if($xkey =~ /c_id4trans/ && looks_like_number($R::owner) && looks_like_number($xval)){
|
||||
$db->update_ajaxes("users","","","","c_id4trans","$xval","$R::owner");
|
||||
}
|
||||
|
||||
if($xkey =~ /matrix_users/ && $R::owner){
|
||||
$matrix_val = "" if($R::u_group =~ /supervisor/);
|
||||
$db->update_ajaxes("users","","","","checkboxes","$matrix_val","$R::owner");
|
||||
}
|
||||
if($xkey =~ /matrix_template/ && $R::template_id){
|
||||
$db->update_ajaxes("template","tpl_id","=","$R::template_id","tpl_order","$matrix_val","");
|
||||
print FILE "update_ajaxes(\"template\",\"tpl_id\",\"=\",\"$R::template_id\",\"tpl_order\",\"$matrix_val\")\n";
|
||||
}
|
||||
if($xkey =~ /k9itemList_(\d+)/){
|
||||
$db->update_ajaxes("template","tpl_id","=","$1","tpl_order","$xval","");
|
||||
}
|
||||
|
||||
#because of downward compatibility
|
||||
if($xkey =~ /^ckid_rel/ && $R::owner){
|
||||
$db->update_ajaxes("users","","","","checked4dragg","$xval","$R::owner");
|
||||
}
|
||||
if($xkey =~ /^ckid_main/ && $R::owner){
|
||||
$db->update_ajaxes("users","","","","view_list","$xval","$R::owner");
|
||||
}
|
||||
if($xkey =~ /^edit_main/ && $R::owner){
|
||||
$db->update_ajaxes("users","","","","edit_list","$xval","$R::owner");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
return Apache2::Const::OK;
|
||||
}
|
||||
1;
|
Loading…
Add table
Add a link
Reference in a new issue