mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-13 15:16:38 +02:00
rebuild merchant select to get colors and init_map
This commit is contained in:
parent
0184300a35
commit
1b0ba8f010
8 changed files with 112 additions and 119 deletions
|
@ -79,9 +79,6 @@ sub handler {
|
|||
$mode = $1;
|
||||
}
|
||||
|
||||
my $aowner = 0;
|
||||
$varenv{merchant_id} = "";
|
||||
|
||||
#main datadir is main config directive like "shareeapp-kn" and catched by syshost name
|
||||
if($netloc =~ /:\/\/(sharee\w+-\w+)\.copri/){
|
||||
#$bw->log("Indexsharee merchant select by netloc:",$netloc,"");
|
||||
|
@ -112,57 +109,11 @@ sub handler {
|
|||
print $q->header(-charset=>"$html_charset", -cookie=>$cookie);
|
||||
}
|
||||
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||
|
||||
my $merchanized = 0;
|
||||
my $merchant_conf = "";
|
||||
#merchant select by user_agent -> disabled
|
||||
#while (($merchant_conf, my $value) = each %{ $dbt->{merchant_ids}}) {
|
||||
# if($merchant_conf && $value->{user_agent} && $user_agent && $user_agent =~ /$value->{user_agent}/){
|
||||
# $aowner = $value->{id};
|
||||
# $varenv{merchant_id} = $merchant_conf;
|
||||
# $merchanized = 1;
|
||||
# $bw->log("Indexsharee merchant select by user_agent: if($merchant_conf && $value->{user_agent} && $user_agent && $user_agent =~ /$value->{user_agent}/){",$varenv{merchant_id},"");
|
||||
# last;
|
||||
# }
|
||||
#}
|
||||
|
||||
if(!$merchanized){
|
||||
while (($merchant_conf, my $value) = each %{ $dbt->{merchant_ids}}) {
|
||||
if($merchant_conf && (($coo && $coo =~ /$merchant_conf$/) || ($R::sessionid && $R::sessionid =~ /$merchant_conf$/) || ($R::authcookie && $R::authcookie =~ /$merchant_conf$/) || ($R::merchant_id && $R::merchant_id eq $merchant_conf))){
|
||||
$aowner = $value->{id};
|
||||
$varenv{merchant_id} = $merchant_conf;
|
||||
$merchanized = 1;
|
||||
$bw->log("Indexsharee merchant select by authcookie OR merchant_id: if($merchant_conf && (($R::sessionid && $R::sessionid =~ /$merchant_conf$/) || ($R::authcookie && $R::authcookie =~ /$merchant_conf$/) || ($R::merchant_id && $R::merchant_id eq $merchant_conf))){",$merchant_conf,"");
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#TODO, check it will be deleted
|
||||
if(1==2 && !$merchanized){
|
||||
if($varenv{syshost} eq "shareeapp-primary" || $varenv{syshost} eq "shareedms-primary"){
|
||||
$aowner = $dbt->{primary}->{sharee_primary}->{owner};
|
||||
$varenv{merchant_id} = $dbt->{primary}->{sharee_primary}->{merchant_id};
|
||||
$merchanized = 1;
|
||||
$bw->log("Indexsharee merchant select by dbname: sharee_primary:",$varenv{merchant_id},"");
|
||||
}
|
||||
elsif($varenv{syshost} =~ /shareedms-(\w+)/){
|
||||
$aowner = $dbt->{operator}->{$varenv{dbname}}->{owner};
|
||||
$varenv{merchant_id} = $dbt->{operator}->{$varenv{dbname}}->{merchant_id};
|
||||
$merchanized = 1;
|
||||
$bw->log("Indexsharee merchant select by dbname=$varenv{dbname}:",$varenv{merchant_id},"");
|
||||
}
|
||||
elsif($varenv{syshost} =~ /shareeweb-/){
|
||||
$aowner = $dbt->{website}->{$varenv{syshost}}->{owner};
|
||||
$varenv{merchant_id} = $dbt->{website}->{$varenv{syshost}}->{merchant_id};
|
||||
$merchanized = 1;
|
||||
$bw->log("Indexsharee merchant select by syshost=$varenv{syshost}:",$varenv{merchant_id},"");
|
||||
}
|
||||
}
|
||||
|
||||
(my $aowner,$varenv{merchant_id},my $response) = $apif->fetch_merchant(\%varenv,$coo,"","");
|
||||
$bw->log("Indexsharee merchant select used with access_owner $aowner",$varenv{merchant_id},"");
|
||||
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||
|
||||
#login-screen should only be available if auth_verify fails
|
||||
if($R::login_sharee || $R::login_dms){
|
||||
|
||||
|
@ -659,8 +610,13 @@ if(1==2 && !$merchanized){
|
|||
}
|
||||
}
|
||||
}elsif($users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/Anmelden|$varenv{mandant}\/$varenv{profile}/)){
|
||||
if(!$users_sharee->{int14}){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?cum=2$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}else{
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=2$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
###
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue