diff --git a/copri4/main/src/Mod/APIpayone.pm b/copri4/main/src/Mod/APIpayone.pm index ea4dd9b..908ee18 100755 --- a/copri4/main/src/Mod/APIpayone.pm +++ b/copri4/main/src/Mod/APIpayone.pm @@ -157,7 +157,7 @@ sub handler { if($txaction eq "capture" && $update_ctt->{int16} == 0 && $ctt->{int01} != $update_ctt->{int19}){ $update_adr->{int12} = $vde_on_fail; $update_ctt->{int14} = 1; - $update_ctt->{txt28} = "capture failed\n" . $ctt->{txt28}; + $update_ctt->{txt28} = "$now_dt $txaction\nreceivable: $update_ctt->{int19}\n" . $ctt->{txt28}; } $dbt->update_record($dbh,$update_ctt,$ctt); diff --git a/copri4/main/src/Mod/Basework.pm b/copri4/main/src/Mod/Basework.pm index e9b4dd4..c3d307c 100755 --- a/copri4/main/src/Mod/Basework.pm +++ b/copri4/main/src/Mod/Basework.pm @@ -70,7 +70,7 @@ sub return_feedback(){ print< \$(document).ready(function(){ - \$( "#retm" ).fadeOut(8000); + \$( "#retm" ).fadeOut(10000); }) EOF diff --git a/copri4/main/src/Tpl/Liste3.pm b/copri4/main/src/Tpl/Liste3.pm index 4a2aed4..2c79cea 100755 --- a/copri4/main/src/Tpl/Liste3.pm +++ b/copri4/main/src/Tpl/Liste3.pm @@ -43,7 +43,7 @@ sub tpl(){ my $node_meta = shift; my $users_dms = shift; my $u_group = shift; - my $return = shift; + my $feedb = shift || {}; my $q = new CGI; my @keywords = $q->param; @@ -60,12 +60,17 @@ sub tpl(){ my $bw = new Basework; my %varenv = $cf->envonline(); + my $keycount = scalar(@keywords); + my $referer = $q->referer(); + $referer =~ s/\?.*//; + my $full_url = $q->url( -path_info => 1 ); + #print "$referer|$full_url\n"; 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"; + $path = "$script" . "$path"; $script=""; } my $feedb = { message => "" }; @@ -102,14 +107,14 @@ sub tpl(){ my ($nyear,$nmon,$nday) = Add_Delta_YMD($year,$mon,1, 0,1,0); $end_date_time = "$nday.$nmon.$nyear"; } - my $c_date; my $start_chck=0;my $end_chck=0;my $message; + my $c_date; my $start_chck=0;my $end_chck=0; if($start_date_time){ ($start_date_time,$start_chck) = $lb->checkdate($start_date_time) if($start_date_time ne "%"); - $message .= ">>> Datum Eingabefehler: $start_date_time <<<" if($start_chck); + $feedb->{message} .= ">>> Datum Eingabefehler: $start_date_time <<<" if($start_chck); } if($end_date_time){ ($end_date_time,$end_chck) = $lb->checkdate($end_date_time) if($end_date_time ne "%"); - $message .= ">>> Datum Eingabefehler: $end_date_time <<<" if($end_chck); + $feedb->{message} .= ">>> Datum Eingabefehler: $end_date_time <<<" if($end_chck); } my $search_startdt = "\'$start_date_time\'"; @@ -135,7 +140,7 @@ sub tpl(){ my $table = $node_meta->{ct_table} || "content"; - my $hashfile = "$varenv{logdir}/$users_dms->{u_id}-$table-searchhash"; + my $hashfile = "$varenv{logdir}/$users_dms->{u_id}-$varenv{dbname}-$table-searchhash"; if($table eq "content"){ $node_meta->{tpl_order} =~ s/txt17=[\w\s=]+,//; @@ -176,7 +181,6 @@ sub tpl(){ my $ct4rel = {}; my $ct4rel_parts = {}; my $k=0; - my $message = ""; my $framewidth = "min-width: 1200px;"; #to keep calendar line @@ -194,13 +198,13 @@ sub tpl(){ my $last_year = ""; if($R::s_start_mtime){ ($date,$start_chck) = $lb->checkdate($R::s_start_mtime) if($R::s_start_mtime !~ "%"); - $message .= ">>> Datum Eingabefehler: $date <<<" if($start_chck); + $feedb->{message} .= ">>> Datum Eingabefehler: $date <<<" if($start_chck); my ($c_dd,$c_mm,$c_yy) = split(/\./,$date); $last_year = $c_yy if("$c_yy" eq "2011"); } if($R::s_end_mtime){ ($date,$end_chck) = $lb->checkdate($R::s_end_mtime) if($R::s_end_mtime !~ "%"); - $message .= ">>> Datum Eingabefehler: $date <<<" if($end_chck); + $feedb->{message} .= ">>> Datum Eingabefehler: $date <<<" if($end_chck); my ($c_dd,$c_mm,$c_yy) = split(/\./,$date); } @@ -231,7 +235,7 @@ sub tpl(){ if($node_meta->{node_name} =~ /OPOS/){ $R::detail_search="search"; $searchref->{int14} = ">=1"; - $message .= ">>> Offene Payone Posten (Fehlgeschlagene Geldeinzüge) <<<"; + $feedb->{message} .= ">>> Offene Payone Posten (Fehlgeschlagene Geldeinzüge) <<<"; $searchref->{offset} = 0; $searchref->{limit} = 1000; $tplids = "209,218"; @@ -242,7 +246,7 @@ sub tpl(){ elsif($node_meta->{node_name} =~ /Mahnung/){ $R::detail_search="search"; $searchref->{int06} = ">=1"; - $message .= ""; + $feedb->{message} .= ""; $searchref->{offset} = 0; $searchref->{limit} = 1000; $tplids = "209,218"; @@ -250,16 +254,6 @@ sub tpl(){ @tpl_order = split /,/,$tpl->{tpl_order}; } - elsif(!$R::detail_search && -f $hashfile && $node_meta->{node_name} =~ /letzte Suche/){ - $message .= ">>> es wurden die letzten Suchparameter oder Filter geladen <<<"; - $searchref->{offset} = 0; - $searchref->{limit} = 1000; - #$tplids = "208,209,218";#reload store by hashfile - $v_journal = $node_meta->{node_name}; - my $tpl = $dbt->get_tpl($dbh,209); - @tpl_order = split /,/,$tpl->{tpl_order}; - } - elsif($node_meta->{node_name} eq "Tagesbericht"){ $R::detail_search="search"; $searchref->{offset} = 0; @@ -304,23 +298,18 @@ sub tpl(){ $main_ids .= $db->collect_noderec($main_id,$lang,"nothing"); $main_ids =~ s/,$//; - $message=$R::message if($R::message); - - #path-line my $redirect = ""; $redirect = "(redirected)" if($R::redirected); #top of bootstrap my $header_style = ""; - $header_style = "border:2px solid #9f1f0e;" if($message); if($node_meta->{tpl_id} == 205 || $node_meta->{tpl_id} == 209){ print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path", $q->span({-style=>"padding:5px 10px;background-color:#86cbd7;color:white;"}, " $months[$mon -1] $year", $q->a({-class=>"linknav",-style=>"padding:0 0.5em;",-title=>"Monat zurück",-href=>"?cal_delta_start=0:-1:0"}," ← "), $q->a({-class=>"linknav",-style=>"padding:0 0.5em;",-title=>"Monat aktuell",-href=>"?cal_today=1"},"•"), - $q->a({-class=>"linknav",-style=>"padding:0 0.5em;",-title=>"Monat vorwärts",-href=>"?cal_delta_start=0:1:0"}," → "), - "$message" + $q->a({-class=>"linknav",-style=>"padding:0 0.5em;",-title=>"Monat vorwärts",-href=>"?cal_delta_start=0:1:0"}," → ") )),"\n"; }elsif($node_meta->{template_id} =~ /209|218/){ print<{faksum}); - print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect | ",$q->checkbox(-name=>" ∑ sum ", -title=>'Faktura Positionen summieren ∑ — kostet Zeit', -onclick=>"postave(1)", -checked=>"$checked_sum"),$q->span({-style=>"$header_style"},"$message")),"\n"; + print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect | ",$q->checkbox(-name=>" ∑ sum ", -title=>'Faktura Positionen summieren ∑ — kostet Zeit', -onclick=>"postave(1)", -checked=>"$checked_sum")),"\n"; }else{ - print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect",$q->span({-style=>"$header_style"},"$message")),"\n"; + print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path $redirect"),"\n"; } print $q->start_form(-name=>'searchform'),"\n"; @@ -433,14 +422,21 @@ EOF $c_id4trans = $users_dms->{c_id4trans}; } - if(!$R::detail_search && -f $hashfile && ($path =~ /letzte Suche/ || $R::select_part || $R::ct_trans || $R::trans2edit || $R::node2edit || $R::base_edit || $R::rel_edit || $R::set_state)){ + #Verkaufsjournal default view + if($node_meta->{tpl_id} == 209 && $v_journal && !$R::detail_search && $full_url eq $referer){ + $searchref->{start_pay_time} = $start_date_time; + $searchref->{end_pay_time} = $end_date_time; + } + + if(!$R::detail_search && -f $hashfile && $full_url eq $referer && ($path =~ /letzte Suche/ || $R::select_part || $R::ct_trans || $R::trans2edit || $R::node2edit || $R::base_edit || $R::rel_edit || $R::set_state)){ $searchref = {}; $searchref = retrieve($hashfile); $tplids = $searchref->{tplids} if($searchref->{tplids}); + $feedb->{message} .= "Es wurden die letzten Suchparameter oder Filter geladen" if(keys %$searchref > 7); } #it will takes only one dataset - if($node_meta->{ct_table} eq "contenttrans" && $c_id4trans && $c_id4trans =~ /^\d+$/ && $users_dms->{faksum}){ + if($node_meta->{ct_table} eq "contenttrans" && $c_id4trans && $c_id4trans =~ /^\d+$/ && (($users_dms->{faksum}) || ($node_meta->{tpl_id} == 209 && $v_journal && !$R::detail_search))){ $ct4rel = $db->collect_cid($table,$lang,$tplids,$R::rel_id,$R::barcode,"c_id",$c_id4trans); }elsif(!$start_chck && !$end_chck){ @@ -457,29 +453,16 @@ EOF } #trying to save hashref - if(ref($searchref) eq "HASH" && $path !~ /letzte Suche/ && !$R::select_part && !$R::ct_trans && !$R::trans2edit && !$R::node2edit && !$R::base_edit && !$R::rel_edit && !$R::set_state){ - store $searchref, $hashfile; + #if(ref($searchref) eq "HASH" && $path !~ /letzte Suche/ && !$R::select_part && !$R::ct_trans && !$R::trans2edit && !$R::node2edit && !$R::base_edit && !$R::rel_edit && !$R::set_state){ + if(ref($searchref) eq "HASH" && $path !~ /letzte Suche/){ + if($keycount > 0){ + store $searchref, $hashfile; + }else{ + unlink $hashfile; + } } $rows = $db->count_content($table,"$main_ids","$tplids"); - #Verkaufsjournal default view - if($node_meta->{tpl_id} == 209 && $v_journal && !$R::detail_search){ - $searchref->{start_pay_time} = $start_date_time; - $searchref->{end_pay_time} = $end_date_time; - } - if(1==2 && $node_meta->{tpl_id} == 209 && $v_journal && !$R::detail_search){ - my $pref_209 = { - table => "contenttrans", - fetch => "one", - order => "int11", - state => "Tagesabschluss", - }; - $last_ab = $dbt->fetch_tablerecord($dbh,$pref_209); - $searchref->{int11} = $last_ab->{int11} if($last_ab->{int11}); - - } - #print Dumper($last_ab->{int11}); - #reload sig bikes and stations states #$bw->log("Liste3 condition",$node_meta,""); if($varenv{syshost} eq "shareedms-sx"){ @@ -507,7 +490,7 @@ EOF }#end $ct4rel collect }else{ - $return = "failure::Abbruch. Keine Zugriffsberechtigung"; + $feedb->{message} = "failure::Abbruch. Keine Zugriffsberechtigung"; }#end permission read my $max_sum_pos = -10000; @@ -1334,7 +1317,6 @@ EOF print ""; - $return = $feedb->{message} if($feedb->{message}); - return $return; + return $feedb; } 1; diff --git a/copri4/main/src/Tpl/SubListe.pm b/copri4/main/src/Tpl/SubListe.pm index 81330f1..b7a051f 100755 --- a/copri4/main/src/Tpl/SubListe.pm +++ b/copri4/main/src/Tpl/SubListe.pm @@ -33,11 +33,14 @@ sub new { sub tpl(){ my $node_meta = shift; my $users_dms = shift; - my $return = shift || ""; + my $feedb = shift || {}; my $q = new CGI; my @keywords = $q->param; my $keycount = scalar(@keywords); + my $referer = $q->referer(); + $referer =~ s/\?.*//; + my $full_url = $q->url( -path_info => 1 ); my $time = time; my $now_db = strftime("%d.%m.%Y %H:%M:%S",localtime(time)); my $cf = new Config; @@ -46,6 +49,8 @@ sub tpl(){ my $dbt = new DBtank; my $apif = new APIfunc; my $but = new Buttons; + + my $keylength = scalar(@keywords); my %varenv = $cf->envonline(); my $path = $q->path_info(); my $coo = $q->cookie(-name=>'domcookie') || ""; @@ -56,7 +61,6 @@ sub tpl(){ my %ib = $but->ibuttons(); my $opdir_dms = "$dbt->{copri_conf}->{basedir}/$dbt->{operator}->{$varenv{dbname}}->{dir_dms}" || ""; - my $message = ""; my $s_owner_id = ""; my $offset = $R::offset || "0"; my $limit = $R::limit || 250; @@ -103,13 +107,13 @@ sub tpl(){ my $last_year; if($R::s_start_mtime){ ($date,$start_chck) = $lb->checkdate($R::s_start_mtime) if($R::s_start_mtime !~ "%"); - $message .= ">>> Datum Eingabefehler: $date <<<" if($start_chck); + $feedb->{message} .= ">>> Datum Eingabefehler: $date <<<" if($start_chck); my ($c_dd,$c_mm,$c_yy) = split(/\./,$date); $last_year = $c_yy if("$c_yy" eq "2011"); } if($R::s_end_mtime){ ($date,$end_chck) = $lb->checkdate($R::s_end_mtime) if($R::s_end_mtime !~ "%"); - $message .= ">>> Datum Eingabefehler: $date <<<" if($end_chck); + $feedb->{message} .= ">>> Datum Eingabefehler: $date <<<" if($end_chck); my ($c_dd,$c_mm,$c_yy) = split(/\./,$date); } @@ -200,12 +204,13 @@ EOF $users_dms->{"sort_updown_$table"} = "down" if(!$users_dms->{"sort_updown_$table"}); #print Dumper($node_meta); - my $hashfile = "$varenv{logdir}/$users_dms->{u_id}-$searchref->{table_pos}-searchhash"; - $hashfile = "$varenv{logdir}/$users_dms->{u_id}-$searchref->{table}-searchhash" if(!$searchref->{table_pos}); + my $hashfile = "$varenv{logdir}/$users_dms->{u_id}-$varenv{dbname}-$searchref->{table_pos}-searchhash"; + $hashfile = "$varenv{logdir}/$users_dms->{u_id}-$varenv{dbname}-$searchref->{table}-searchhash" if(!$searchref->{table_pos}); if($node_meta->{tpl_id} =~ /194/ && !$R::detail_search && -f $hashfile && ($R::node2edit || $R::base_edit)){ $searchref = {}; $searchref = retrieve($hashfile); + $feedb->{message} .= "Es wurden die letzten Suchparameter oder Filter geladen" if(keys %$searchref > 7); } my $ct4rel = {}; @@ -230,19 +235,22 @@ EOF #trying to save hashref if($node_meta->{tpl_id} =~ /194/ && ref($searchref) eq "HASH" && !$R::node2edit && !$R::base_edit){ - store $searchref, $hashfile; + if($keylength > 0){ + store $searchref, $hashfile; + }else{ + unlink $hashfile; + } } $ct4rel = $dbt->search_content($dbh,$searchref,$node_meta,$users_dms,"$main_ids","$tpl_ids","","",$ck4ex); }else{ - $return = "failure::Abbruch. Keine Zugriffsberechtigung"; + $feedb->{message} = "failure::Abbruch. Keine Zugriffsberechtigung"; } } print "
\n"; my $header_style = ""; - $header_style = "border:2px solid #9f1f0e;" if($message); - print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path",$q->span({-style=>"$header_style"},"$message")); + print $q->div({-class=>"copri_header",-style=>"background-color:$node_meta->{bg_color};"},"$path"); print $q->div({-style=>'background-color:silver;height:10px;'},""),"\n"; print $q->start_form(-name=>'searchform'),"\n"; @@ -373,7 +381,7 @@ EOF } } }else{ - $return = "failure::Abbruch. Keine Zugriffsberechtigung"; + $feedb->{message} = "failure::Abbruch. Keine Zugriffsberechtigung"; } } #BIG LOOP loop content table @@ -490,7 +498,7 @@ EOF my $debug = "(ct_table: $node_meta->{ct_table} | main_id: $node_meta->{main_id} | template_id: $node_meta->{template_id})"; print $q->div({-style=>'position:fixed;bottom:1%;font-size:13px;'},"$debug"),"\n" if($users_dms->{u_id} eq $varenv{superu_id}); - return $return; + return $feedb; } 1; diff --git a/copri4/shareedms-operator/src/Lib/Mlogic.pm b/copri4/shareedms-operator/src/Lib/Mlogic.pm index b601b37..2664e93 100755 --- a/copri4/shareedms-operator/src/Lib/Mlogic.pm +++ b/copri4/shareedms-operator/src/Lib/Mlogic.pm @@ -17,6 +17,12 @@ use Mod::DBtank; use POSIX; use Data::Dumper; +my $bw = new Basework; +my $lb = new Libenz; +my $db = new Libenzdb; +my $dbt = new DBtank; +my $but = new Buttons; + sub new { my $class = shift; my $self = {}; @@ -36,11 +42,6 @@ sub tpl(){ my $feedb = shift || ""; $q->import_names('R'); - my $bw = new Basework; - my $lb = new Libenz; - my $db = new Libenzdb; - my $dbt = new DBtank; - my $but = new Buttons; my %ib = $but->ibuttons(); my $script = $q->script_name(); my $path_info = $q->path_info(); @@ -127,8 +128,6 @@ sub tpl(){ if($users_dms->{u_id} && $main_id){ - $bw->return_feedback($node_meta,$users_dms,$feedb); - if($main_id >= "100000"){ my $mstyle=""; @@ -318,7 +317,7 @@ sub tplselect(){ if($node_meta->{tpl_id} =~ /194|195|199/ && $node_meta->{ct_table} eq "contentuser"){ require "Tpl/SubListe.pm"; - $return = &SubListe::tpl($node_meta,$users_dms,$feedb); + $feedb = &SubListe::tpl($node_meta,$users_dms,$feedb); }elsif($node_meta->{ct_table} eq "contentuser"){ require "Tpl/MandantConf.pm"; $return = &MandantConf::tpl($node_meta,$users_dms,$mode,$feedb); @@ -327,10 +326,10 @@ sub tplselect(){ &Karte_osm::tpl($node_meta,$users_dms,$mode,$varenv,"",$feedb); }elsif($node_meta->{ct_table} =~ /contentpos|contentadrpos|users$/){#contentpos or contentadrpos require "Tpl/SubListe.pm"; - $return = &SubListe::tpl($node_meta,$users_dms,$feedb); + $feedb = &SubListe::tpl($node_meta,$users_dms,$feedb); }elsif($node_meta->{ct_table} =~ /content$|contentadr$|contenttrans$/){ require "Tpl/Liste3.pm"; - $return = &Liste3::tpl($node_meta,$users_dms,$mode,$feedb); + $feedb = &Liste3::tpl($node_meta,$users_dms,$mode,$feedb); }elsif($node_meta->{ct_table} =~ /contenttranspos|contenttheftpos/){ require "Tpl/Calorin.pm"; &Calorin::tpl($node_meta,$users_dms,$mode,$feedb); @@ -350,7 +349,9 @@ sub tplselect(){ &Modalbox3::mobox3($node_meta,$users_dms,$feedb,$return,$mode) if($R::rel_edit !~ /delete|save/ && $R::ct_trans !~ /delete/ && $R::base_edit !~ /delete|save_pos/ && !$R::service_id); } } - + if(ref($feedb) eq "HASH" && $feedb->{message}){ + $bw->return_feedback($node_meta,$users_dms,$feedb); + } } 1;