search option for debug-log info by rentaljournal

This commit is contained in:
ragu 2023-10-26 06:50:16 +02:00
parent 44d47011af
commit 9e1a56aa83
7 changed files with 84 additions and 173 deletions

View file

@ -68,7 +68,7 @@ my $response = {
apiserver => "$apiserver",
response => "$respreq",
uri_primary => "$dbt->{primary}->{sharee_primary}->{primaryApp}",
copri_version => "4.1.23.19",
copri_version => "4.1.23.20",
user_id => "",
authcookie => "",
new_authcoo => "0",

View file

@ -1109,7 +1109,6 @@ sub insert_contentoid {
my $dbh = shift || $dbh_intern;
my $insert = shift;
my $reset_keys = shift || "";
my $source = $dbh->get_info( $GetInfoType{SQL_DATABASE_NAME} );
if($insert->{table} eq "contentadr" && $reset_keys eq "reset_adropkeys"){
delete $insert->{txt17};#operators
@ -1167,7 +1166,7 @@ sub insert_contentoid {
my $last_id;
$sth->bind_columns(\$last_id);
my $c_id = $sth->fetchrow_array();
$bw->log("insert_contentoid $source c_id: $c_id",$sql,"") if($debug);
$bw->log("insert_contentoid c_id: $c_id",$sql,"") if($debug);
if($insert->{table} =~ /content$|contentadr$|contenttrans$|contenttver$|contentuser$/ && $insert->{main_id} && $insert->{template_id}){
my $foreignkey = "";
@ -1179,11 +1178,11 @@ sub insert_contentoid {
my $sql_rel = "INSERT INTO relation (main_id,content_id,template_id,change,$foreignkey) VALUES('$insert->{main_id}','$c_id','$insert->{template_id}','now()','$c_id')";
my $sth3 = $dbh->prepare($sql_rel);
$sth3->execute();
$bw->log("insert_contentoid relation $source c_id: $c_id",$sql_rel,"") if($debug);
$bw->log("insert_contentoid relation c_id: $c_id",$sql_rel,"") if($debug);
}
return $c_id;
}
}#end insert_contentoid
#delete content
@ -1223,7 +1222,6 @@ sub collect_transpos {
$search->{$key} =~ s/\s$//g;
$where .= " and cp.c_id = $search->{$key}" if(($key eq "c_id" || $key eq "cttpos_id") && $search->{$key});
$where .= " and cp.$key ilike '%$search->{$key}%'" if($key eq "txt08" && $search->{$key});
$where .= " and cp.$key ilike '%$search->{$key}%'" if($key eq "txt23" && $search->{$key});
$where .= " and cp.int04 = $search->{$key}" if($key eq "int04" && looks_like_number($search->{$key}));
$where .= " and cp.int06 = $search->{$key}" if($key eq "int06" && looks_like_number($search->{$key}));
$where .= " and cp.ct_name = '$search->{$key}'" if($key eq "cp_ct_name" && $search->{$key});
@ -1236,6 +1234,11 @@ sub collect_transpos {
$where .= " and cp.$key = $search->{$key}" if($key eq "int12" && looks_like_number($search->{$key}));
$where .= " and (cp.$key = $search->{$key} OR cp.owner_end = $search->{$key})" if($key eq "owner" && looks_like_number($search->{$key}));
$where .= " and (cp.$key is $search->{$key} OR cp.$key = 0)" if($key eq "int34" && $search->{$key} eq "null");
$where .= " and cp.$key ilike '%$search->{$key}%'" if($key eq "txt23" && $search->{$key});
#logs,debug,agent,HW
if($key eq "txt24" && $search->{$key}){
$where .= " and (cp.txt24 ilike '%$search->{txt24}%' OR cp.txt25 ilike '%$search->{txt24}%' OR cp.txt26 ilike '%$search->{txt24}%' OR cp.txt27 ilike '%$search->{txt24}%' OR cp.txt28 ilike '%$search->{txt24}%' OR cp.txt29 ilike '%$search->{txt24}%')";
}
}
#adding itime to get also not rental dependent entries

View file

@ -21,7 +21,6 @@ use Mod::Callib;
use Mod::Libenzdb;
use Mod::Buttons;
use Lib::Config;
use Digest::MD5 qw(md5 md5_hex);
use Scalar::Util qw(looks_like_number);
my $cf = new Config;
@ -441,7 +440,6 @@ sub month_line(){
my $self = shift;
my ($users) = @_;
#my $users = $db->select_users($u_id);
my $hh;my $mm;
my $day = strftime "%d", localtime;
my $mon = strftime "%m", localtime;
@ -498,7 +496,6 @@ sub rent_scale(){
my $self = shift;
my ($users,$year_st,$mon_st,$day_st,$hh_st,$mm_st,$year_en,$mon_en,$day_en,$hh_en,$mm_en) = @_;
#print "<br />($u_id,$year_st,$mon_st,$day_st,$hh_st,$mm_st,$year_en,$mon_en,$day_en,$hh_en,$mm_en)<br />";
#my $users = $db->select_users($u_id);
my $hh;my $mm;
my $day = strftime "%d", localtime;
my $mon = strftime "%m", localtime;
@ -561,32 +558,6 @@ sub rent_scale(){
return ($day_stpx,$rent_day_px);
}
#check if barcodeable
sub barcodeable(){
my $self = shift;
my ($table,$number) = @_;
my $oGdBar = GD::Barcode->new("Code39", "$number");
my $ct_name = $oGdBar->{text};
my $barcode = $oGdBar->{text};
return ($ct_name,$barcode);
}
#TODO or change to barcode=c_id
#get free barcode
sub get_freenr(){
my $self = shift;
my ($table,$barcode_last) = @_;
my $freenr = $db->collect_content3($table);
my $s_id = $barcode_last;
my $e_id = "100000";
$freenr->{$s_id}->{barcode} = "1000" if(!$freenr->{$s_id}->{barcode} || $freenr->{$s_id}->{barcode} == 0);
for (; $s_id < $e_id; $s_id++){
if($freenr->{$s_id}->{barcode} != $s_id){
return $s_id;
}
}
}
#umst breaking date 16 19 %
sub umst_breaking(){
my $self = shift;
@ -627,25 +598,6 @@ sub checkinput(){
}
}
# input date check. returns english date and 1 if true
sub true_date(){
my $self = shift;
my ($date,$time) = @_;
$date =~ s/,/./g;
my $d_chck = 0;
if($date =~ /(\d{4})-(\d{2})-(\d{2})/){
$d_chck = 1 if(check_date($1,$2,$3));
$date = "$1-$2-$3";
}elsif($date =~ /(\d{2})\.(\d{2})\.(\d{4})/){
$d_chck = 1 if(check_date($3,$2,$1));
$date = "$3-$2-$1";
}
return ($date,$d_chck);
}
# input date check
sub checkdate(){
my $self = shift;
@ -666,41 +618,6 @@ sub checkdate(){
}
sub sub4txt(){
my $self = shift;
my ($txt,$index,$length,$cut,$cut_last) = @_;
my $substrtxt = substr($txt, $index, $length);
#$substrtxt =~ s/<br \/>/\n/g;
#$substrtxt =~ s/<b.?//g;
#$substrtxt =~ s/\/>//g;
#$substrtxt =~ s/^[<|\\|\/|>|:|,|\.|\\n]+//g;
#$substrtxt =~ s/^\w+\s// if($index > 20);
#entferne das erste teil-wort ...
if($cut){
$substrtxt =~ s/^[äöü]+//;
$substrtxt =~ s/^\w+//;
$substrtxt =~ s/^\,//;
$substrtxt =~ s/^\.//;
}
#entferne das letzte teil-wort ...
if($cut_last){
$substrtxt =~ s/[äöü]+$//;
$substrtxt =~ s/\w+$//;
$substrtxt =~ s/\,$//;
$substrtxt =~ s/\.$//;
}
#entferne das letzte teil-wort ...
if($index && ($index > $length)){
$substrtxt =~ s/\w+$//;
}
#$substrtxt =~ s/\s\w+$//;
return $substrtxt;
}
sub newline(){
my $self = shift;
my $txtxx = shift || "";
@ -781,27 +698,6 @@ sub time4de(){
return $date_de;
}
#error window
sub failure(){
my $self = shift;
my ($failure,$back) = @_;
print "<div id='Inhalt3'>\n";
print $q->div("$failure");
print $q->div($q->a({-class=>"linknav3",-href=>'javascript:history.back()'}, "[ $back ]")) if($back);
print "</div>\n";
exit 0;
}
sub failure2(){
my $self = shift;
my ($failure,$back) = @_;
print "<div style='background-color:white;'>\n";
print $q->div("$failure");
print $q->div($q->a({-class=>"linknav3",-href=>'javascript:history.back()'}, "[ $back ]")) if($back);
print "</div>\n";
#exit 0;
}
sub failure3(){
my $self = shift;
my ($failure,$back) = @_;
@ -811,35 +707,6 @@ sub failure3(){
print "</div>\n";
}
#for site-head navigation with breadcrumb and close button
sub pathrun(){
my $self = shift;
my $path = shift;
my @menu = ("");
if($path =~ /^\/(.*)/){
@menu = split /\//,$1;
}
my $node_active;
my $crumb;
my $h=0;
my $backlink;
foreach(@menu){
$node_active=$_;
$crumb = "<a style='text-decoration:none;' href='/$menu[0]'>$menu[0]</a>" if($h==0);
$backlink = "/" if($h==0);
$crumb .= " | <a style='text-decoration:none;' href='/$menu[0]/$menu[1]'>$menu[1]</a>" if($h==1);
$backlink = "/$menu[0]#$menu[1]" if($h==1);
#cut long link-name
my $length=length($menu[2]);
my $cut_last;
$cut_last = 1 if($length >= 30);
my $menu2 = &sub4txt("",$menu[2],0,30,"","$cut_last");
$crumb .= " | <a style='text-decoration:none;' href='/$menu[0]/$menu[1]/$menu[2]'>$menu2</a>" if($h==2);
$backlink = "/$menu[0]/$menu[1]#$menu[2]" if($h==2);
$h++;
}
return ("$node_active","$crumb","$backlink");
}
1;

View file

@ -17,7 +17,6 @@ use DateTime;
use DateTime::Format::Pg;
use Text::CSV_XS;
use Lib::Config;
use Mod::Libenzdb;
use Mod::Libenz;
use Mod::DBtank;
use Mod::Basework;
@ -26,7 +25,6 @@ use Mod::APIsigclient;
use Data::Dumper;
my $cf = new Config;
my $db = new Libenzdb;
my $lb = new Libenz;
my $dbt = new DBtank;
my $bw = new Basework;
@ -921,7 +919,7 @@ sub set_workflow {
#position copy
if($c_idnew > 0){
my ($cttpos,$rows) = $db->collect_contentpos("contenttrans",$c_id);
my ($cttpos,$rows) = $dbt->collect_contentpos($dbh,"contenttrans",$c_id);
foreach my $id (sort { $cttpos->{$a}->{c_id} <=> $cttpos->{$b}->{c_id} } keys(%$cttpos)){
#reverse pos sum for example by Storno
$cttpos->{$id}->{int01} = $cttpos->{$id}->{int01} * -1 if($cttpos->{$id}->{int01} != 0);
@ -943,11 +941,17 @@ sub set_workflow {
$i_rows += 1 if($ctpos_id > 0);
}
}
$db->update_users4trans($c_idnew,"218","",$users_dms->{u_id});
my $update_users = {
table => "users",
change => "no_time",
u_id => $users_dms->{u_id}
};
$dbt->update_one($dbh,$update_users,"c_id4trans=$c_idnew,tpl_id4trans=218");
print redirect("$varenv{wwwhost}/DMS/Faktura?ct_trans=open\&c_id4trans=$c_idnew\&tpl_id4trans=218\&owner=$users_dms->{u_id}\&offset=$R::offset\&limit=$R::limit\&return=$i_rows-$u_rows-$d_rows");
exit 0;
print redirect("$varenv{wwwhost}/DMS/Faktura?ct_trans=open\&c_id4trans=$c_idnew\&tpl_id4trans=218\&owner=$users_dms->{u_id}\&offset=$R::offset\&limit=$R::limit\&return=$i_rows-$u_rows-$d_rows");
exit 0;
}
}#end set_workflow
@ -1005,7 +1009,12 @@ sub set_accounting2invoice {
$i_rows = 1 if($c_idnew);
#taking just same (operator_accounting) invoices detected by int10=2
$db->update_users4trans($c_idnew,"218","",$users_dms->{u_id});
my $update_users = {
table => "users",
change => "no_time",
u_id => $users_dms->{u_id}
};
$dbt->update_one($dbh,$update_users,"c_id4trans=$c_idnew,tpl_id4trans=218");
my $uri_path = $dbt->recurse_node($dbh,$node->{main_id});
print "$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows\n";
@ -1542,7 +1551,12 @@ sub operator_accounting {
$dbt->update_sql($dbh,"UPDATE contenttrans set int20='$ctt->{c_id}' where c_id IN ($ck4ex)");
print FILE "UPDATE contenttrans set int20='$ctt->{c_id}' where c_id IN ($ck4ex)\n";
$db->update_users4trans($c_idnew,"208","",$users_dms->{u_id});
my $update_users = {
table => "users",
change => "no_time",
u_id => $users_dms->{u_id}
};
$dbt->update_one($dbh,$update_users,"c_id4trans=$c_idnew,tpl_id4trans=208");
}
my $uri_path = $dbt->recurse_node($dbh,$node->{main_id});

View file

@ -10,7 +10,6 @@ use strict;
use warnings;
use POSIX;
use CGI; # only for debugging
use Mod::Libenzdb;
use Mod::Libenz;
use Mod::DBtank;
use Mod::Buttons;
@ -29,7 +28,6 @@ use Data::Dumper;
my $cf = new Config;
my $but = new Buttons;
my $db = new Libenzdb;
my $lb = new Libenz;
my $dbt = new DBtank;
my $apif = new APIfunc;
@ -115,13 +113,22 @@ sub delete_account {
sub create_account(){
my $self = shift;
my $owner = shift;
my $table = "contentadr";
my $dbh = "";
my $insert_adr = {
table => "contentadr",
template_id => 202,
main_id => 200011,
mtime => 'now()',
owner => $owner,
int20 => $owner,
};
my $c_idnew = $dbt->insert_contentoid($dbh,$insert_adr,"");
my $ctadr = { c_id => $c_idnew };
$insert_adr->{ct_name} = $c_idnew;
$insert_adr->{barcode} = $c_idnew;
$dbt->update_record($dbh,$insert_adr,$ctadr);
my $c_idnew = $db->insert_content($table);
$db->updater("$table","c_id",$c_idnew,"ct_name","$c_idnew","$owner");
$db->updater("$table","c_id",$c_idnew,"barcode","$c_idnew","$owner");
$db->updater("$table","c_id",$c_idnew,"int20","$owner","$owner");
my $rel_idnew = $db->insert_relationlist($table,"200011","de",$c_idnew,"202","ca_id");
return $c_idnew;
}