diff --git a/copri4/main/src/Mod/APIfunc.pm b/copri4/main/src/Mod/APIfunc.pm index 65b6a54..f1bc1c0 100755 --- a/copri4/main/src/Mod/APIfunc.pm +++ b/copri4/main/src/Mod/APIfunc.pm @@ -876,15 +876,12 @@ sub booking_request(){ my $sig_book = shift || {}; my $dbh = ""; - my $bike_id = ""; - $bike_id = $1 if($bike_id =~ /(\d+)$/); - my $pos_id=""; my $now_dt = strftime "%Y-%m-%d %H:%M", localtime; my $response_state = "OK"; my $response_text = ""; - $bw->log("booking_request ct_bike $ct_bike->{barcode}, auth $auth->{c_id}, tarif $ct_tariff->{barcode}, requested bike:",$bike,""); + $bw->log("booking_request bike $bike, auth $auth->{c_id}, tarif $ct_tariff->{barcode}, requested bike:",$bike,""); my $update_adr = { table => "contentadr", @@ -904,14 +901,6 @@ sub booking_request(){ close_time => "is::null", }; - my $booking_pos = { - table => "contenttranspos", - fetch => "one", - barcode => "$bike_id", - int10 => "IN::('2','3')", - ca_id => "$auth->{c_id}", - }; - #if bike and tariff if($ct_bike->{barcode} && $ct_tariff->{barcode}){ @@ -1020,6 +1009,7 @@ sub booking_update(){ $bike_id =~ s/S[1-9]X/SX/; $bike_id = $1 if($bike_id =~ /(\d+)/); + my $state_key = 0; my $state_text = ""; while (my ($key, $value) = each %{ $dbt->{copri_conf}->{bike_state} }) { @@ -1064,6 +1054,7 @@ sub booking_update(){ my $record_cc = $dbt->fetch_record($dbh,$pref_cc) if($q->param('bike')); + $bw->log("booking_update bike to state $bike $state ($state_key) $lock_state, auth $auth->{c_id}, bike:",$bike,""); my $update_cc = { table => "content", @@ -1108,7 +1099,8 @@ sub booking_update(){ #2020-09-24 requested will be all done by net_booking #6 = "canceled"|3 = "occupied"|1 = "available" - if($state && $state =~ /$dbt->{copri_conf}->{bike_state}->{6}|$dbt->{copri_conf}->{bike_state}->{3}|$dbt->{copri_conf}->{bike_state}->{1}/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){ + #if($state && $state =~ /$dbt->{copri_conf}->{bike_state}->{6}|$dbt->{copri_conf}->{bike_state}->{3}|$dbt->{copri_conf}->{bike_state}->{1}/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){ + if($state_key && ($state_key == 6 || $state_key == 3 || $state_key == 1) && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){ #set rent state if lock_system 2=Ilockit || 3=sigo if($record_pos->{int11} && ($record_pos->{int11} == 2 || $record_pos->{int11} == 3)){ diff --git a/copri4/main/src/Mod/APIxmlserver.pm b/copri4/main/src/Mod/APIxmlserver.pm index 930f5f1..ccabd87 100755 --- a/copri4/main/src/Mod/APIxmlserver.pm +++ b/copri4/main/src/Mod/APIxmlserver.pm @@ -65,6 +65,12 @@ sub handler { $bw->log("APIxmlserver request:\n--> user-agent '$user_agent'",$q,""); print $q->header(-type => "application/xml", -charset => "utf-8", -'Access-Control-Allow-Origin' => "*"); + + open(FILE,">>$varenv{logdir}/APIxmlserver.log") if($debug); + print FILE "\n*** $now_dt user-agent: '$user_agent' to syshost: $varenv{syshost}\n" if($debug); + print FILE "<=== q dump\n " . Dumper($q) . "\n" if($debug); + print FILE "<=== DUMP postdata:\n " . Dumper($q->param('POSTDATA')) . "\n" if($debug); + #print "Content-type: text/xml\n\n"; if($q->param('POSTDATA')){ my $xmlref = {}; @@ -111,6 +117,8 @@ sub handler { my $c_id = ""; $bw->log("$xmlref->{todo}",$xmlref,""); + print FILE "xmlref\n " . Dumper($xmlref) . "\n" if($debug); + if($xmlref->{userID} && $xmlref->{emailID} && $xmlref->{pwID}){ if($xmlref->{todo} =~ /add_LVuser|update_LVuser/ && !$record->{c_id} && !$record_e->{c_id}){ @@ -152,7 +160,7 @@ sub handler { table => "contentadr", mtime => 'now()', owner => "$owner", - int01 => "$xmlref->{userID}" + int01 => $q->escapeHTML($xmlref->{userID}), }; my $rows = $dbt->update_record($dbh,$update,$record); @@ -208,6 +216,7 @@ sub handler { }; $bw->log("APIxmlserver update to available",$update_cc,""); + print FILE "update_cc\n " . Dumper($update_cc) . "\n" if($debug); $dbt->update_record($dbh,$update_cc,$record_cc) if($record_cc->{c_id}); }elsif(ref($xmlref) eq "HASH" && $xmlref->{todo} && $xmlref->{todo} eq "requested" && $xmlref->{bikeID} =~ /\d+/){ @@ -229,6 +238,7 @@ sub handler { print "NO DATA"; } + close(FILE) if($debug); return Apache2::Const::OK; } 1; diff --git a/copri4/main/src/Mod/Buttons.pm b/copri4/main/src/Mod/Buttons.pm index fa11f29..0246782 100755 --- a/copri4/main/src/Mod/Buttons.pm +++ b/copri4/main/src/Mod/Buttons.pm @@ -43,7 +43,7 @@ sub ibuttons(){ 'new_relation' => 'NEUES Menue anlegen', 'new_relation4sub' => 'NEUES Sub-Menue anlegen', 'save_content' => 'Speichern', - 'save_tver' => 'Kurs speichern', + 'save_ctuser' => 'Save', 'save_nel' => 'Nachricht speichern', 'context_copy_content' => 'Kopie im Kontext der internen Barcode Nummer', 'copy_content' => 'Kopie fuer neuen Datensatz', diff --git a/copri4/main/src/Mod/DBtank.pm b/copri4/main/src/Mod/DBtank.pm index c09660d..56fe191 100755 --- a/copri4/main/src/Mod/DBtank.pm +++ b/copri4/main/src/Mod/DBtank.pm @@ -1007,8 +1007,6 @@ sub insert_contentoid { $values .= "'$insert->{$key}',"; } } - #elsif($key =~ /contentadr_id|cc_id|ct_id|barcode|txt|int|time|owner/){ - #2021-03-04 changed with c_id, ct_name and only insert if value elsif($key =~ /^c_id|ct_name|barcode|txt|int|time|owner/ && ($insert->{$key} || looks_like_number($insert->{$key}))){ $columns .= "$key,"; if($key =~ /_id|barcode|int|owner/ && !looks_like_number($insert->{$key})){ @@ -1035,12 +1033,12 @@ sub insert_contentoid { my $c_id = $sth->fetchrow_array(); $bw->log("insert_contentoid $source c_id: $c_id",$sql,"") if($debug); - if($insert->{table} =~ /content$|contentadr|contenttrans$|contenttver$|contentusers$/ && $insert->{main_id} && $insert->{template_id}){ + if($insert->{table} =~ /content$|contentadr|contenttrans$|contenttver$|contentuser$/ && $insert->{main_id} && $insert->{template_id}){ my $foreignkey = ""; $foreignkey = "ca_id" if($insert->{table} eq "contentadr"); $foreignkey = "cc_id" if($insert->{table} eq "content"); $foreignkey = "ct_id" if($insert->{table} eq "contenttrans"); - $foreignkey = "cu_id" if($insert->{table} eq "contentusers"); + $foreignkey = "cu_id" if($insert->{table} eq "contentuser"); $foreignkey = "cv_id" if($insert->{table} eq "contenttver"); 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); diff --git a/copri4/main/src/Mod/Indexsharee.pm b/copri4/main/src/Mod/Indexsharee.pm index d04a9bd..8f11103 100755 --- a/copri4/main/src/Mod/Indexsharee.pm +++ b/copri4/main/src/Mod/Indexsharee.pm @@ -88,7 +88,7 @@ sub handler { }elsif($netloc =~ /lastenradbayern\.net/){ $varenv{syshost} = "shareeweb-bayern"; } - die "no configuration available" if(!$varenv{syshost}); + exit 0 if(!$varenv{syshost}); if($varenv{orga} ne "dms" && $path =~ /DMS|Waren|Kunden\/|Einstellung|journal|Faktur/i){ @@ -352,6 +352,9 @@ sub handler { $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::TODO Service-Config save"; + #$return = $pl->save_ctuser($users_dms); }elsif($R::rel_edit && $R::main_id && $R::main_id >= 200000){ $return = $pm->maininit($users_dms); } @@ -738,12 +741,17 @@ sub handler { });"; } + my $favicon = "css/favicon.ico"; my $base_uri = "true"; my $title = ""; $title = $dbt->{primary}->{$varenv{dbname}}->{title} if($dbt->{primary}->{$varenv{dbname}}->{title}); $title = $dbt->{operator}->{$varenv{dbname}}->{title} if($dbt->{operator}->{$varenv{dbname}}->{title}); - $title = $dbt->{website}->{$varenv{syshost}}->{title} if($dbt->{website}->{$varenv{syshost}}->{title}); + if($dbt->{website}->{$varenv{syshost}}->{title}){ + $title = $dbt->{website}->{$varenv{syshost}}->{title}; + $favicon = "data/favicon.ico"; + } $title .= " devel" if($dbt->{copri_conf}->{stage} eq "test"); + my $html5 = $q->start_html(-title=>"$title", -lang=>'de', -onload=>"$onload", @@ -755,7 +763,7 @@ sub handler { Link({ -rel=>'shortcut icon', -type=>'image/x-icon', - -href=>"$varenv{metahost}/css/favicon.ico" + -href=>"$varenv{metahost}/$favicon" }) ], -meta=>{ diff --git a/copri4/main/src/Mod/KMLout.pm b/copri4/main/src/Mod/KMLout.pm index 21bddf0..d879c35 100755 --- a/copri4/main/src/Mod/KMLout.pm +++ b/copri4/main/src/Mod/KMLout.pm @@ -32,20 +32,34 @@ my $bw = new Basework; sub handler { my $r = shift; my $q = new CGI; + $q->import_names('R'); + my $dbt = new DBtank; my $apif = new APIfunc; my $cf = new Config; my %varenv = $cf->envonline(); - my $coo = $q->cookie('domcookie') || $q->param('sessionid') || ""; + my $coo = $q->cookie('domcookie') || $R::sessionid || ""; my $users_sharee = { c_id => 0 }; my $api_return = { authcookie => '' }; ($api_return,$users_sharee) = $apif->auth_verify($q,$coo,""); + if($dbt->{website}->{$varenv{syshost}}->{merchant_id}){ + $api_return->{authcookie} = $dbt->{website}->{$varenv{syshost}}->{merchant_id} if(!$api_return->{authcookie}); + }elsif($dbt->{operator}->{$varenv{dbname}}->{merchant_id}){ + $api_return->{authcookie} = $dbt->{operator}->{$varenv{dbname}}->{merchant_id} if(!$api_return->{authcookie}); + }elsif($dbt->{primary}->{$varenv{dbname}}->{merchant_id}){ + $api_return->{authcookie} = $dbt->{primary}->{$varenv{dbname}}->{merchant_id} if(!$api_return->{authcookie}); + } + $users_sharee->{c_id} = "0" if(!$users_sharee->{c_id}); + + $bw->log("kmlGenerator handler with api_return: ",$api_return,""); + my $kmlfile = kmlGenerator($api_return,\%varenv,$users_sharee); - #print out test with kml file - if(1==2){ + #print $q->header(); + #print out kml file, used by Karte.pm js maps + if(1==1){ print $q->header(-type => "application/vnd.google-earth.kml+xml", -charset=>"utf-8"); if (open(my $fh, '<', "$varenv{basedir}/xml/$kmlfile")) { @@ -68,12 +82,9 @@ sub kmlGenerator { my $dbt = new DBtank; my $json = JSON->new->allow_nonref; my $cf = new Config; - #my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; my $lang="de"; my $dbh = ""; - #my $netloc = $q->url(-base=>1); - #print "kmlGenerator accessed by netlocation: " . $netloc; my $project = "all"; $project = $dbt->{website}->{$varenv->{syshost}}->{project} if($dbt->{website}->{$varenv->{syshost}}->{project}); $project = $dbt->{operator}->{$varenv->{dbname}}->{project} if($dbt->{operator}->{$varenv->{dbname}}->{project}); diff --git a/copri4/main/src/Mod/Prelib.pm b/copri4/main/src/Mod/Prelib.pm index 58f7bb3..14afa60 100755 --- a/copri4/main/src/Mod/Prelib.pm +++ b/copri4/main/src/Mod/Prelib.pm @@ -205,7 +205,7 @@ sub new_relation { my $new_submain_id = $dbt->get_freenode($dbh,$prefix_id); my $new_subtemplate_id = $dbt->get_freetpl($dbh,"401","499"); - my $ret_tpl_id = $dbt->copy_template($dbh,"401",$new_subtemplate_id,$owner); + my $ret_tpl_id = $dbt->copy_template($dbh,"400",$new_subtemplate_id,$owner); my $insert_sub = { main_id => $new_submain_id, diff --git a/copri4/main/src/Mod/Premain.pm b/copri4/main/src/Mod/Premain.pm index 48c55bb..293a74e 100755 --- a/copri4/main/src/Mod/Premain.pm +++ b/copri4/main/src/Mod/Premain.pm @@ -424,7 +424,7 @@ print ATTR "next: $next\n" if($debug); #if($ib_key =~ /save/ && $R::c_id && $R::rel_id){ my $c_id = $R::c_id || $c_idnew;#also over new my $rel_id = $R::rel_id || $rel_idnew;#also over new - if(($ib_key =~ /save_content|save_user|save_adr|save_nel|newsletter_mailman/) || ($ib_key =~ /new_content/ && $R::search_pattern) && $c_id){ + if(($ib_key =~ /save_content|save_ctuser|save_adr/) || ($ib_key =~ /new_content/ && $R::search_pattern) && $c_id){ if($ib_key eq "save_user"){ $table = "contentuser"; diff --git a/copri4/main/src/Tpl/BaseEdit.pm b/copri4/main/src/Tpl/BaseEdit.pm index e25673b..833ab78 100755 --- a/copri4/main/src/Tpl/BaseEdit.pm +++ b/copri4/main/src/Tpl/BaseEdit.pm @@ -51,6 +51,7 @@ sub tpl(){ #print $dbt->{operator}->{$varenv{dbname}}->{oprefix}; my $rel_id = $1 if($R::rel_id && $R::rel_id =~ /(\d+)/); + my $c_id = $1 if($R::c_id && $R::c_id =~ /(\d+)/); my $u_id = $1 if($R::u_id && $R::u_id =~ /(\d+)/); $u_id = $1 if($R::c_idadr && $R::c_idadr =~ /(\d+)/ && $R::base_edit eq "new_dmsusers"); my ($edit,$copy_key,$save_key,$relate_key,$move_key,$delete_key,$package_key); @@ -108,6 +109,22 @@ sub tpl(){ $save_key = "save_dmsusers"; $tpl = $db->get_tpl($node_meta->{tpl_id}); #print Dumper($node_meta->{tpl_id}) . "\n u_id:" . $u_id; + # + }elsif($node_meta->{ct_table} eq "contentuser" && $node_meta->{tpl_id} == 199){ + my $ref = { + table => "$node_meta->{ct_table}", + fetch => "one", + template_id => "$node_meta->{tpl_id}", + c_id => "$c_id", + }; + $ctrel = $dbt->fetch_record($dbh,$ref); + print $q->hidden(-name=>'c_id',-override=>'1', -value=>"$ctrel->{c_id}"); + print $q->hidden(-name=>'rel_id',-override=>'1', -value=>"$ctrel->{rel_id}"); + + $bg_color = $varenv{background_color2}; + $edit = "rel_edit"; + $save_key = "save_ctuser"; + $tpl = $db->get_tpl($node_meta->{tpl_id}); }else{ print $q->div("Es konnten keine Daten gefunden werden"),"\n"; return "failure::Error, no table selected"; @@ -192,7 +209,7 @@ sub tpl(){ my $cttrans = $db->collect_ct4rel4nd("contenttrans","","$lang","","","","ct.int10","$ctrel->{c_id}","209,218","","rel_id",""); foreach my $id (sort { $cttrans->{$b}->{c_id} <=> $cttrans->{$a}->{c_id} } keys (%$cttrans)){ my $toppx = $top . "px"; - print $q->div({-style=>"position:absolute;top:$toppx;right:20px;"}, " TXID $cttrans->{$id}->{txt16} ",$q->span({-style=>"background-color:$varenv{term_active_color}"},$q->a({-class=>"linknav",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Faktura/$cttrans->{$id}->{node_name}?ct_trans=open\&c_id4trans=$cttrans->{$id}->{c_id}\&tpl_id4trans=$cttrans->{$id}->{template_id}\&kind_of_trans=$users_dms->{kind_of_trans}&owner=$users_dms->{u_id}",-title=>"Faktura Terminal öffnen"},"[ $cttrans->{$id}->{node_name} #$cttrans->{$id}->{ct_name} ]"))),"\n"; + print $q->div({-style=>"position:absolute;top:$toppx;right:20px;"}, " TXID $cttrans->{$id}->{txt16} ",$q->span({-style=>"background-color:#f7ae37"},$q->a({-class=>"linknav",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Faktura/$cttrans->{$id}->{node_name}?ct_trans=open\&c_id4trans=$cttrans->{$id}->{c_id}\&tpl_id4trans=$cttrans->{$id}->{template_id}\&kind_of_trans=$users_dms->{kind_of_trans}&owner=$users_dms->{u_id}",-title=>"Faktura Terminal öffnen"},"[ $cttrans->{$id}->{node_name} #$cttrans->{$id}->{ct_name} ]"))),"\n"; $top += 22; } }elsif($node_meta->{tpl_id} == 205){ @@ -201,7 +218,7 @@ sub tpl(){ my $year = strftime "%Y", localtime; my ($nyear,$nmonth,$nday) = Add_Delta_YMD($year,$month,$day, 0,0,-28); my $toppx = $top . "px"; - print $q->div({-style=>"position:absolute;top:$toppx;right:20px;"}, $q->span({-style=>"background-color:$varenv{calendar_active_color}"},$q->a({-class=>"linknav",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Mietjournal/?detail_search=1&barcode=$ctrel->{barcode}&start_date_time=$nday.$nmonth.$nyear",-title=>"Mietjournal der letzten 4 Wochen"},"[ Mietjournal zu Rad $dbt->{operator}->{$varenv{dbname}}->{oprefix}$ctrel->{barcode} ]"))),"\n"; + print $q->div({-style=>"position:absolute;top:$toppx;right:20px;"}, $q->span({-style=>"background-color:#86cbd7"},$q->a({-class=>"linknav",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Mietjournal/?detail_search=1&barcode=$ctrel->{barcode}&start_date_time=$nday.$nmonth.$nyear",-title=>"Mietjournal der letzten 4 Wochen"},"[ Mietjournal zu Rad $dbt->{operator}->{$varenv{dbname}}->{oprefix}$ctrel->{barcode} ]"))),"\n"; $top += 22; #}else{ #print $q->div({-style=>"position:absolute;top:$top;right:20px;"},"no valid users path definition: $tpath"),"\n"; diff --git a/copri4/main/src/Tpl/Karte.pm b/copri4/main/src/Tpl/Karte.pm index 181fd1d..7d9d1b4 100755 --- a/copri4/main/src/Tpl/Karte.pm +++ b/copri4/main/src/Tpl/Karte.pm @@ -27,14 +27,12 @@ sub tpl(){ my $return = shift || ""; my $q = new CGI; - my $cf = new Config; my $dbt = new DBtank; my $apif = new APIfunc; my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg"; my $aconf = Config::General->new($api_file); my %apikeyconf = $aconf->getall; - #print $apikeyconf{googlemap}->{google_key}; my $api_return = { authcookie => '' }; my $coo = $q->cookie(-name=>'domcookie') || $R::sessionid; @@ -43,18 +41,22 @@ sub tpl(){ my $initMap = $dbt->{website}->{$varenv->{syshost}}->{initMap}; my $map_zoom = $dbt->{website}->{$varenv->{syshost}}->{map_zoom} || "10"; my $project = "all"; + my $uri_request = $dbt->{primary}->{sharee_primary}->{primaryDMS}; if($dbt->{website}->{$varenv->{syshost}}->{merchant_id}){ $api_return->{authcookie} = $dbt->{website}->{$varenv->{syshost}}->{merchant_id} if(!$api_return->{authcookie}); $project = $dbt->{website}->{$varenv->{syshost}}->{project} if($dbt->{website}->{$varenv->{syshost}}->{project}); + $uri_request = $dbt->{website}->{$varenv->{syshost}}->{operatorWeb}; }elsif($dbt->{operator}->{$varenv->{dbname}}->{merchant_id}){ $api_return->{authcookie} = $dbt->{operator}->{$varenv->{dbname}}->{merchant_id} if(!$api_return->{authcookie}); $initMap = $dbt->{operator}->{$varenv->{dbname}}->{initMap} if($dbt->{operator}->{$varenv->{dbname}}->{initMap}); $map_zoom = $dbt->{operator}->{$varenv->{dbname}}->{map_zoom} if($dbt->{operator}->{$varenv->{dbname}}->{map_zoom}); $project = $dbt->{operator}->{$varenv->{dbname}}->{project} if($dbt->{operator}->{$varenv->{dbname}}->{project}); + $uri_request = $dbt->{operator}->{$varenv->{dbname}}->{operatorDMS}; }elsif($dbt->{primary}->{$varenv->{dbname}}->{merchant_id}){ $api_return->{authcookie} = $dbt->{primary}->{$varenv->{dbname}}->{merchant_id} if(!$api_return->{authcookie}); $initMap = $dbt->{primary}->{$varenv->{dbname}}->{initMap} if($dbt->{primary}->{$varenv->{dbname}}->{initMap}); + $uri_request = $dbt->{primary}->{$varenv->{dbname}}->{primaryDMS}; } my $icon_green = "Open_Green.png"; @@ -71,12 +73,17 @@ sub tpl(){ $users_sharee->{c_id} = "0" if(!$users_sharee->{c_id}); $initMap =~ s/\s//g; my ($lat,$lng) = split(/,/,$initMap); + my $kmlfile = ""; + my $filesize = 0; + my $preserve_view = "false"; require "Mod/KMLout.pm"; - my $kmlfile = Mod::KMLout::kmlGenerator($api_return,$varenv,$users_sharee); + $kmlfile = Mod::KMLout::kmlGenerator($api_return,$varenv,$users_sharee); my $filesize = -s "$varenv->{metahost}/xml/$kmlfile"; - my $preserve_view = "false"; - $preserve_view = "true" if($filesize < 200);#it's like empty without publixc stations + # + #used by empty station card like without public stations + #setting to true to keeps lat,lng and zoom + $preserve_view = "true" if($filesize < 200); print "
\n"; @@ -96,13 +103,11 @@ print<{primary}->{sharee_primary}->{primaryApp}/KMLout?kml=' + (new Date()).getTime() + '$users_sharee->{c_id}', - //url: '$varenv->{metahost}/xml/KMLout-3', - //url: '$varenv->{wwwhost}/?kml=' + (new Date()).getTime(), + //url: '$uri_request/KMLout?authcookie=$api_return->{authcookie}&dynamo=' + (new Date()).getTime(), url: '$varenv->{metahost}/xml/$kmlfile', map: map }); - console.log('$varenv->{metahost}/xml/$kmlfile'); + console.log(ctaLayer); }; @@ -119,7 +124,7 @@ print "
\n"; #print $q->div({-class=>"content2_legende", -style=>'font-weight:bold;'}, "• Ist ein Lastenrad an einer Mietradstation verfügbar?"),"\n"; print $q->div({-class=>"content2_legende"}, $q->img({-style=>'height:30px;', -src=>"$varenv->{metahost}/img/$icon_green"}), "Lastenrad verfügbar"),"\n"; print $q->div({-class=>"content2_legende"}, $q->img({-style=>'height:30px;', -src=>"$varenv->{metahost}/img/$icon_red"}), "Lastenrad nicht verfügbar"),"\n"; -print $q->div({-class=>"content2_legende"}, " "),"\n"; +#print $q->div({-class=>"content2_legende"}, " "),"\n"; print "$initMap|$varenv->{dbname}|$api_return->{authcookie}|$users_sharee->{c_id}|$kmlfile" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id}); diff --git a/copri4/main/src/Tpl/Liste3.pm b/copri4/main/src/Tpl/Liste3.pm index 55e76fe..e84d3f8 100755 --- a/copri4/main/src/Tpl/Liste3.pm +++ b/copri4/main/src/Tpl/Liste3.pm @@ -207,7 +207,7 @@ sub tpl(){ print "
\n"; my $v_journal = $R::v_journal || ""; - if($node_meta->{main_id} == $dbt->{shareeconf_dms}->{invoicejournal}){ + if($node_meta->{main_id} == $dbt->{shareedms_conf}->{invoicejournal}){ $v_journal = $node_meta->{node_name}; } diff --git a/copri4/main/src/Tpl/MandantConf.pm b/copri4/main/src/Tpl/MandantConf.pm index f5e66cc..d98644f 100755 --- a/copri4/main/src/Tpl/MandantConf.pm +++ b/copri4/main/src/Tpl/MandantConf.pm @@ -68,7 +68,7 @@ sub tpl(){ my $tpl = $db->get_tpl($rel->{template_id}); my @tpl_order = split /,/,$tpl->{tpl_order}; my $u_name = $dbt->sys_username($dbh,$ct->{owner}); - $ct->{mtime} = $lb->time4de($ct->{mtime},"1"); + $ct->{change} = $lb->time4de($ct->{mtime},"1"); print "
"; print $q->div({-class=>"copri_header",-style=>"background-color:#cccccc;"},"Pfad: $path"); @@ -91,7 +91,7 @@ sub tpl(){ print $q->a({-class=>"editnav",-href=>"$script$path?config2edit=1",-title=>'bearbeiten'}, $q->img({-src=>"$varenv{metahost}/glyphicons/glyphicons-151-edit.png"})); print "\n"; } - print $q->td({-style=>"background-color:white;padding-right:10px;border-bottom: 1px solid silver;text-align:right;font-size:12px;"}, "$u_name / $ct->{mtime}"); + print $q->td({-style=>"background-color:white;padding-right:10px;border-bottom: 1px solid silver;text-align:right;font-size:12px;"}, "$u_name / $ct->{change}"); my $i=0; foreach (@tpl_order){ diff --git a/copri4/main/src/Tpl/SubListe.pm b/copri4/main/src/Tpl/SubListe.pm index ec2eb44..ce35cd7 100755 --- a/copri4/main/src/Tpl/SubListe.pm +++ b/copri4/main/src/Tpl/SubListe.pm @@ -19,8 +19,6 @@ use Mod::Libenz; use Mod::Libenzdb; use Mod::DBtank; use Mod::APIfunc; - -use Date::Calc qw(:all); use Storable; use Data::Dumper; @@ -48,38 +46,25 @@ sub tpl(){ my $db = new Libenzdb; my $dbt = new DBtank; my $apif = new APIfunc; - my $but = new Buttons; my %varenv = $cf->envonline(); - 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"; - $script=""; - } + my $path = $q->path_info(); my $lang = "de"; my $dbh = ""; my $parent_node4rel = $db->get_node4rel($node_meta->{parent_id},"","","null"); my %ib = $but->ibuttons(); my $tpl_order = $node_meta->{tpl_order}; - if(1==2 && $node_meta->{tpl_id} >= 400 && $node_meta->{tpl_id} < 500){ + if(1==2 && $node_meta->{tpl_id} > 400 && $node_meta->{tpl_id} < 500){ $tpl_order =~ s/barcode=Rad/barcode=Rad,txt10=Station-log,txt09=Wartungsprotokoll=area/; - $tpl_order =~ s/int04=Station/int04=Station,txt09=Wartungsprotokoll=area/ if($node_meta->{tpl_id} == 403); + $tpl_order =~ s/int04=Station/int04=Station,txt09=Wartungsprotokoll=area/ if($node_meta->{tpl_id} == 499); } my @tpl_order = split /,/,$tpl_order; my $message = ""; - #$message = "Fehler: bitte Unter \"Servicetechnik\" die Datenklasse konfigurieren!" if(scalar(@tpl_order) < 1); + #$message = "Fehler: " if(scalar(@tpl_order) < 1); my $s_owner_id = ""; #my $s_u_name = ""; - my @viewsel = split /\//,$1 if($path =~ /^\/(.*)/); - my $depth = scalar(@viewsel); - my $view_base = $viewsel[1] || "nothing";#like Waren - my $node_mandant = $db->get_node("$view_base","$lang"); - #TODO, build service path by pos.template_id or pos.barcode alis bike_id #my $pref = { table => "content", # table_pos => "contentpos", @@ -122,7 +107,9 @@ sub tpl(){ $offset += $limit; } - my $date; my $start_chck=0;my $end_chck=0; + my $date = ""; + my $start_chck=0; + my $end_chck=0; my $last_year; if($R::s_start_mtime){ ($date,$start_chck) = $lb->checkdate($R::s_start_mtime) if($R::s_start_mtime !~ "%"); @@ -144,17 +131,22 @@ sub tpl(){ my $scol = "mtime"; my $table = "content"; $searchref->{table_pos} = "contentpos"; - if($node_meta->{tpl_id} > 600 && $node_meta->{tpl_id} < 700){ + if($node_meta->{tpl_id} == 199){ + $table = "contentuser"; + $searchref->{table_pos} = ""; + $searchref->{template_id_pos} = ""; + $main_ids = $node_meta->{main_id}; + $tpl_ids = $node_meta->{tpl_id}; + } + elsif($node_meta->{tpl_id} > 600 && $node_meta->{tpl_id} < 700){ $table = "contentadr"; $searchref->{table_pos} = "contentadrpos"; $searchref->{template_id_pos} = "$node_meta->{tpl_id}"; } - if($node_meta->{tpl_id} == 198){ - my $mandant_id = 100002; + elsif($node_meta->{tpl_id} == 198){ $table = "contentadr"; $searchref->{table_pos} = "users"; #$searchref->{template_id_pos} = "$node_meta->{tpl_id}"; - $main_ids = 200011; $tpl_ids = 202; print< @@ -168,7 +160,7 @@ print< \$(function() { \$('#json_selectadr').autocomplete({ - source: '/ajax_json?mandant_id=$mandant_id&table=contentadr', + source: '/ajax_json?mandant_id=$dbt->{shareedms_conf}->{parent_id}&table=contentadr', minLength: 2, select: function(event, ui) { \$('#vorname_name').val(ui.item.vorname_name); @@ -187,7 +179,9 @@ EOF #print Dumper($node_meta); my $hashfile = "$varenv{logdir}/$users_dms->{u_id}-$searchref->{table_pos}-searchhash"; my $ct4rel = {}; - if(!$start_chck && !$end_chck && $parent_node4rel ne "Servicetechnik" && $main_ids && $tpl_ids){ + #print Dumper($node_meta); + #print "if(!$start_chck && !$end_chck && $main_ids && $tpl_ids){"; + if(!$start_chck && !$end_chck && $main_ids && $tpl_ids){ #$rows = $db->count_content($searchref->{table_pos},"$main_ids","$tpl_ids"); #collect search keys @@ -214,19 +208,17 @@ EOF my $todo = ""; 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},$node_meta,$users_dms->{u_id},$lang,"$main_ids","$tpl_ids","","",$time,"",$scol,$users_dms->{sort_updown},$offset,$limit,$export,$todo,$ck4ex,""); + 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) || ($node_meta->{ct_table} eq "contentuser" && $users_dms->{int08} >= 1)){ + $ct4rel = $db->search_content3($searchref,$table,$dbt->{shareedms_conf}->{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"; } } print "
\n"; - if($varenv{syshost} ne "azn"){ - 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")); - } + 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({-style=>'background-color:silver;height:10px;'},""),"\n"; print $q->start_form(-name=>'searchform'),"\n"; @@ -240,7 +232,7 @@ EOF print $q->start_table({ -style=>'clear:both;', -border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'0', -cellspacing=>'0'}),"\n"; #new_edit and search (disabled for DMS-Account) - if($node_meta->{tpl_id} != 198){ + if($node_meta->{tpl_id} != 198 && $node_meta->{tpl_id} != 199){ my $edit="rel_edit"; my $new_key="service_done"; @@ -305,7 +297,7 @@ EOF print $q->textfield(-style=>'border:1px solid grey;height:25px;width:80%;',-id=>"json_selectadr",-name=>"json_selectadr", -placeholder=>'Neuer DMS-Account', -value=>""),"\n"; print "\n"; - }else{ + }elsif($node_meta->{tpl_id} != 199){ print $q->th({-style=>""}," "),"\n"; print $q->th({-style=>""}," "),"\n"; } @@ -353,7 +345,7 @@ EOF #Tablecontent (parameter) print $q->Tr(),"\n"; - if($node_meta->{tpl_id} != 198){ + if($node_meta->{tpl_id} != 198 && $node_meta->{tpl_id} != 199){ print $q->td({-class=>'tdtxt',-style=>"$set_style"},""),"\n"; print $q->td({-class=>'tdint',-style=>"$set_style"},""),"\n"; } @@ -386,8 +378,10 @@ EOF #$u_name = $ct_users->{$ct4rel->{$id}->{$key}}->{txt01} || $ct4rel->{$id}->{$key}; print $q->td({-class=>"$tdclass",-style=>"$tdstyle $set_style"},"$u_name"),"\n"; + }elsif($key eq "ct_name" && $node_meta->{ct_table} eq "contentuser"){ + print $q->td({-class=>"$tdclass",-style=>"$tdstyle $set_style"},$q->a({-class=>"linknav3",-href=>"?node2edit=editpart\&c_id=$ct4rel->{$id}->{c_id}",-title=>"edit"},"$ct4rel->{$id}->{$key}")),"\n"; }elsif($key eq "barcode" && $node_meta->{ct_table} eq "contentadrpos"){ - print $q->td({-class=>"$tdclass",-style=>"$tdstyle $set_style"},$q->a({-class=>"linknav3",-href=>"$varenv{wwwhost}/Waren/?detail_search=1\&s_barcode=$ct4rel->{$id}->{barcode}",-title=>"zum Rad "},"$ct4rel->{$id}->{barcode}")),"\n"; + print $q->td({-class=>"$tdclass",-style=>"$tdstyle $set_style"},$q->a({-class=>"linknav3",-href=>"$varenv{wwwhost}/DMS/Waren/?detail_search=1\&s_barcode=$ct4rel->{$id}->{barcode}",-title=>"zum Rad "},"$ct4rel->{$id}->{barcode}")),"\n"; }elsif($key eq "u_id" && $node_meta->{ct_table} eq "users"){ my $adref = { diff --git a/copri4/shareedms-operator/src/Lib/Mlogic.pm b/copri4/shareedms-operator/src/Lib/Mlogic.pm index 62a3782..3cf8349 100755 --- a/copri4/shareedms-operator/src/Lib/Mlogic.pm +++ b/copri4/shareedms-operator/src/Lib/Mlogic.pm @@ -190,7 +190,7 @@ sub tpl(){ print "
  • \n"; my $lmenu1; foreach my $id1 (sort {$node1->{$a}->{n_sort} <=> $node1->{$b}->{n_sort}} keys (%$node1)){ - if($node1->{$id1}->{node_name} !~ /Firma|System|Servicetechnik/){ + if($node1->{$id1}->{node_name} !~ /Firma|System/){ my $node2 = $db->collect_noderel($node1->{$id1}->{main_id},$lang,$users_dms->{u_id}); $mclass = ""; $mstyle = ""; @@ -336,35 +336,30 @@ print <{tpl_name} eq "AttributMatrix"){ - $tpl_name = "AttributMatrix"; - require "Tpl/AttributMatrix.pm"; - $return = &AttributMatrix::tpl($node_meta,$users_dms,$mode,$return); - #}elsif($tpl_id && $tpl_id >= 400 && $tpl_id <= 699){#contentpos or contentadrpos + if($node_meta->{tpl_id} == 199 && $node_meta->{ct_table} eq "contentuser"){ + require "Tpl/SubListe.pm"; + $return = &SubListe::tpl($node_meta,$users_dms,$mode,$return); + }elsif($node_meta->{ct_table} eq "contentuser"){ + require "Tpl/MandantConf.pm"; + $return = &MandantConf::tpl($node_meta,$users_dms,$mode,$return); }elsif($node_meta->{tpl_id} == 1 && $node_meta->{main_id} == 200017){ - require "Tpl/Karte.pm"; - &Karte::tpl($node_meta,$users_dms,$mode,$varenv,"",$return); + require "Tpl/Karte.pm"; + &Karte::tpl($node_meta,$users_dms,$mode,$varenv,"",$return); }elsif($node_meta->{ct_table} =~ /contentpos|contentadrpos|users$/){#contentpos or contentadrpos require "Tpl/SubListe.pm"; $return = &SubListe::tpl($node_meta,$users_dms,$mode,$return); }elsif($node_meta->{ct_table} =~ /content$|contentadr$|contenttrans$/){ require "Tpl/Liste3.pm"; $return = &Liste3::tpl($node_meta,$users_dms,$mode,$return); - }elsif($node_meta->{ct_table} eq "contentuser"){ - require "Tpl/MandantConf.pm"; - $return = &MandantConf::tpl($node_meta,$users_dms,$mode,$return); - #}elsif($tpl_name =~ /Statistik/){ - #require "Tpl/Statistik.pm"; - #&Statistik::tpl($main_id,$u_id,$lang,"","",$sort); }elsif($node_meta->{ct_table} =~ /contenttranspos|contenttheftpos/){ require "Tpl/Calorin.pm"; &Calorin::tpl($node_meta,$users_dms,$mode,$return); } ##Modalbox things## if($return !~ /failure/){ - if(($R::ct_trans !~ /close/) && ($ct_table =~ /contenttrans/ || $R::kind_of_trans =~ /Faktur|Verleih/) && ($R::ct_trans || $R::trans2edit || $R::ctpos_activ || $R::select_part || $R::set_main_id)){ + if(($R::ct_trans !~ /close/) && ($ct_table =~ /contenttrans/) && ($R::ct_trans || $R::trans2edit || $R::ctpos_activ || $R::select_part || $R::set_main_id)){ &Modalbox::mobox($node_meta,$users_dms,$mode,$return); - }elsif(($R::ct_trans !~ /close/) && ($ct_table =~ /content$|contentadr|contenttver|contentpos|users$/ && ($R::ct_trans || $R::rel_edit || $R::base_edit)) || ($R::node2edit && $R::node2edit =~ /edit/)){ + }elsif(($R::ct_trans !~ /close/) && ($ct_table =~ /content$|contentadr|contentuser|contentpos|users$/ && ($R::ct_trans || $R::rel_edit || $R::base_edit)) || ($R::node2edit && $R::node2edit =~ /edit/)){ &Modalbox3::mobox3($node_meta,$users_dms,$mode,$return) if($R::rel_edit !~ /delete|save/ && $R::ct_trans !~ /delete/ && $R::base_edit !~ /delete|save/ && !$R::service_id); } } diff --git a/copri4/shareeweb-project/src/Lib/Mlogic.pm b/copri4/shareeweb-project/src/Lib/Mlogic.pm index 7101789..373499e 100755 --- a/copri4/shareeweb-project/src/Lib/Mlogic.pm +++ b/copri4/shareeweb-project/src/Lib/Mlogic.pm @@ -22,8 +22,14 @@ sub new { #Template sub tpl(){ my $self = shift; - my ($node_meta,$users_dms,$mode,$varenv,$users_sharee,$return) = @_; - #print Dumper($node_meta);exit; + my $node_meta = shift; + my $users_dms = shift; + my $mode = shift || ""; + my $varenv = shift; + my $users_sharee = shift || ""; + my $return = shift || ""; + + my $user_agent = $q->user_agent(); my $lang = "de"; my $debug = 0; @@ -154,19 +160,25 @@ sub tpl(){ } print "
    \n"; - #print ""; - print "A"; - print "A"; - print "A"; - print ""; + if($user_agent !~ /Android|Iphone/i){ + print "A\n"; + print "A\n"; + print "A\n"; + print "\n"; + } if($users_sharee->{c_id} && $R::sharee_edit ne "delete_account2"){ print " | $users_sharee->{txt08} logout\n"; } print "
    \n"; - print $q->div({-style=>"text-align:left;width:100%;margin:1em 0;background-image: linear-gradient(to right, rgb(0, 156, 217) 300px, rgb(255,255,255));"},$q->img({-style=>'height:10em;', -src=>"$dbt->{website}->{$varenv->{syshost}}->{operatorWeb1}/img/Logo-LastenradBayern-01.png"})),"\n" if($dbt->{website}->{$varenv->{syshost}}->{project} eq "Bayern"); - + if($dbt->{website}->{$varenv->{syshost}}->{project} eq "Bayern"){ + if($user_agent !~ /Android|Iphone/i){ + print $q->div({-style=>"text-align:left;width:100%;margin:1em 0;background-image: linear-gradient(to right, rgb(0, 156, 217) 300px, rgb(255,255,255));"},$q->img({-style=>'height:10em;', -src=>"$dbt->{website}->{$varenv->{syshost}}->{operatorWeb1}/img/Logo-LastenradBayern-01.png"})),"\n"; + }else{ + print $q->div({-style=>"text-align:left;width:100%;margin:1em 0;background-color:#$bgcolor1;"},$q->img({-style=>'height:10em;', -src=>"$dbt->{website}->{$varenv->{syshost}}->{operatorWeb1}/img/Logo-LastenradBayern-01.png"})),"\n"; + } + } #test Bayern left-site menue #print $q->div({-style=>"float:left;text-align:left;border:1px dotted black;"},$q->ul({-id=>'LeftNavi'},$lmenu0)),"\n"; #print "
    \n";