diff --git a/copri4/main/src/Mod/APIfunc.pm b/copri4/main/src/Mod/APIfunc.pm index c8d465a..c19570a 100755 --- a/copri4/main/src/Mod/APIfunc.pm +++ b/copri4/main/src/Mod/APIfunc.pm @@ -62,12 +62,13 @@ sub fetch_merchant { my $aowner = 0; while ((my $merchant_conf, my $value) = each %{ $dbt->{merchant_ids}}) { - $bw->log("---> trying merchant select by session-cookie OR authcookie OR merchant_id: if($merchant_conf && (($req_coo && $req_coo =~ /$merchant_conf/) || ($req_merchant_id && $req_merchant_id eq $merchant_conf))){",$merchant_conf,""); + #$bw->log("---> trying merchant select by session-cookie OR authcookie OR merchant_id: if($merchant_conf && (($req_coo && $req_coo =~ /$merchant_conf/) || ($req_merchant_id && $req_merchant_id eq $merchant_conf))){",$merchant_conf,""); if($merchant_conf && (($req_coo && $req_coo =~ /$merchant_conf$/) || ($req_merchant_id && $req_merchant_id eq $merchant_conf))){ $aowner = $value->{id}; $merchanized = 1; $return->{merchant_id} = $merchant_conf; + $return->{project_id} = $value->{project}; my $lat = ""; my $lng = ""; $value->{initMap} =~ s/\s//g; @@ -77,7 +78,7 @@ sub fetch_merchant { $return->{init_map}->{center}->{longitude} = $lng; $return->{init_map}->{radius} = "2.9"; } - $bw->log("===> merchant select by session-cookie OR authcookie OR merchant_id: if($merchant_conf && (($req_coo && $req_coo =~ /$merchant_conf/) || ($req_merchant_id && $req_merchant_id eq $merchant_conf))){",$return->{merchant_id},""); + $bw->log("===> merchant select by $return->{project_id} session-cookie OR authcookie OR merchant_id: if($merchant_conf && (($req_coo && $req_coo =~ /$merchant_conf/) || ($req_merchant_id && $req_merchant_id eq $merchant_conf))){",$return->{merchant_id},""); #last; } } @@ -85,20 +86,23 @@ sub fetch_merchant { if($varenv->{syshost} eq "shareeapp-primary" || $varenv->{syshost} eq "shareedms-primary"){ $aowner = $dbt->{primary}->{sharee_primary}->{owner}; $return->{merchant_id} = $dbt->{primary}->{sharee_primary}->{merchant_id}; + $return->{project_id} = $dbt->{primary}->{sharee_primary}->{project}; $merchanized = 1; - $bw->log("merchant select by primary dbname: sharee_primary:",$return->{merchant_id},""); + $bw->log("===> merchant select by $return->{project_id} primary dbname: sharee_primary:",$return->{merchant_id},""); } elsif($varenv->{syshost} =~ /shareeapp-(\w+)/ || $varenv->{syshost} =~ /shareedms-(\w+)/){ $aowner = $dbt->{operator}->{$varenv->{dbname}}->{owner}; $return->{merchant_id} = $dbt->{operator}->{$varenv->{dbname}}->{merchant_id}; + $return->{project_id} = $dbt->{operator}->{$varenv->{dbname}}->{project}; $merchanized = 1; - $bw->log("merchant select by operator dbname=$varenv->{dbname}:",$return->{merchant_id},""); + $bw->log("===> merchant select by $return->{project_id} operator dbname=$varenv->{dbname}:",$return->{merchant_id},""); } elsif($varenv->{syshost} =~ /shareeweb-/){ $aowner = $dbt->{website}->{$varenv->{syshost}}->{owner}; $return->{merchant_id} = $dbt->{website}->{$varenv->{syshost}}->{merchant_id}; + $return->{project_id} = $dbt->{website}->{$varenv->{syshost}}->{project}; $merchanized = 1; - $bw->log("===> merchant select by website syshost=$varenv->{syshost}:",$return->{merchant_id},""); + $bw->log("===> merchant select by $return->{project_id} website syshost=$varenv->{syshost}:",$return->{merchant_id},""); } } diff --git a/copri4/main/src/Mod/APIjsonclient.pm b/copri4/main/src/Mod/APIjsonclient.pm index 9ba05d8..4e808e0 100755 --- a/copri4/main/src/Mod/APIjsonclient.pm +++ b/copri4/main/src/Mod/APIjsonclient.pm @@ -38,9 +38,10 @@ sub loop_sharees { my $self = shift; my $q = shift || ""; my $auth = shift; - my $owner = shift || ""; + my $return_merchant = shift || ""; my @keywords = $q->param; - my $project = "all"; + #my $project = "all"; + my $project = $return_merchant->{project_id} || "all"; #only request keys which initated by sharee primary requests to operator my $rest = ""; @@ -49,12 +50,12 @@ sub loop_sharees { my $val = $q->param($_); my $encoded_val = $uri_encode->encode($val); $rest .= "$_=$encoded_val&"; - }elsif($_ eq "project"){ - my $val = $q->param($_); - $project = $val if($val eq "Bayern");#restricted map view only on lastenrad bayern iframe - $project = $val if($val eq "Konstanz"); - $project = $val if($val eq "Demo"); - $project = $val if($val eq "LastenVelo"); + #}elsif($_ eq "project"){ + #my $val = $q->param($_); + #$project = $val if($val eq "Bayern");#restricted map view only on lastenrad bayern iframe + #$project = $val if($val eq "Konstanz"); + #$project = $val if($val eq "Demo"); + #$project = $val if($val eq "LastenVelo"); } } $rest =~ s/\&$//; @@ -73,7 +74,8 @@ sub loop_sharees { my $ret_json = ""; #print $key;# like sharee_fr01 if($value->{operatorApp} && ($project eq $value->{project} || $project eq "all")){ - $bw->log("--> LOOP-start jsonclient loop_sharees $key by operatorApp: $value->{operatorApp}, netloc: $netloc if($project eq $value->{project} || $project eq \"all\")\n","",""); + + $bw->log("--> LOOP-start ($return_merchant->{merchant_id}) jsonclient loop_sharees $key by operatorApp: $value->{operatorApp}, netloc: $netloc if($project eq $value->{project} || $project eq \"all\")\n","",""); $ret_json = $self->fetch_operator_json($value->{operatorApp},$rest); if($ret_json){ push(@uri_operator_array, $value->{operatorApp}); @@ -112,8 +114,9 @@ sub loop_sharees { }else{ $bw->log("NO json ","",""); } + $bw->log("--> LOOP-end jsonclient loop_sharees user_group:\n",\@user_group,""); } - $bw->log("--> LOOP-end jsonclient loop_sharees user_group:\n",\@user_group,""); + } #print "ALL:" . Dumper($fetch_hash); # diff --git a/copri4/main/src/Mod/APIjsonserver.pm b/copri4/main/src/Mod/APIjsonserver.pm index 1b95f8d..3601285 100755 --- a/copri4/main/src/Mod/APIjsonserver.pm +++ b/copri4/main/src/Mod/APIjsonserver.pm @@ -106,6 +106,7 @@ if(!$coo && !$q->param('merchant_id')){ ($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id')); if($aowner && ($aowner == 195 || $aowner == 185 || $aowner == 176)){ $response->{agb_html} = "site/agb_konrad_1.html"; + $response->{bike_info_html} = "site/bike_info_konrad_1.html"; } } @@ -392,7 +393,7 @@ elsif($q->param('request') eq "user_bikes_occupied"){ my ($auth,$authraw) = $apif->auth_verify($q); if(ref($auth) eq "HASH" && $auth->{authcookie}){ $response = { %$response, %$auth }; - ($response->{bikes_occupied},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$aowner); + ($response->{bikes_occupied},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$return_merchant); }else{ $response->{response_state} = "Failure 1001: authcookie on primary not defined"; $response->{response_text} = "Entschuldigung, die Session wurde unterbrochen"; @@ -423,7 +424,7 @@ elsif($q->param('request') eq "bikes_available"){ my ($auth,$authraw) = $apif->auth_verify($q); $response = { %$response, %$auth }; - ($response->{bikes},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$aowner); + ($response->{bikes},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$return_merchant); #my $stamp = gettimeofday; #$bw->log("X bikes_available $varenv{syshost} $stamp: $response->{user_group}",$response,""); }else{ @@ -451,7 +452,7 @@ elsif($q->param('request') eq "bikes_all"){ my ($auth,$authraw) = $apif->auth_verify($q); $response = { %$response, %$auth }; - ($response->{bikes},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$aowner); + ($response->{bikes},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$return_merchant); }else{ ($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id')); $varenv{merchant_id} = $return_merchant->{merchant_id}; @@ -602,7 +603,7 @@ elsif($q->param('request') eq "stations_all"){ my ($auth,$authraw) = $apif->auth_verify($q); $response = { %$response, %$auth }; - ($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$aowner); + ($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$return_merchant); }else{ ($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id')); $varenv{merchant_id} = $return_merchant->{merchant_id}; @@ -628,7 +629,7 @@ elsif($q->param('request') eq "stations_available"){ $response->{merchant_message} = "Herzlich Willkommen bei der neuen konrad App! Die App ist zwar schon installierbar, bis zur vollständigen Umstellung des Systems sind aber noch keine Räder ausleihbar. Das ist erst voraussichtlich Ende Januar der Fall und wird den Nutzern noch mitgeteilt. Danke für Ihr Verständnis! Ihr konrad-Team"; } $response = { %$response, %$auth }; - ($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$aowner); + ($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$return_merchant); }else{ ($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id')); $varenv{merchant_id} = $return_merchant->{merchant_id}; diff --git a/copri4/main/src/Tpl/Karte.pm b/copri4/main/src/Tpl/Karte.pm index cb308e7..c9a2509 100755 --- a/copri4/main/src/Tpl/Karte.pm +++ b/copri4/main/src/Tpl/Karte.pm @@ -75,7 +75,7 @@ print<{website}->{$varenv->{syshost}}->{parent_node}; ($node,$rows) = $dbt->collect_noderel($dbh,$dbt->{website}->{$varenv->{syshost}}->{parent_id}); - 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")){ + if($users_sharee->{c_id} && $R::sharee_edit ne "delete_account2" && ($users_sharee->{c_id} eq $varenv->{superu_id} || $users_sharee->{c_id} eq "22262" || $dbt->{copri_conf}->{stage} eq "test")){ my $coo = $q->cookie('domcookie') || $q->param('sessionid') || ""; - print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo", -target=>'_blank'}," [ booking-test ] ")),"\n"; + my $api_test = "sharee_kn"; + print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test", -target=>'_blank'}," [ $api_test ] ")),"\n"; } if($users_sharee->{c_id} && $R::sharee_edit ne "delete_account2"){