cleanup merchant_id and Karte on OP

This commit is contained in:
Rainer Gümpelein 2022-01-02 14:57:19 +01:00
parent aff4b9d1e1
commit 0184300a35
12 changed files with 191 additions and 155 deletions

View file

@ -1418,7 +1418,8 @@ sub bikes_available(){
$return->{$id}->{Ilockit_ID} = "$record->{$id}->{txt18}";
$return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv{dbname}}->{oprefix}$record->{$id}->{main_id}"];
#if($users_serviceapp->{int09}){
if($q->param('authcookie') =~ /_cleeJet3$|_34567890$/ && scalar(@{$user_tour} >= 1)){
#shareetool
if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} == 187 && $q->param('authcookie') =~ /$dbt->{merchant_ids}->{$varenv{merchant_id}}/ && scalar(@{$user_tour} >= 1)){
my @service_code = split(/\s/,$record->{$id}->{txt23});
$return->{$id}->{service_code} = [@service_code];
}
@ -1477,7 +1478,9 @@ sub bikes_all(){
#on servicetool only stations on user_tour
$bw->log("stations_service_tour",$stations_allraw,"");
my @stations_service_tour = ();
if($q->param('authcookie') =~ /_cleeJet3$|_34567890$/){
#shareetool
if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} == 187 && $q->param('authcookie') =~ /$dbt->{merchant_ids}->{$varenv{merchant_id}}/){
my $stations = "";
if(ref($stations_allraw) eq "HASH" && scalar(@{$user_tour} >= 1)){
foreach my $id (sort { $stations_allraw->{$a}->{int04} <=> $stations_allraw->{$b}->{int04} } keys (%$stations_allraw)){
@ -1520,7 +1523,8 @@ sub bikes_all(){
$return->{$id}->{Ilockit_ID} = "$record->{$id}->{txt18}";
$return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv{dbname}}->{oprefix}$record->{$id}->{main_id}"];
#if($users_serviceapp->{int09}){
if($q->param('authcookie') =~ /_cleeJet3$|_34567890$/ && scalar(@{$user_tour} >= 1)){
#shareetool
if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} == 187 && $q->param('authcookie') =~ /$dbt->{merchant_ids}->{$varenv{merchant_id}}/ && scalar(@{$user_tour} >= 1)){
my @service_code = split(/\s/,$record->{$id}->{txt23});
$return->{$id}->{service_code} = [@service_code];
}
@ -1565,7 +1569,8 @@ sub stations_available(){
my $record = {};
#on servicetool only stations on user_tour
if($q->param('authcookie') =~ /_cleeJet3$|_34567890$/){
#shareetool
if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} == 187 && $q->param('authcookie') =~ /$dbt->{merchant_ids}->{$varenv{merchant_id}}/){
if(scalar(@{$user_tour}) >= 1){
$pref_sql .= " AND (";
foreach(@{$user_tour}){
@ -1656,13 +1661,12 @@ sub stations_all(){
my $station_id = $1 if($q->param('station') =~ /(\d+)/);
my $work_val_id = $1 if($q->param('work_val') =~ /(\d+)/);
if(looks_like_number($station_id)){
$pref = { %$pref, int04 => "=::" . $q->escapeHTML($station_id) };
$pref->{int04} = $station_id;
}elsif($q->param('work_id') eq "int04" && $work_val_id){
$pref = { %$pref, int04 => "=::" . $q->escapeHTML("$work_val_id") };
$pref->{int04} = $work_val_id;
}
#$pref = { %$pref, int04 => ">::0" } if($q->param('authcookie') !~ /34567890|cleeJet3/);#Werkstatt
$pref = { %$pref, int10 => "1" } if($q->param('authcookie') !~ /34567890|cleeJet3/);#Werkstatt
#shareetool werktatt
$pref->{int10} = 1 if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} == 187 && $q->param('authcookie') =~ /$dbt->{merchant_ids}->{$varenv{merchant_id}}/);
my $pref_sql = "";
$pref_sql .= " and (";
@ -1677,7 +1681,8 @@ sub stations_all(){
my $record = {};
#on servicetool only stations on user_tour
if($q->param('authcookie') =~ /_cleeJet3$|_34567890$/){
#shareetool
if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} == 187 && $q->param('authcookie') =~ /$dbt->{merchant_ids}->{$varenv{merchant_id}}/){
if(scalar(@{$user_tour}) >= 1){
$pref_sql .= " AND (";
foreach(@{$user_tour}){
@ -1798,7 +1803,8 @@ sub fetch_tariff(){
};
$auth_operator = $dbt->fetch_record($dbh,$authref);
if($authcookie && $authcookie =~ /_cleeJet3|_34567890/){
#shareetool
if($authcookie && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} == 187 && $authcookie =~ /$dbt->{merchant_ids}->{$varenv{merchant_id}}/){
my $users_serviceapp = $dbt->select_users($dbh,$auth_operator->{c_id},"and int09=1");
if($users_serviceapp->{int09}){
$auth_operator->{txt18} =~ s/(\d+)/$dbt->{operator}->{$varenv{dbname}}->{oprefix}$1/g;
@ -1840,7 +1846,8 @@ sub fetch_tariff(){
}
#fallback to public tarif if no user tariff defined and not servicetool app request
if(!@tarifnr && $authcookie !~ /_cleeJet3|_34567890/){
#shareetool
if(!@tarifnr && (!$dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} || $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} != 187)){
foreach my $id (keys (%$tariff_content)){
if($tariff_content->{$id}->{int18} eq 2){
$bw->log("Tarif FOUND FALLBACK for No Tarif users if($tariff_content->{$id}->{int12} && $varenv{dbname}) (s-type:$tariff_content->{$id}->{int18})",$id,"");
@ -2155,7 +2162,8 @@ sub auth_verify(){
$bw->log("auth_verify done on txt05 authcookies by dbname $varenv{dbname}:",$record->{txt05},"");
#Servicetool only users with users.int09=1
if($varenv{dbname} ne "sharee_primary" && $q->param('authcookie') =~ /_34567890$|_cleeJet3$/){
#shareetool
if($varenv{dbname} ne "sharee_primary" && $q->param('authcookie') && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv{merchant_id}}->{id} == 187 && $q->param('authcookie') =~ /$dbt->{merchant_ids}->{$varenv{merchant_id}}/){
my $users_serviceapp = { u_id => 0 };
$users_serviceapp = $dbt->select_users($dbh,$record->{c_id},"and int09=1");
if(!$users_serviceapp->{u_id} || $users_serviceapp->{u_id} == 0){
@ -2205,7 +2213,8 @@ sub authorization(){
$authref->{txt11} = "$pwmd5";
#Servicetool, only users with users.int09=1
if($merchant_id =~ /_34567890$|_cleeJet3$/){
#shareetool
if($aowner && $aowner eq "187"){
my $users_serviceapp = { u_id => 0 };
$users_serviceapp = $dbt->select_users($dbh,$record->{c_id},"and int09=1");
$record = { c_id => 0 } if(!$users_serviceapp->{u_id});