From 45bcc7bc9b0eb47b735901841fcf92eb4551d7f1 Mon Sep 17 00:00:00 2001 From: ragu Date: Mon, 19 Dec 2022 14:21:53 +0100 Subject: [PATCH] invoice save text fix --- copri4/main/src/Mod/Basework.pm | 2 +- copri4/main/src/Mod/DBtank.pm | 4 +- copri4/main/src/Mod/Indexsharee.pm | 16 +-- copri4/main/src/Mod/Libenz.pm | 99 +------------------ copri4/main/src/Mod/Prelib.pm | 9 +- copri4/main/src/Tpl/Calorin.pm | 2 +- .../main/src/scripts/mailTransportInnofact.pl | 1 + 7 files changed, 27 insertions(+), 106 deletions(-) create mode 120000 copri4/main/src/scripts/mailTransportInnofact.pl diff --git a/copri4/main/src/Mod/Basework.pm b/copri4/main/src/Mod/Basework.pm index f5be93a..b4f788f 100755 --- a/copri4/main/src/Mod/Basework.pm +++ b/copri4/main/src/Mod/Basework.pm @@ -111,7 +111,7 @@ sub battery_percent { my $max_bars = shift || 0; my $current_bars = shift || 0;#by user input - my $current_percent = 0; + my $current_percent = 1;#keep 1 % for Mietjournal view if($max_bars == 5){ $current_percent = 10 if($current_bars >= 1); $current_percent = 30 if($current_bars >= 2); diff --git a/copri4/main/src/Mod/DBtank.pm b/copri4/main/src/Mod/DBtank.pm index f6f2466..1b98f83 100755 --- a/copri4/main/src/Mod/DBtank.pm +++ b/copri4/main/src/Mod/DBtank.pm @@ -812,9 +812,11 @@ sub fetch_tablerecord(){ $where .= " and $key $op $value"; }elsif($key =~ /time$/ && $value){ $where .= " and $key $op '$value'"; - }elsif($key =~ /^(c_id|u_id|ct_id|ca_id|barcode|int\d+|owner|template_id)$/ && $value){ + }elsif($key =~ /^(c_id|u_id|ct_id|ca_id|barcode|int\d+|owner|template_id)$/ && (looks_like_number($value) || $value)){ if($value eq "null"){ $where .= " and ($key is null OR $key = 0)"; + }elsif($value eq "nullOR1"){ + $where .= " and ($key is null OR $key = 1)"; }else{ $where .= " and $key $op $value"; } diff --git a/copri4/main/src/Mod/Indexsharee.pm b/copri4/main/src/Mod/Indexsharee.pm index c12fdce..6fe9d77 100755 --- a/copri4/main/src/Mod/Indexsharee.pm +++ b/copri4/main/src/Mod/Indexsharee.pm @@ -348,9 +348,9 @@ sub handler { if($R::rel_edit eq "save_relation" && $R::main_id && $R::main_id >= 200000){ $return = $pl->save_relation($q,$R::main_id,$users_dms->{u_id}); }elsif($R::rel_edit eq "delete_relation" && $R::main_id && $R::main_id >= 200000){ - $return = $pl->delete_relation($R::main_id,$users_dms->{u_id}); + $return = $pl->delete_relation($q,$R::main_id,$users_dms->{u_id}); }elsif($R::rel_edit eq "new_relation" && $R::main_id && $R::main_id >= 200000){ - $return = $pl->new_relation($R::main_id,$users_dms->{u_id}); + $return = $pl->new_relation($q,$R::main_id,$users_dms->{u_id}); }elsif($R::rel_edit eq "save_ctuser" && $R::main_id && $R::main_id >= 200000){ #$return = "failure::under development, $node_meta->{tpl_name}"; $return = $pl->save_service_desc($q,$R::c_id,$users_dms); @@ -375,14 +375,14 @@ sub handler { if($users_dms_primary->{u_id} && $users_dms_primary->{int03} == 2 && $users_dms->{u_id} && $users_dms->{int03} == 2){#DMS Faktura rw $db->update_users4trans($R::c_id4trans,$R::tpl_id4trans,"",$users_dms->{u_id}) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans)); if($R::ct_trans =~ /set_workflow2invoice|set_workflow2storno/){ - $return = $pl->set_workflow($users_dms,$R::c_id4trans,$R::set_main_id4workflow) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans) && looks_like_number($R::set_main_id4workflow)); + $return = $pl->set_workflow($q,$users_dms,$R::c_id4trans,$R::set_main_id4workflow) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans) && looks_like_number($R::set_main_id4workflow)); }elsif($R::ct_trans =~ /set_accounting2invoice/){ - $return = $pl->set_accounting2invoice($users_dms,$R::c_id4trans,$R::set_main_id4workflow) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans) && looks_like_number($R::set_main_id4workflow)); + $return = $pl->set_accounting2invoice($q,$users_dms,$R::c_id4trans,$R::set_main_id4workflow) if(looks_like_number($R::c_id4trans) && looks_like_number($R::tpl_id4trans) && looks_like_number($R::set_main_id4workflow)); }elsif($R::ct_trans =~ /save_text|save_adr/){ - $return = $pl->save_text2contenttrans($users_dms,$R::c_id4trans) if(looks_like_number($R::c_id4trans)); + $return = $pl->save_text2contenttrans($q,$users_dms,$R::c_id4trans) if(looks_like_number($R::c_id4trans)); }elsif($R::detail_search && $R::detail_search eq "operator_accounting"){ my $ck4ex = "@R::ck4ex" || ""; - $return = $pl->operator_accounting($users_dms,$users_sharee,$R::accounting_type,$ck4ex); + $return = $pl->operator_accounting($q,$users_dms,$users_sharee,$R::accounting_type,$ck4ex); }else{ $return .= "|"; $return .= $pre->preinit($users_dms,$lang);#transactions logic @@ -394,12 +394,12 @@ sub handler { #DMS Mietjournal if($node_meta->{ct_table} eq "contenttranspos" && $R::base_edit eq "save_pos"){ - $return = $pl->save_contenttranspos($R::c_id,$users_dms->{u_id}); + $return = $pl->save_contenttranspos($q,$R::c_id,$users_dms->{u_id}); } #DMS insert part or fee if($node_meta->{ct_table} eq "contenttranspos" && $R::insert_contenttranspos){ - $return = $pl->insert_contenttranspos($R::cc_id,$R::ca_id,$R::ct_id,$users_dms->{u_id}); + $return = $pl->insert_contenttranspos($q,$R::cc_id,$R::ca_id,$R::ct_id,$users_dms->{u_id}); } $users_dms = $dbt->select_users($dbh,$users_dms->{u_id},"");#just to get update after save diff --git a/copri4/main/src/Mod/Libenz.pm b/copri4/main/src/Mod/Libenz.pm index fdc1901..9a929e8 100755 --- a/copri4/main/src/Mod/Libenz.pm +++ b/copri4/main/src/Mod/Libenz.pm @@ -452,81 +452,6 @@ sub checkdate(){ -#collect node_name and builds path -sub make_uri2(){ - my $self = shift; - my ($main_id,$lang,$mandantsub_id,$start_id) = @_; - my $gpath; - my $m_id; - my @genpath; - my $i=$1 if($main_id =~ /^(\d)/); - foreach my $id (sort {$nall->{$b}->{main_id} <=> $nall->{$a}->{main_id}} keys (%$nall)){ - #print "xxxx ($main_id =~ /^($i\d+)/) && ($start_id && $main_id >= $start_id) && ($main_id == $nall->{$id}->{main_id})
"; - if(($main_id =~ /^($i\d+)/) && ($start_id && $main_id >= $start_id) && ($main_id == $nall->{$id}->{main_id})){ - ## wegen multible mandanten sub-sub-level, bsp. Waren/[300] Sonstiges - if($mandantsub_id && $i==3){ - if($mandantsub_id == $nall->{$id}->{parent_id}){ - $i--; - $main_id = $nall->{$id}->{parent_id}; - $m_id = $nall->{$id}->{main_id} if(!$m_id); - $genpath[$i] = "/$nall->{$id}->{node_name}"; - #print "$i x/$nall->{$id}->{node_name} ($nall->{$id}->{main_id})
"; - } - ## - }else{ - $i--; - $main_id = $nall->{$id}->{parent_id}; - $main_id = $start_id if($start_id && $i==1); - $m_id = $nall->{$id}->{main_id} if(!$m_id); - $genpath[$i] = "/$nall->{$id}->{node_name}"; - #print "$i /$nall->{$id}->{node_name} ($nall->{$id}->{main_id})
"; - } - } - } - - foreach (@genpath){ - #print "$_|"; - $_ =~ s/\/root//; - $gpath .= "$_"; - } - return ("$m_id","$gpath"); -} - -#new init for make_uri3 with returning nall object -sub init_nodes5uri(){ - my $self = shift; - $nall = $db->collect_node4all(); - return $nall; -} - -#5. collect node_name and builds path without mandant-logic -sub make_uri5(){ - my $self = shift; - my ($main_id,$nall,$depth_start) = @_; - $depth_start = 0 if(!$depth_start); - my $gpath; - my $m_id; - my @genpath; - my $depth=$1 if($main_id =~ /^(\d)/ && $main_id >= 100000); - foreach my $id (sort {$nall->{$b}->{main_id} <=> $nall->{$a}->{main_id}} keys (%$nall)){ - if(($main_id =~ /^($depth\d+)/) && ($main_id == $nall->{$id}->{main_id})){ - $depth--; - $main_id = $nall->{$id}->{parent_id}; - $m_id = $nall->{$id}->{main_id} if(!$m_id); - $genpath[$depth] = "/$nall->{$id}->{node_name}" if($depth > $depth_start); - #print "$depth|$main_id /$nall->{$id}->{node_name} ($nall->{$id}->{main_id})
"; - } - } - - foreach (@genpath){ - #print "$_|"; - $_ =~ s/\/root//; - $gpath .= "$_"; - } - return ("$m_id","$gpath"); -} - - sub sub4txt(){ my $self = shift; my ($txt,$index,$length,$cut,$cut_last) = @_; @@ -563,28 +488,14 @@ sub sub4txt(){ sub newline(){ my $self = shift; - my $txtxx = shift; + my $txtxx = shift || ""; my $not_used = shift || "";#old my $editor = shift || ""; - $txtxx =~ s/\r\n/
/g if(!$editor); - $txtxx =~ s/\n/
/g if(!$editor); - return $txtxx; -} - -#der tiny_mce editor init -sub wyedit(){ - my $self = shift; - my ($users_tiny_mce) = @_; - my $wy=""; - if($varenv{js4tiny_mce} && $users_tiny_mce){ - $wy = ""; + if($txtxx && !$editor){ + $txtxx =~ s/\r\n/
/g; + $txtxx =~ s/\n/
/g; } - return $wy; + return $txtxx; } #Komplettset compset logic diff --git a/copri4/main/src/Mod/Prelib.pm b/copri4/main/src/Mod/Prelib.pm index 1dc9ec1..964cfef 100755 --- a/copri4/main/src/Mod/Prelib.pm +++ b/copri4/main/src/Mod/Prelib.pm @@ -34,7 +34,6 @@ my $bw = new Basework; my $apif = new APIfunc; my $pri = new Pricing; my $si = new APIsigclient; -my $q = new CGI; sub new { my $class = shift; @@ -55,6 +54,7 @@ my $debug=1; #save invoice address or text sub save_text2contenttrans { my $self = shift; + my $q = shift; my $users_dms = shift; my $c_id = shift; @@ -94,6 +94,7 @@ sub save_text2contenttrans { #part or fee to invoice sub insert_contenttranspos { my $self = shift; + my $q = shift; my $cc_id = shift || "";#part my $ca_id = shift || "";#adr my $ct_id = shift || "";#invoice @@ -160,6 +161,7 @@ sub insert_contenttranspos { sub save_contenttranspos { my $self = shift; + my $q = shift; my $c_id = shift; my $owner = shift; @@ -379,6 +381,7 @@ sub save_contenttranspos { #set Faktura workflow like Rechnung to Storno sub set_workflow { my $self = shift; + my $q = shift; my $users_dms = shift; my $c_id = shift; my $set_main_id = shift || ""; @@ -479,6 +482,7 @@ sub set_workflow { #generate invoice from operator accounting sub set_accounting2invoice { my $self = shift; + my $q = shift; my $users_dms = shift; my $c_id = shift; my $set_main_id = shift || ""; @@ -541,6 +545,7 @@ sub set_accounting2invoice { #new node relation with option to create subnode for Servicelog sub new_relation { my $self = shift; + my $q = shift; my $main_id = shift; my $owner = shift; my %varenv = $cf->envonline(); @@ -716,6 +721,7 @@ sub save_relation { #delete node relation with some ki deleting sub content sub delete_relation { my $self = shift; + my $q = shift; my $main_id = shift; my $owner = shift; my %varenv = $cf->envonline(); @@ -916,6 +922,7 @@ sub save_service_desc { #Operator Accounting sub operator_accounting { my $self = shift; + my $q = shift; my $users_dms = shift; my $users_sharee = shift; my $accounting_type = shift || ""; diff --git a/copri4/main/src/Tpl/Calorin.pm b/copri4/main/src/Tpl/Calorin.pm index 9ecaad5..52c472b 100755 --- a/copri4/main/src/Tpl/Calorin.pm +++ b/copri4/main/src/Tpl/Calorin.pm @@ -402,7 +402,7 @@ sub tpl(){ my $user_device = ""; my $charge = ""; $charge .= " → lock-charge $cttpos->{$pid}->{int14} %" if(looks_like_number($cttpos->{$pid}->{int14})); - $charge .= " → bike-charge $cttpos->{$pid}->{int19} %" if(looks_like_number($cttpos->{$pid}->{int19})); + $charge .= " → bike-charge $cttpos->{$pid}->{int19} %" if(looks_like_number($cttpos->{$pid}->{int19}) && $cttpos->{$pid}->{int19} >= 1); if($users_dms_primary->{u_id} && $dbt->{copri_conf}->{contributors} && $users_dms_primary->{u_id} =~ /$dbt->{copri_conf}->{contributors}/){ $pos_id = $q->div({-class=>"popup",-onclick=>"toggle_box('$pid')"},"$cttpos->{$pid}->{c_id}", $q->span({-class=>"popuptext",-id=>"$pid"},"$pos_details")); $user_device = ""; diff --git a/copri4/main/src/scripts/mailTransportInnofact.pl b/copri4/main/src/scripts/mailTransportInnofact.pl new file mode 120000 index 0000000..f2a4035 --- /dev/null +++ b/copri4/main/src/scripts/mailTransportInnofact.pl @@ -0,0 +1 @@ +../../../../../sharee.bike/copri-bike/main/src/scripts/mailTransportInnofact.pl \ No newline at end of file