diff --git a/copri4/main/src/Mod/GBFSout.pm b/copri4/main/src/Mod/GBFSout.pm index 26dd7d8..7c5a624 100755 --- a/copri4/main/src/Mod/GBFSout.pm +++ b/copri4/main/src/Mod/GBFSout.pm @@ -100,7 +100,7 @@ sub station_information { $gbfs_station{$station}{capacity} = $response_stations->{shareejson}->{stations}->{$station}->{capacity}; $gbfs_station{$station}{lat} = $response_stations->{shareejson}->{stations}->{$station}->{gps}->{latitude}; $gbfs_station{$station}{lon} = $response_stations->{shareejson}->{stations}->{$station}->{gps}->{longitude}; - $gbfs_station{$station}{is_charging_station} = 1 if(grep(/300102/, @{$response_stations->{shareejson}->{stations}->{$station}->{station_group}}));#E-L + #$gbfs_station{$station}{is_charging_station} = 1 if(grep(/300102/, @{$response_stations->{shareejson}->{stations}->{$station}->{station_group}}));#E-L push (@gbfs_stations, $gbfs_station{$station}); } diff --git a/copri4/main/src/Mod/Indexsharee.pm b/copri4/main/src/Mod/Indexsharee.pm index 8ec43e2..dfd1a34 100755 --- a/copri4/main/src/Mod/Indexsharee.pm +++ b/copri4/main/src/Mod/Indexsharee.pm @@ -309,13 +309,17 @@ sub handler { #DMS Kunden rw if($R::base_edit && $node_meta->{ct_table} eq "contentadr"){ $bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::c_id with: $R::base_edit","",""); + my $dbh_primary = $dbt->dbconnect_extern("sharee_primary"); + my $users_dms_primary = { u_id => 0 }; + $users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int02 >= 1"); + if($R::c_id && $R::base_edit eq "remove_chk4rel"){ my $delete_key = "delete_content"; $delete_key = "delete_adr"; $return = "failure::Datensatz wirklich löschen. ::?base_edit=$delete_key\&exit_box2=1\&c_id=$R::c_id ::löschen"; - }elsif($users_dms->{int02} == 2 && $R::c_id && $R::base_edit eq "save_adr"){ + }elsif($users_dms_primary->{int02} == 2 && $R::c_id && $R::base_edit eq "save_adr"){ ($returnwww,$return) = $tk->save_account($R::c_id,\%varenv,$users_dms->{u_id}); - }elsif($users_dms->{int02} == 2 && $R::c_id && $R::base_edit eq "delete_adr"){ + }elsif($users_dms_primary->{int02} == 2 && $R::c_id && $R::base_edit eq "delete_adr"){ $return = $tk->delete_account($R::c_id,$users_dms->{u_id}); }else{ $return = "failure::Abbruch. Schreibender Zugriff \"Kunden Stammdaten\" verweigert."; @@ -342,14 +346,14 @@ sub handler { $bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::main_id with: $R::rel_edit","",""); if(($node_meta->{ct_table} eq "content" && $users_dms->{int01} == 2) || ($node_meta->{ct_table} eq "contentuser" && $users_dms->{int08} == 2)){ if($R::rel_edit eq "save_relation" && $R::main_id && $R::main_id >= 200000){ - $return = $pl->save_relation($R::main_id,$users_dms->{u_id}); + $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}); }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}); }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($R::c_id,$users_dms); + $return = $pl->save_service_desc($q,$R::c_id,$users_dms); }elsif($R::rel_edit && $R::main_id && $R::main_id >= 200000){ $return = $pm->maininit($users_dms); } @@ -361,9 +365,13 @@ sub handler { #DMS Faktura if($node_meta->{ct_table} eq "contenttrans"){ $bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::c_id4trans,$R::tpl_id4trans with: $R::ct_trans","",""); - if($users_dms->{int03} == 1 && $R::ct_trans eq "open"){#DMS Faktura read + my $dbh_primary = $dbt->dbconnect_extern("sharee_primary"); + my $users_dms_primary = { u_id => 0 }; + $users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int02 >= 1"); + + if($users_dms_primary->{int03} == 1 && $R::ct_trans eq "open"){#DMS Faktura read $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)); - }elsif($users_dms->{int03} == 2){#DMS Faktura rw + }elsif($users_dms_primary->{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)); diff --git a/copri4/main/src/Mod/NodeEdit.pm b/copri4/main/src/Mod/NodeEdit.pm index ffff0b6..74208c2 100755 --- a/copri4/main/src/Mod/NodeEdit.pm +++ b/copri4/main/src/Mod/NodeEdit.pm @@ -189,7 +189,7 @@ sub admin_tpl(){ print $q->end_table; my $debug; - $debug = "(ct_table: $node_meta->{ct_table} | main_id: $node_meta->{main_id} | tpl_id: $node_meta->{template_id} " if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id}); + $debug = "(ct_table: $node_meta->{ct_table} | main_id: $node_meta->{main_id} | tpl_id: $node_meta->{template_id} | type_id: $node_meta->{type_id} | energy_id: $node_meta->{energy_id}" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id}); print $q->div({-style=>'position:absolute;bottom:2%;right:2%;z-index:10;font-size:13px;'},"$debug"),"\n"; print ""; } diff --git a/copri4/main/src/Mod/Prelib.pm b/copri4/main/src/Mod/Prelib.pm index 7b4e2a5..b719b14 100755 --- a/copri4/main/src/Mod/Prelib.pm +++ b/copri4/main/src/Mod/Prelib.pm @@ -414,6 +414,7 @@ sub new_relation { #save node relation sub save_relation { my $self = shift; + my $q = shift; my $main_id = shift; my $owner = shift; my %varenv = $cf->envonline(); @@ -580,7 +581,7 @@ sub set_usertarif { my $bonus_collect = shift || {}; open(FILE,">>$varenv{logdir}/save_account.log") if($debug); - print FILE "\n*Prelib--> $now_dt| c_id: $adr_bonus->{c_id} \n" if($debug); + print FILE "\n*Prelib--> $now_dt| dbname: $dbname | c_id: $adr_bonus->{c_id} | txt15: $adr_bonus->{txt15}\n" if($debug); my $ret = $adr_bonus->{ret}; my $i = 0; @@ -596,10 +597,10 @@ sub set_usertarif { fetch => "all", template_id => "228", int03 => ">::0", - ct_name => $adr_bonus->{txt15}, + ct_name => "ilike::$adr_bonus->{txt15}", }; $bonus_collect = $dbt->fetch_record($dbh_operator,$pref_cc) if(ref($bonus_collect->{1}) ne "HASH"); - #print FILE "Prelib bonus_collect:\n" . Dumper($bonus_collect) . "\n"; + print FILE "Prelib bonus_collect:\n" . Dumper($bonus_collect) . "\n"; foreach my $id (keys (%$bonus_collect)){ print FILE "-1-> loop bonus_collect and find $bonus_collect->{$id}->{ct_name} = $adr_bonus->{txt15}\n|==>Take and insert Tarif $bonus_collect->{$id}->{int22}\n" if($debug); $tarif_hash{$bonus_collect->{$id}->{int22}} = 1; @@ -660,6 +661,7 @@ sub set_usertarif { #save service-config sub save_service_desc { my $self = shift; + my $q = shift; my $c_id = shift; my $users_dms = shift; my @keywords = $q->param; diff --git a/copri4/main/src/Mod/Shareework.pm b/copri4/main/src/Mod/Shareework.pm index 4505fe6..412d311 100755 --- a/copri4/main/src/Mod/Shareework.pm +++ b/copri4/main/src/Mod/Shareework.pm @@ -271,7 +271,7 @@ sub save_account(){ print FILE "Prepare SWK Bonusnr by prefix $valxx" . "\n" if($debug); } #Freischaltcode format can be "CA-Li-hsze789k" or "CA1234567" - if($valxx && ($valxx =~ /^(\w{2,3})-([\w\-]+)/i || $valxx =~ /^(\w{2,3})(\d+)/)){ + if($valxx && ($valxx =~ /^(\w{2,3})-([\w\-]+)/i || $valxx =~ /^(\w{2,3})(\d+)/i)){ $valxx =~ s/\s//g; my $bonus_prefix = uc($1), my $bonusnr = $2; diff --git a/copri4/main/src/Tpl/Liste3.pm b/copri4/main/src/Tpl/Liste3.pm index 135ea8f..eb5a51e 100755 --- a/copri4/main/src/Tpl/Liste3.pm +++ b/copri4/main/src/Tpl/Liste3.pm @@ -405,9 +405,14 @@ sub tpl(){ my $bike_nodes = $dbt->fetch_rel4tpl4nd($dbh,$node); my $tariff_all = $db->collect_ct4rel("content","300026",$lang,"","","","","210"); + my $dbh_primary = $dbt->dbconnect_extern("sharee_primary"); + my $users_dms_primary = { u_id => 0 }; + $users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int02 >= 1"); + my $ctrel = {}; #only if permission read - if(($node_meta->{ct_table} eq "content" && $users_dms->{int01} >= 1) || ($node_meta->{ct_table} eq "contentadr" && $users_dms->{int02} >= 1) || ($node_meta->{ct_table} eq "contenttrans" && $users_dms->{int03} >= 1)){ + if(($node_meta->{ct_table} eq "content" && $users_dms->{int01} >= 1) || ($node_meta->{ct_table} eq "contentadr" && $users_dms_primary->{int02} >= 1) || ($node_meta->{ct_table} eq "contenttrans" && $users_dms_primary->{int03} >= 1)){ + my $c_id4trans = $R::c_id4trans || ""; #Take only c_id from users if @@ -419,7 +424,7 @@ sub tpl(){ #$ctrel = $db->get_ctrel("contenttrans","",$lang,"",$users_dms->{c_id4trans},$users_dms->{tpl_id4trans}); #without limit it will takes only one dataset - #if(($R::rel_id && $R::rel_id =~ /^\d+$/) || ($c_id4trans && $c_id4trans =~ /^\d+$/)){ + #if(($R::rel_id && $R::rel_id =~ /^\d+$/) || ($c_id4trans && $c_id4trans =~ /^\d+$/)) if((($R::rel_id && $R::rel_id =~ /^\d+$/) || ($c_id4trans && $c_id4trans =~ /^\d+$/)) && ($limit > $varenv{limit})){ $ct4rel = $db->collect_cid($table,$lang,$tpl_id,$R::rel_id,$R::barcode,"c_id",$c_id4trans); } diff --git a/copri4/main/src/Tpl/SubListe.pm b/copri4/main/src/Tpl/SubListe.pm index 44d434a..2799dc3 100755 --- a/copri4/main/src/Tpl/SubListe.pm +++ b/copri4/main/src/Tpl/SubListe.pm @@ -142,6 +142,8 @@ sub tpl(){ $table = "contentadr"; $searchref->{table_pos} = "contentadrpos"; $searchref->{template_id_pos} = "$node_meta->{tpl_id}"; + $main_ids = $node_meta->{main_id}; + $tpl_ids = $node_meta->{tpl_id}; } elsif($node_meta->{tpl_id} == 198){ $table = "contentadr"; diff --git a/copri4/shareeapp-operator/src/Lib/Mlogic.pm b/copri4/shareeapp-operator/src/Lib/Mlogic.pm index 1cdf6db..d9dea64 100755 --- a/copri4/shareeapp-operator/src/Lib/Mlogic.pm +++ b/copri4/shareeapp-operator/src/Lib/Mlogic.pm @@ -42,8 +42,8 @@ sub tpl(){ if($users_sharee->{c_id} && $R::sharee_edit ne "delete_account2" && ($users_sharee->{c_id} eq $varenv->{superu_id} || $dbt->{copri_conf}->{stage} eq "test" || $users_sharee->{txt08} eq "sigo\@sharee.bike")){ my $coo = $q->cookie('domcookie') || $q->param('sessionid') || ""; - #my $api_test = "sharee_fr01"; my $bike="FR1538"; - my $api_test = "sharee_fr01"; my $bike="FR1005";#E-Lastenrad (bike_group=300101, bike_node=300102) + my $api_test = "sharee_fr01"; my $bike="FR1538"; + #my $api_test = "sharee_fr01"; my $bike="FR1005";#E-Lastenrad (bike_group=300101, bike_node=300102) #my $api_test = "sharee_fr01"; my $bike="FR4781";#Tracking and BVB test #my $api_test = "sharee_kn"; my $bike="KN205"; #my $api_test = "sharee_wue"; my $bike="WUE5525"; diff --git a/copri4/shareedms-operator/src/Lib/Mlogic.pm b/copri4/shareedms-operator/src/Lib/Mlogic.pm index 083e43a..b1936eb 100755 --- a/copri4/shareedms-operator/src/Lib/Mlogic.pm +++ b/copri4/shareedms-operator/src/Lib/Mlogic.pm @@ -144,11 +144,15 @@ sub tpl(){ my $dbh_primary = $dbt->dbconnect_extern("sharee_primary"); my $users_dms_primary = { u_id => 0 }; - $users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int02=2"); + $users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int02 >= 1"); #print Dumper($users_dms_primary); my $mod_active = "$dbt->{shareedms_conf}->{mod_active}"; - $mod_active .= "|Kunden|Faktura" if($users_dms_primary->{u_id} && $users_dms_primary->{int02} == 2); + if($users_dms_primary->{u_id} && $users_dms_primary->{int02} >= 1){ + $mod_active .= "|Kunden|Faktura"; + }else{ + $mod_active .= "|App-feedback"; + } ###Top Menu #bootstrap menue @@ -183,6 +187,7 @@ sub tpl(){ #0. menue my $aclass = "dropdown-item"; $aclass = "nav-link" if($node->{$id}->{node_name} =~ /Mietjourna|Alarmjournal|Karte/); + $aclass = "nav-link" if($node->{$id}->{node_name} =~ /Mietjourna|Alarmjournal|Karte|App-feedback/ && $mod_active !~ /Kunden/); if($users_dms->{u_id} && ($users_dms->{int01} == 2 && $node_meta->{ct_table} =~ /content$/) || ($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id})){ my $url = "$topath/maintainer?node2edit=edit_relation\&main_id=$node->{$id}->{main_id}"; $lmenu0 = $but->event_button("$topath","$node->{$id}->{node_name}","$node->{$id}->{main_id}","$aclass $mclass","","$users_dms->{u_id}","$url");