mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 03:36:30 +01:00
csv export fix
This commit is contained in:
parent
4262462fc8
commit
597284c6a9
4 changed files with 23 additions and 54 deletions
|
@ -1354,8 +1354,8 @@ sub search_json(){
|
|||
#my $sth = $dbh->prepare("SELECT ct.ct_name || ' , Lager ' || ct.txt12 AS label, ct.ct_name AS value, ct.c_id FROM content ct WHERE $sel");
|
||||
|
||||
#If select only mandant specific warenstamm
|
||||
if($varenv{waren_main_id}){
|
||||
my $main_ids = &collect_noderec("",$varenv{waren_main_id},$lang,"nothing");
|
||||
if($dbt->{shareedms_conf}->{waren}){
|
||||
my $main_ids = &collect_noderec("",$dbt->{shareedms_conf}->{waren},$lang,"nothing");
|
||||
$sth = $dbh->prepare("SELECT ct.ct_name || ' , ' || ct.barcode || ' , ' || ct.txt12 AS value, ct.ct_name AS spart_ct_name, ct.c_id FROM $table ct, relation rel WHERE ct.c_id=rel.content_id and rel.main_id IN ($main_ids) and $sel $sel2");
|
||||
}else{
|
||||
$sth = $dbh->prepare("SELECT ct.ct_name || ' , ' || ct.barcode || ' , ' || ct.txt12 AS value, ct.ct_name AS spart_ct_name, ct.c_id FROM $table ct WHERE $sel $sel2");
|
||||
|
@ -1376,7 +1376,7 @@ sub search_json(){
|
|||
|
||||
sub search_content3(){
|
||||
my $self = shift;
|
||||
my ($searchref,$table,$mandant_id,$trans_module,$owner,$lang,$main_ids,$tplids,$ct_ids,$v_journal,$time,$kontext,$scol,$sort_updown,$offset,$limit,$export,$todo,$ck4ex,$opos) = @_;
|
||||
my ($searchref,$table,$mandant_id,$node_meta,$owner,$lang,$main_ids,$tplids,$ct_ids,$v_journal,$time,$kontext,$scol,$sort_updown,$offset,$limit,$export,$todo,$ck4ex,$opos) = @_;
|
||||
|
||||
$main_ids =~ s/,$//;
|
||||
$tplids =~ s/,$//;
|
||||
|
@ -1388,7 +1388,7 @@ sub search_content3(){
|
|||
open(FILE,">>$varenv{logdir}/Liste3.log") if($debug);
|
||||
print FILE "*** $stamp_time Libenzdb.search_content3 ***\n" if($debug);
|
||||
print FILE Dumper($searchref) if($debug);
|
||||
print FILE "$table,$mandant_id,$trans_module,$owner,$lang,$main_ids,$tplids,$ct_ids,$v_journal,$time,$kontext,$scol,$sort_updown,$offset,$limit,$export,$todo,$ck4ex,$opos\n" if($debug);
|
||||
print FILE "$table,$mandant_id,$node_meta->{node_name},$owner,$lang,$main_ids,$tplids,$ct_ids,$v_journal,$time,$kontext,$scol,$sort_updown,$offset,$limit,$export,$todo,$ck4ex,$opos\n" if($debug);
|
||||
close(FILE) if($debug);
|
||||
|
||||
|
||||
|
@ -1565,33 +1565,16 @@ sub search_content3(){
|
|||
|
||||
#save_query
|
||||
#my $save_query = $q->escapeHTML("$txt_where");
|
||||
#&users_up("","windowtask",$save_query,$owner);
|
||||
|
||||
#CSV/FiBu Export###
|
||||
if($export && (("$kontext" ne "Waren" && "$export" ne "FiBu" && $v_journal !~ /_parts/) || ("$export" eq "FiBu" && $v_journal =~ /_parts/) || ("$kontext" eq "Waren" && $v_journal =~ /_parts/))){
|
||||
#print "$v_journal,$time,$kontext,$export<br>";
|
||||
|
||||
my $ctf = &get_content1("","contentuser","$mandant_id");
|
||||
my $tpl_id = $1 if($tplids =~ /(\d+)/);
|
||||
#my $source = "Waren";
|
||||
my $source = $trans_module;
|
||||
if($v_journal){
|
||||
$tpl_id = $ctf->{txt26} if($trans_module eq "Verkauf");
|
||||
$tpl_id = $ctf->{txt27} if($trans_module eq "Einkauf");
|
||||
$tpl_id = $ctf->{txt28} if($trans_module =~ /Faktur|Verleih/);
|
||||
$source = "Waren" if($v_journal =~ /_parts/);
|
||||
}
|
||||
my $tpl = &Libenzdb::get_tpl("",$tpl_id);
|
||||
my @tpl_order = split /,/,$tpl->{tpl_order};
|
||||
my @tpl_order = split /,/,$node_meta->{tpl_order};
|
||||
|
||||
#wg. Buchungsgruppen bzw. Ursprung-nodes (int12) --> Konten im FiBu Export
|
||||
my $users = &get_content4owner("","users",$owner);
|
||||
my $cmain_id = $users->{fullurl};#changed in jvbasel to actual main_id
|
||||
if($cmain_id =~ /[a-zA-Z]/){
|
||||
my $b_node = &get_node2("",$users->{fullurl},$source,$lang);
|
||||
$cmain_id = $b_node->{main_id};
|
||||
}
|
||||
my $colmain_ids = &collect_noderec("",$cmain_id,$lang,"999999");
|
||||
my $colmain_ids = &collect_noderec("",$node_meta->{main_id},$lang,"999999");
|
||||
my $nodes = &Libenzdb::collect_node2("","$colmain_ids");
|
||||
my $ctt;my $ctadr;my $aw_ids;
|
||||
my $what;
|
||||
|
@ -1642,7 +1625,7 @@ sub search_content3(){
|
|||
} keys(%$search)){
|
||||
|
||||
my $s_main_id = "$search->{$id}->{main_id}";
|
||||
$s_main_id = "$search->{$id}->{int12}" if(($v_journal && ($v_journal =~ /_parts/)) || ($trans_module =~ /Verkauf|Faktur|Verleih/));
|
||||
$s_main_id = "$search->{$id}->{int12}" if(($v_journal && ($v_journal =~ /_parts/)) || ($node_meta->{node_name} eq "Faktura"));
|
||||
|
||||
#lxfibu vars
|
||||
my ($l_soll,$l_umsatz,$l_ustnr,$l_haben,$l_gvc,$l_beldat,$l_beleg,$l_opbeleg,$l_skonto,$l_kostnr,$l_text,$l_text2);
|
||||
|
@ -1686,7 +1669,6 @@ sub search_content3(){
|
|||
#Nodes alias Buchungsgruppen parameter
|
||||
foreach my $nid (keys (%$nodes)){
|
||||
if($s_main_id == $nodes->{$nid}->{main_id}){
|
||||
#print "$s_main_id == $nodes->{$nid}->{main_id} $nodes->{$nid}->{node_name} $trans_module<br>";
|
||||
$line = "$nodes->{$nid}->{node_name}";
|
||||
$l_text = "$nodes->{$nid}->{node_name}";
|
||||
|
||||
|
@ -1703,21 +1685,7 @@ sub search_content3(){
|
|||
|
||||
#template definition in src/Tpl/EditMeta.pm
|
||||
my $ustnr;
|
||||
if($trans_module eq "Einkauf"){
|
||||
$ustnr = $nodes->{$nid}->{int04};
|
||||
$ustnr = $ctf->{txt14} if($nodes->{$nid}->{int04} !~ /\d/);
|
||||
$l_soll = $nodes->{$nid}->{int02};#Aufwandskonto???
|
||||
$l_soll = $ctf->{txt15} if($nodes->{$nid}->{int02} !~ /\d/);
|
||||
}
|
||||
if($trans_module eq "Verkauf"){
|
||||
$ustnr = $nodes->{$nid}->{int03};
|
||||
$ustnr = $ctf->{txt13} if($nodes->{$nid}->{int03} !~ /\d/);
|
||||
$l_haben = $nodes->{$nid}->{int01};#Verkauf Erlöskonto
|
||||
$l_haben = $ctf->{txt16} if($nodes->{$nid}->{int01} !~ /\d/);
|
||||
#sollte nicht mur an 999 geknüpft sein, sondern Warengruppen ...
|
||||
#$l_soll = "$nodes->{$nid}->{int02}" if($search->{$id}->{ct_name} eq "999");
|
||||
}
|
||||
if($trans_module =~ /Faktur|Verleih/){
|
||||
if($node_meta->{node_name} eq "Faktura"){
|
||||
$ustnr = $nodes->{$nid}->{int03};#Verkauf = Verleih Umst
|
||||
$ustnr = $ctf->{txt13} if($nodes->{$nid}->{int03} !~ /\d/);
|
||||
$l_haben = $nodes->{$nid}->{int07};#Verleih Erlöskonto
|
||||
|
@ -1792,14 +1760,6 @@ sub search_content3(){
|
|||
close CSV;
|
||||
|
||||
&csv2xls("",$owner,$time) if($export =~ /check4|FiBu/);
|
||||
|
||||
#if($export eq "check4html"){
|
||||
# foreach my $id (keys (%$search)){
|
||||
# $c_ids .= "$search->{$id}->{c_id},";
|
||||
# }
|
||||
# $c_ids =~ s/,$//;
|
||||
# &export2html("","$table","$c_ids","$main_ids","$tpl_id","$owner","$time");
|
||||
#}
|
||||
|
||||
}#end CSV/FiBu Export####
|
||||
#
|
||||
|
|
|
@ -19,6 +19,7 @@ use Mod::APIfunc;
|
|||
use Digest::MD5 qw(md5 md5_hex);
|
||||
use Digest::SHA qw(sha1_base64);
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
use URI::Encode;
|
||||
use Mod::Prelib;
|
||||
use Mod::Basework;
|
||||
use Mod::Payment;
|
||||
|
@ -39,6 +40,7 @@ my $payone = new Payment;
|
|||
my $smstrans = new SMSTransport;
|
||||
|
||||
my $q = new CGI;
|
||||
my $uri_encode = URI::Encode->new( { encode_reserved => 1 } );
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
|
@ -274,6 +276,7 @@ sub save_account(){
|
|||
$txt17{$ctadr->{txt17}} = 1;
|
||||
}
|
||||
|
||||
#TODO, check if merchant_id for KN and set $bonus_prefix
|
||||
if($valxx && ($valxx =~ /^(\w{2,3})-(\w+)/ || $valxx =~ /^(\w{2,3})(\d+)/)){
|
||||
$valxx =~ s/\s//g;
|
||||
my $bonus_prefix = uc($1),
|
||||
|
@ -292,6 +295,10 @@ sub save_account(){
|
|||
ct_name => "$bonusnr",
|
||||
};
|
||||
my $bonus_record = $dbt->fetch_record($dbh_operator,$pref_bo);
|
||||
if(!$bonus_record->{c_id} && $operator_conf->{database}->{dbname} eq "sharee_kn"){
|
||||
my $swk_code = "";
|
||||
$swk_code = $lb->grep_filecontent("$varenv{basedir}/ftp/SWK_codes/got_last.csv","$bonusnr");
|
||||
}
|
||||
|
||||
#add operators dbname only if Bonusnr matches
|
||||
print FILE "txt15=$bonusnr requested on web Bonustarif on: $operator_conf->{database}->{dbname} --> barcode:$bonus_record->{barcode} --> txt21:$bonus_record->{int21} --> txt22:$bonus_record->{int22}\n" if($debug);
|
||||
|
@ -332,7 +339,7 @@ sub save_account(){
|
|||
owner => $owner,
|
||||
ret => $ret,
|
||||
};
|
||||
print FILE "adr_bonus" . Dumper($adr_bonus) . "\n";
|
||||
print FILE "adr_bonus preview which will be set if matches\n" . Dumper($adr_bonus) . "\n";
|
||||
$ret = $pl->set_usertarif($dbh,$operator_conf->{database}->{dbname},$adr_bonus);
|
||||
}
|
||||
}else{
|
||||
|
@ -373,7 +380,8 @@ sub save_account(){
|
|||
$lastnum = $1 if($valxx =~ /(\d{9})$/);
|
||||
my $phone_check = &check_account("","txt07","~",$lastnum,"c_id","!=",$c_id);
|
||||
if($phone_check->{c_id} && $phone_check->{c_id} != $c_id){
|
||||
$ret_conflict = "failure::conflict_$_=$valxx#top";
|
||||
my $encoded_val = $uri_encode->encode($valxx);
|
||||
$ret_conflict = "failure::conflict_$_=$encoded_val#top";
|
||||
}
|
||||
#smsAck reset
|
||||
if($valxx ne $ctadr->{txt07}){
|
||||
|
@ -394,7 +402,8 @@ sub save_account(){
|
|||
my $account_check = &check_account("","txt08","ilike",$valxx,"c_id","!=",$c_id);
|
||||
print FILE "$account_check->{c_id} && $account_check->{c_id} != $c_id\n" if($debug);
|
||||
if($account_check->{c_id} && $account_check->{c_id} != $c_id){
|
||||
$ret_conflict = "failure::conflict_$_=$valxx#top";
|
||||
my $encoded_val = $uri_encode->encode($valxx);
|
||||
$ret_conflict = "failure::conflict_$_=$encoded_val#top";
|
||||
}
|
||||
#mailAck reset
|
||||
if($valxx ne $ctadr->{txt08}){
|
||||
|
|
|
@ -467,7 +467,7 @@ sub tpl(){
|
|||
}
|
||||
#
|
||||
my $v_journalparts = $v_journal . "_parts";
|
||||
$ct4rel_parts = $db->search_content3($searchref,$table,$dbt->{shareedms_conf}->{parent_id},$node_meta->{node_name},$users_dms->{u_id},$lang,"$main_ids","$tplids","$ct_ids",$v_journalparts,$time,$R::s_kontext,$scol,$users_dms->{sort_updown},$offset,$limit,$export,$R::todo,$ck4ex,$opos);
|
||||
$ct4rel_parts = $db->search_content3($searchref,$table,$dbt->{shareedms_conf}->{parent_id},$node_meta,$users_dms->{u_id},$lang,"$main_ids","$tplids","$ct_ids",$v_journalparts,$time,$R::s_kontext,$scol,$users_dms->{sort_updown},$offset,$limit,$export,$R::todo,$ck4ex,$opos);
|
||||
|
||||
#collect invoice ids in kontext of parts
|
||||
foreach my $cp_id (keys (%$ct4rel_parts)){
|
||||
|
@ -479,7 +479,7 @@ sub tpl(){
|
|||
}
|
||||
}
|
||||
|
||||
$ct4rel = $db->search_content3($searchref,$table,$dbt->{shareedms_conf}->{parent_id},$node_meta->{node_name},$users_dms->{owner},$lang,"$main_ids","$tplids","$ct_ids",$v_journal,$time,$R::s_kontext,$scol,$users_dms->{sort_updown},$offset,$limit,$export,$R::todo,$ck4ex,$opos);
|
||||
$ct4rel = $db->search_content3($searchref,$table,$dbt->{shareedms_conf}->{parent_id},$node_meta,$users_dms->{u_id},$lang,"$main_ids","$tplids","$ct_ids",$v_journal,$time,$R::s_kontext,$scol,$users_dms->{sort_updown},$offset,$limit,$export,$R::todo,$ck4ex,$opos);
|
||||
}#end $ct4rel collect
|
||||
}else{
|
||||
$return = "failure::Abbruch. Keine Zugriffsberechtigung";
|
||||
|
|
|
@ -215,7 +215,7 @@ EOF
|
|||
my $ck4ex = "";
|
||||
#only if permission read
|
||||
if(($node_meta->{ct_table} eq "users" && $users_dms->{int07} >= 1) || ($node_meta->{ct_table} eq "contentadrpos" && $users_dms->{int02} >= 1) || ($node_meta->{ct_table} eq "contentpos" && $users_dms->{int01} >= 1)){
|
||||
$ct4rel = $db->search_content3($searchref,$table,$node_mandant->{parent_id},"",$users_dms->{u_id},$lang,"$main_ids","$tpl_ids","","",$time,"",$scol,$users_dms->{sort_updown},$offset,$limit,$export,$todo,$ck4ex,"");
|
||||
$ct4rel = $db->search_content3($searchref,$table,$node_mandant->{parent_id},$node_meta,$users_dms->{u_id},$lang,"$main_ids","$tpl_ids","","",$time,"",$scol,$users_dms->{sort_updown},$offset,$limit,$export,$todo,$ck4ex,"");
|
||||
}else{
|
||||
$return = "failure::Abbruch. Keine Zugriffsberechtigung";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue