mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 19:56:29 +01:00
tarif getter and setter refactor
This commit is contained in:
parent
fd6ddfef8c
commit
54c801bc6d
6 changed files with 94 additions and 80 deletions
|
@ -850,7 +850,7 @@ sub fetch_bike_tariff {
|
||||||
$bike_id = $1 if($bike_id =~ /(\d+)/);
|
$bike_id = $1 if($bike_id =~ /(\d+)/);
|
||||||
|
|
||||||
my $main_ids = "";
|
my $main_ids = "";
|
||||||
my ($bike_group,$bike_node,$tariff_content,$user_tour) = $self->fetch_tariff($varenv->{dbname},$auth,"");
|
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,"");
|
||||||
$main_ids = join(",",@{$bike_node});
|
$main_ids = join(",",@{$bike_node});
|
||||||
$main_ids =~ s/[a-z_]+//ig;
|
$main_ids =~ s/[a-z_]+//ig;
|
||||||
my $ct_bike = {};
|
my $ct_bike = {};
|
||||||
|
@ -1581,12 +1581,8 @@ sub booking_update(){
|
||||||
$booking_values->{lock_state} = "locking" if($booking->{int20} == 3);
|
$booking_values->{lock_state} = "locking" if($booking->{int20} == 3);
|
||||||
$booking_values->{lock_state} = "unlocking" if($booking->{int20} == 4);
|
$booking_values->{lock_state} = "unlocking" if($booking->{int20} == 4);
|
||||||
|
|
||||||
#keep in mind, it works on operator dependency
|
|
||||||
#only for project=Bayern and developer enabled
|
|
||||||
#redundant code in APIfunc sub rentals for sig user_miniquery
|
|
||||||
#TODO $auth int23 seems primary
|
|
||||||
my $dbh_primary = $dbt->dbconnect_extern("sharee_primary");
|
|
||||||
#user_miniquest_count on operator
|
#user_miniquest_count on operator
|
||||||
|
my $dbh_primary = $dbt->dbconnect_extern("sharee_primary");
|
||||||
my $adref = {
|
my $adref = {
|
||||||
table => "contentadr",
|
table => "contentadr",
|
||||||
fetch => "one",
|
fetch => "one",
|
||||||
|
@ -1768,7 +1764,8 @@ sub rental_to_feedback{
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $varenv = shift;
|
my $varenv = shift;
|
||||||
my $auth = shift;
|
my $auth = shift;
|
||||||
|
my $dbh = "";
|
||||||
|
|
||||||
my $pref = {
|
my $pref = {
|
||||||
table => "contenttrans",
|
table => "contenttrans",
|
||||||
table_pos => "contenttranspos",
|
table_pos => "contenttranspos",
|
||||||
|
@ -1787,10 +1784,21 @@ sub rental_to_feedback{
|
||||||
|
|
||||||
my $show_dialog = {};
|
my $show_dialog = {};
|
||||||
if($dbt->{operator}->{$varenv->{dbname}}->{project} eq "Bayern"){
|
if($dbt->{operator}->{$varenv->{dbname}}->{project} eq "Bayern"){
|
||||||
if($auth->{int23} < 4){
|
|
||||||
$bw->log("user_miniquery via $varenv->{dbname} user ID $auth->{c_id} exist count:",$auth->{int23},"");
|
my $dbh_primary = $dbt->dbconnect_extern("sharee_primary");
|
||||||
|
my $adref = {
|
||||||
|
table => "contentadr",
|
||||||
|
fetch => "one",
|
||||||
|
template_id => "202",
|
||||||
|
c_id => "$auth->{c_id}",
|
||||||
|
};
|
||||||
|
my $auth_prim = $dbt->fetch_record($dbh_primary,$adref);
|
||||||
|
|
||||||
|
if(!$auth_prim->{int23} || $auth_prim->{int23} < 4){
|
||||||
|
$bw->log("user_miniquery via user ID $auth_prim->{c_id} exist count:",$auth_prim->{int23},"");
|
||||||
$show_dialog->{user_miniquery} = $dbt->evaluationsfragen($dbh);
|
$show_dialog->{user_miniquery} = $dbt->evaluationsfragen($dbh);
|
||||||
}
|
}
|
||||||
|
$show_dialog->{co2saving} = "";
|
||||||
if($ctpos->{int26}){
|
if($ctpos->{int26}){
|
||||||
my $co2saving = "Einsparung: ";
|
my $co2saving = "Einsparung: ";
|
||||||
my $co2diff = $pri->co2calc($ctpos);
|
my $co2diff = $pri->co2calc($ctpos);
|
||||||
|
@ -1899,8 +1907,12 @@ sub bikes_available(){
|
||||||
int10 => "1",#1 = "available"
|
int10 => "1",#1 = "available"
|
||||||
};
|
};
|
||||||
my $tariff_content = {};
|
my $tariff_content = {};
|
||||||
|
my $adrtarif_hash = {};
|
||||||
$authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id} > 0);
|
$authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id} > 0);
|
||||||
(my $bike_group,my $bike_node,$tariff_content,my $user_tour) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
(my $bike_group,my $bike_node,my $user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
||||||
|
|
||||||
|
#print Dumper($bike_group);
|
||||||
|
#print Dumper($bike_node);
|
||||||
my $main_ids = join(",",@{$bike_node});
|
my $main_ids = join(",",@{$bike_node});
|
||||||
$main_ids =~ s/[a-z_-]+//ig;#should work also without Trenner
|
$main_ids =~ s/[a-z_-]+//ig;#should work also without Trenner
|
||||||
$pref = { %$pref, main_id => "IN::($main_ids)" };
|
$pref = { %$pref, main_id => "IN::($main_ids)" };
|
||||||
|
@ -1916,16 +1928,6 @@ sub bikes_available(){
|
||||||
$record = $dbt->fetch_record($dbh,$pref) if(ref($bike_node) eq "ARRAY" && @{$bike_node}[0]);
|
$record = $dbt->fetch_record($dbh,$pref) if(ref($bike_node) eq "ARRAY" && @{$bike_node}[0]);
|
||||||
my $op_return = {};
|
my $op_return = {};
|
||||||
|
|
||||||
my @adr_tariff = ();
|
|
||||||
if($auth->{txt30}){
|
|
||||||
@adr_tariff = ("$auth->{txt30}");
|
|
||||||
@adr_tariff = split(/\s+/,$auth->{txt30}) if($auth->{txt30} =~ /\w\s+\w/);
|
|
||||||
}elsif(ref($tariff_content) eq "HASH"){
|
|
||||||
foreach my $tid (keys (%$tariff_content)){
|
|
||||||
push(@adr_tariff, "$tariff_content->{$tid}->{barcode}") if($tariff_content->{$tid}->{int18} eq 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my $td_template = $dbt->rental_description_template();
|
my $td_template = $dbt->rental_description_template();
|
||||||
|
|
||||||
foreach my $id (sort { $record->{$a}->{barcode} <=> $record->{$b}->{barcode} } keys (%$record)){
|
foreach my $id (sort { $record->{$a}->{barcode} <=> $record->{$b}->{barcode} } keys (%$record)){
|
||||||
|
@ -1972,9 +1974,10 @@ sub bikes_available(){
|
||||||
if(ref($tariff_content) eq "HASH"){
|
if(ref($tariff_content) eq "HASH"){
|
||||||
foreach my $tid (sort { $tariff_content->{$a}->{barcode} <=> $tariff_content->{$b}->{barcode} } keys (%$tariff_content)){
|
foreach my $tid (sort { $tariff_content->{$a}->{barcode} <=> $tariff_content->{$b}->{barcode} } keys (%$tariff_content)){
|
||||||
|
|
||||||
foreach(@adr_tariff){
|
foreach my $atid (keys (%$adrtarif_hash)){
|
||||||
if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $_ == $tariff_content->{$tid}->{barcode}){
|
#print "if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $atid == $tariff_content->{$tid}->{barcode}){\n";
|
||||||
#$bw->log("bikes_available for user c_id: $auth->{c_id} if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $_ == $tariff_content->{$tid}->{barcode}) on BIKE:",$return->{$id}->{bike},"");
|
if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $atid == $tariff_content->{$tid}->{barcode}){
|
||||||
|
#$bw->log("bikes_available for user c_id: $auth->{c_id} if($record->{$id}->{main_id} == $tariff_content->{$tid}->{int12} && $atid == $tariff_content->{$tid}->{barcode}) on BIKE:",$return->{$id}->{bike},"");
|
||||||
|
|
||||||
#deprecated
|
#deprecated
|
||||||
$return->{$id}->{tariff_description}->{name} = "$tariff_content->{$tid}->{ct_name}";
|
$return->{$id}->{tariff_description}->{name} = "$tariff_content->{$tid}->{ct_name}";
|
||||||
|
@ -2040,7 +2043,7 @@ sub bikes_all(){
|
||||||
int10 => "!=::3",
|
int10 => "!=::3",
|
||||||
};
|
};
|
||||||
|
|
||||||
my ($bike_group,$bike_node,$tariff_content,$user_tour) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
||||||
my $main_ids = join(",",@{$bike_node});
|
my $main_ids = join(",",@{$bike_node});
|
||||||
$main_ids =~ s/[a-z_]+//ig;
|
$main_ids =~ s/[a-z_]+//ig;
|
||||||
$pref = { %$pref, main_id => "IN::($main_ids)" };
|
$pref = { %$pref, main_id => "IN::($main_ids)" };
|
||||||
|
@ -2147,7 +2150,7 @@ sub stations_available(){
|
||||||
|
|
||||||
my $authed = 0;
|
my $authed = 0;
|
||||||
$authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id});
|
$authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id});
|
||||||
my ($bike_group,$bike_node,$tariff_content,$user_tour) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
||||||
|
|
||||||
my $return = {};
|
my $return = {};
|
||||||
my $pref = {
|
my $pref = {
|
||||||
|
@ -2246,7 +2249,7 @@ sub stations_all(){
|
||||||
|
|
||||||
my $authed = 0;
|
my $authed = 0;
|
||||||
$authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id});
|
$authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id});
|
||||||
my ($bike_group,$bike_node,$tariff_content,$user_tour) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
||||||
|
|
||||||
my $return={};
|
my $return={};
|
||||||
my $pref = {
|
my $pref = {
|
||||||
|
@ -2396,9 +2399,9 @@ sub fetch_tariff(){
|
||||||
|
|
||||||
my $merchant_id = "";
|
my $merchant_id = "";
|
||||||
$merchant_id = $1 if($authcookie && $authcookie =~ /\w+_(\w+)$/);
|
$merchant_id = $1 if($authcookie && $authcookie =~ /\w+_(\w+)$/);
|
||||||
my $tariff_content = {};
|
my $tariff_content = "";
|
||||||
my @user_tour = ();
|
my @user_tour = ();
|
||||||
my $auth_operator = {};
|
my $auth_operator = { c_id => 0 };
|
||||||
|
|
||||||
#int18
|
#int18
|
||||||
#<sharing_type>
|
#<sharing_type>
|
||||||
|
@ -2421,8 +2424,9 @@ sub fetch_tariff(){
|
||||||
$tariff->{int18} = 2;
|
$tariff->{int18} = 2;
|
||||||
$tariff_content = $dbt->fetch_record($dbh,$tariff);
|
$tariff_content = $dbt->fetch_record($dbh,$tariff);
|
||||||
$bw->log("1. Tariff type $tariff->{int18} select on",$dbname,"");
|
$bw->log("1. Tariff type $tariff->{int18} select on",$dbname,"");
|
||||||
}elsif(ref($adr) eq "HASH" && $adr->{c_id}){
|
}
|
||||||
#select operators address to get users tarifnr array in txt30
|
#select operators address to get users tarifnr array in txt30
|
||||||
|
elsif(ref($adr) eq "HASH" && $adr->{c_id}){
|
||||||
delete $tariff->{int18} if($tariff->{int18});
|
delete $tariff->{int18} if($tariff->{int18});
|
||||||
my $authref = {
|
my $authref = {
|
||||||
table => "contentadr",
|
table => "contentadr",
|
||||||
|
@ -2432,7 +2436,7 @@ sub fetch_tariff(){
|
||||||
};
|
};
|
||||||
$auth_operator = $dbt->fetch_record($dbh,$authref);
|
$auth_operator = $dbt->fetch_record($dbh,$authref);
|
||||||
|
|
||||||
#shareetool
|
#shareetool user_tour
|
||||||
if($merchant_id && $dbt->{merchant_ids}->{$merchant_id}->{id} && $dbt->{merchant_ids}->{$merchant_id}->{id} == 187){
|
if($merchant_id && $dbt->{merchant_ids}->{$merchant_id}->{id} && $dbt->{merchant_ids}->{$merchant_id}->{id} == 187){
|
||||||
my $users_serviceapp = $dbt->select_users($dbh,$auth_operator->{c_id},"and int09=1");
|
my $users_serviceapp = $dbt->select_users($dbh,$auth_operator->{c_id},"and int09=1");
|
||||||
if($users_serviceapp->{int09}){
|
if($users_serviceapp->{int09}){
|
||||||
|
@ -2440,59 +2444,64 @@ sub fetch_tariff(){
|
||||||
@user_tour = ($auth_operator->{txt18});
|
@user_tour = ($auth_operator->{txt18});
|
||||||
@user_tour = split(/\s/,$auth_operator->{txt18}) if($auth_operator->{txt18} =~ /\s/);
|
@user_tour = split(/\s/,$auth_operator->{txt18}) if($auth_operator->{txt18} =~ /\s/);
|
||||||
}
|
}
|
||||||
}
|
}#end user_tour
|
||||||
#$tariff->{int18} = 2;#disabled because wee need all
|
|
||||||
$tariff->{int18} = 4 if($dbname eq "sharee_lv");
|
$tariff->{int18} = 4 if($dbname eq "sharee_lv");
|
||||||
|
|
||||||
#FIXME user tarif select have to be fetched like in net_booking
|
|
||||||
#$tariff_content must contain tariff_description in App bikes_available listing
|
|
||||||
$tariff_content = $dbt->fetch_record($dbh,$tariff);
|
$tariff_content = $dbt->fetch_record($dbh,$tariff);
|
||||||
$bw->log("2. Tariff type $tariff->{int18} select on",$dbname,"");
|
$bw->log("2. Tariff type $tariff->{int18} select on",$dbname,"");
|
||||||
#
|
}
|
||||||
}else{
|
#end operators address
|
||||||
|
else{
|
||||||
$bw->log("3. NO tariff_content on",$dbname,"");
|
$bw->log("3. NO tariff_content on",$dbname,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
my $oprefix = "";
|
my $oprefix = "";
|
||||||
$oprefix = "$dbt->{operator}->{$dbname}->{oprefix}" if($dbt->{operator}->{$dbname}->{oprefix});
|
$oprefix = "$dbt->{operator}->{$dbname}->{oprefix}" if($dbt->{operator}->{$dbname}->{oprefix});
|
||||||
|
|
||||||
|
#2022-07-16 refactored
|
||||||
|
#collect setted user tarifs and available public tarifs
|
||||||
|
my %adrtarif_hash = ();
|
||||||
|
if($auth_operator->{c_id}){
|
||||||
|
if($auth_operator->{txt30} && $auth_operator->{txt30} =~ /\d\s\d/){
|
||||||
|
%adrtarif_hash = map { $_ => 1 } split(/\s+/,$auth_operator->{txt30});
|
||||||
|
}else{
|
||||||
|
$adrtarif_hash{$auth_operator->{txt30}} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ref($tariff_content) eq "HASH"){
|
||||||
|
foreach my $tid (keys (%$tariff_content)){
|
||||||
|
$adrtarif_hash{$tariff_content->{$tid}->{barcode}} = 1 if($tariff_content->{$tid}->{int18} eq 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#collect tarif values for user rentable bikes
|
||||||
|
my %tarifnr = ();
|
||||||
|
my %bike_node = ();
|
||||||
|
my %bike_group = ();
|
||||||
|
if(ref($tariff_content) eq "HASH"){
|
||||||
|
foreach my $tid (sort { $tariff_content->{$a}->{barcode} <=> $tariff_content->{$b}->{barcode} } keys (%$tariff_content)){
|
||||||
|
|
||||||
|
foreach my $atid (keys (%adrtarif_hash)){
|
||||||
|
if($tariff_content->{$tid}->{int12} && $tariff_content->{$tid}->{barcode} && $atid == $tariff_content->{$tid}->{barcode}){
|
||||||
|
$bw->log("Tarif FOUND with merchant $merchant_id for authorized user-id $auth_operator->{c_id} if($tariff_content->{$tid}->{int12}) (s-type:$tariff_content->{$tid}->{int18})",$tariff_content->{$tid}->{barcode},"");
|
||||||
|
$tarifnr{$tariff_content->{$tid}->{barcode}} = 1;
|
||||||
|
$bike_node{$oprefix . $tariff_content->{$tid}->{int12}} = 1;#sharee bike_node.main_id
|
||||||
|
my $type_id = $nodes->{$tariff_content->{$tid}->{int12}}->{type_id} || "";
|
||||||
|
$bike_group{$oprefix . $type_id} = 1 if($type_id);#sharee bike_node.type_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
my @tarifnr = ();
|
my @tarifnr = ();
|
||||||
my @bike_node = ();
|
my @bike_node = ();
|
||||||
my @bike_group = ();
|
my @bike_group = ();
|
||||||
my @adr_tariff = ();
|
@tarifnr = keys %tarifnr;
|
||||||
if($auth_operator->{txt30}){
|
@bike_node = keys %bike_node;
|
||||||
@adr_tariff = ("$auth_operator->{txt30}");
|
@bike_group = keys %bike_group;
|
||||||
@adr_tariff = split(/\s+/,$auth_operator->{txt30}) if($auth_operator->{txt30} =~ /\w\s+\w/);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $id (keys (%$tariff_content)){
|
|
||||||
$bw->log("Tarif searching for authorized user-id $auth_operator->{c_id} by: if($auth_operator->{txt30} && $auth_operator->{txt30} =~ /$tariff_content->{$id}->{barcode}/ && $tariff_content->{$id}->{int12}) (s-type:$tariff_content->{$id}->{int18})","","");
|
|
||||||
foreach(@adr_tariff){
|
|
||||||
if($_ == $tariff_content->{$id}->{barcode} && $tariff_content->{$id}->{int12}){
|
|
||||||
$bw->log("Tarif FOUND with merchant $merchant_id for authorized user-id $auth_operator->{c_id} if($tariff_content->{$id}->{int12}) (s-type:$tariff_content->{$id}->{int18})",$tariff_content->{$id}->{barcode},"");
|
|
||||||
push(@tarifnr, "$tariff_content->{$id}->{barcode}");
|
|
||||||
push(@bike_node, "$oprefix$tariff_content->{$id}->{int12}");#sharee bike_node.main_id
|
|
||||||
my $type_id = $nodes->{$tariff_content->{$id}->{int12}}->{type_id} || "";
|
|
||||||
push(@bike_group, "$oprefix$type_id");#sharee bike_node.type_id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#fallback to public tarif if no user tariff defined and not servicetool app request
|
|
||||||
#shareetool
|
|
||||||
if(!@tarifnr && (!$dbt->{merchant_ids}->{$merchant_id}->{id} || $dbt->{merchant_ids}->{$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 with merchant $merchant_id if($tariff_content->{$id}->{int12} && $dbname) (s-type:$tariff_content->{$id}->{int18})",$id,"");
|
|
||||||
push(@tarifnr, "$tariff_content->{$id}->{barcode}");
|
|
||||||
push(@bike_node, "$oprefix$tariff_content->{$id}->{int12}");#sharee bike_node.main_id
|
|
||||||
my $type_id = $nodes->{$tariff_content->{$id}->{int12}}->{type_id} || "";
|
|
||||||
push(@bike_group, "$oprefix$type_id");#sharee bike_node.type_id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$bw->log("FETCHED_Tarif by dbname:$dbname with merchant $merchant_id | bike_node:@bike_node | bike_group:@bike_group | user_tour:@user_tour | tarifnr: @tarifnr",\@tarifnr,"");
|
$bw->log("FETCHED_Tarif by dbname:$dbname with merchant $merchant_id | bike_node:@bike_node | bike_group:@bike_group | user_tour:@user_tour | tarifnr: @tarifnr",\@tarifnr,"");
|
||||||
return (\@bike_group,\@bike_node,$tariff_content,\@user_tour);
|
return (\@bike_group,\@bike_node,\@user_tour,$tariff_content,\%adrtarif_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
#authout
|
#authout
|
||||||
|
@ -2581,8 +2590,9 @@ sub auth_verify(){
|
||||||
|
|
||||||
my $bike_group = "";
|
my $bike_group = "";
|
||||||
my $bike_node = "";
|
my $bike_node = "";
|
||||||
my $tariff_content = "";
|
|
||||||
my $user_tour = "";
|
my $user_tour = "";
|
||||||
|
my $tariff_content = "";
|
||||||
|
my $adrtarif_hash = "";
|
||||||
|
|
||||||
$return->{merchant_id} = $1 if($cgi_authcookie && $cgi_authcookie =~ /\w+_(\w+)$/);
|
$return->{merchant_id} = $1 if($cgi_authcookie && $cgi_authcookie =~ /\w+_(\w+)$/);
|
||||||
my $netloc = $q->url(-base=>1);
|
my $netloc = $q->url(-base=>1);
|
||||||
|
@ -2731,7 +2741,7 @@ sub auth_verify(){
|
||||||
}#end if($varenv{dbname} ne "sharee_primary")
|
}#end if($varenv{dbname} ne "sharee_primary")
|
||||||
|
|
||||||
if($varenv{dbname} ne "sharee_primary"){
|
if($varenv{dbname} ne "sharee_primary"){
|
||||||
($bike_group,$bike_node,$tariff_content,$user_tour) = $self->fetch_tariff($varenv{dbname},$record,$q->param('authcookie'));
|
($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv{dbname},$record,$q->param('authcookie'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($auth_primary->{c_id} > 0 && length($auth_primary->{txt05}) > 30){
|
if($auth_primary->{c_id} > 0 && length($auth_primary->{txt05}) > 30){
|
||||||
|
@ -2757,7 +2767,7 @@ sub auth_verify(){
|
||||||
|
|
||||||
$record = $dbt->fetch_record($dbh,$authref);
|
$record = $dbt->fetch_record($dbh,$authref);
|
||||||
|
|
||||||
($bike_group,$bike_node,$tariff_content,$user_tour) = $self->fetch_tariff($varenv{dbname},$record,$q->param('authcookie'));
|
($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv{dbname},$record,$q->param('authcookie'));
|
||||||
#maybe there isnt't any authcookie still available on confirm
|
#maybe there isnt't any authcookie still available on confirm
|
||||||
if ($record->{c_id} > 0){
|
if ($record->{c_id} > 0){
|
||||||
$return->{user_id} = $record->{txt08};
|
$return->{user_id} = $record->{txt08};
|
||||||
|
|
|
@ -78,11 +78,12 @@ sub loop_sharees {
|
||||||
$bw->log("shareetool select_users $return_merchant->{aowner} on $value->{database}->{dbname} $authraw->{c_id} $authraw->{txt17}",$users_serviceapp->{u_id},"");
|
$bw->log("shareetool select_users $return_merchant->{aowner} on $value->{database}->{dbname} $authraw->{c_id} $authraw->{txt17}",$users_serviceapp->{u_id},"");
|
||||||
}
|
}
|
||||||
#every sharee client must have a merchant_id which associate a project
|
#every sharee client must have a merchant_id which associate a project
|
||||||
#if($value->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $value->{project} || $return_merchant->{project_id} eq "all"))){
|
#if($value->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $value->{project} || $return_merchant->{project_id} eq "all")))
|
||||||
if($value->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $value->{project}))){
|
if($value->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $value->{project}))){
|
||||||
|
|
||||||
$bw->log("--> LOOP-start ($return_merchant->{merchant_id}) jsonclient loop_sharees $key by operatorApp: $value->{operatorApp}, netloc: $netloc if($return_merchant->{project_id} eq $value->{project} || $users_serviceapp->{u_id} > 0)\n","","");
|
$bw->log("--> LOOP-start ($return_merchant->{merchant_id}) jsonclient loop_sharees $key by operatorApp: $value->{operatorApp}, netloc: $netloc if($return_merchant->{project_id} eq $value->{project} || $users_serviceapp->{u_id} > 0)\n","","");
|
||||||
$ret_json = $self->fetch_operator_json("$value->{operatorApp}/APIjsonserver",$rest);
|
$ret_json = $self->fetch_operator_json("$value->{operatorApp}/APIjsonserver",$rest);
|
||||||
|
#print Dumper($ret_json);
|
||||||
|
|
||||||
if($ret_json){
|
if($ret_json){
|
||||||
push(@uri_operator_array, $value->{operatorApp});
|
push(@uri_operator_array, $value->{operatorApp});
|
||||||
|
|
|
@ -67,7 +67,6 @@ sub sig_available {
|
||||||
my $owner = 169;
|
my $owner = 169;
|
||||||
|
|
||||||
my $authed = 0;
|
my $authed = 0;
|
||||||
my $tariff_content = {};
|
|
||||||
my $ctpos = { c_id => 0 };
|
my $ctpos = { c_id => 0 };
|
||||||
my $show_dialog = {};
|
my $show_dialog = {};
|
||||||
if(ref($ctadr) eq "HASH" && $ctadr->{c_id} && $ctadr->{c_id} > 0){
|
if(ref($ctadr) eq "HASH" && $ctadr->{c_id} && $ctadr->{c_id} > 0){
|
||||||
|
@ -75,7 +74,7 @@ sub sig_available {
|
||||||
($ctpos,$show_dialog) = $apif->rental_to_feedback($varenv,$ctadr);
|
($ctpos,$show_dialog) = $apif->rental_to_feedback($varenv,$ctadr);
|
||||||
}
|
}
|
||||||
|
|
||||||
(my $bike_group,my $bike_node,$tariff_content,my $user_tour) = $apif->fetch_tariff($varenv->{dbname},$ctadr,$q->param('authcookie'));
|
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $apif->fetch_tariff($varenv->{dbname},$ctadr,$q->param('authcookie'));
|
||||||
|
|
||||||
my $hotline_hash = {
|
my $hotline_hash = {
|
||||||
table => "contentuser",
|
table => "contentuser",
|
||||||
|
@ -114,7 +113,8 @@ sub sig_available {
|
||||||
$response_out->{$station}->{station} = "$station";
|
$response_out->{$station}->{station} = "$station";
|
||||||
$response_out->{$station}->{authed} = "$authed";
|
$response_out->{$station}->{authed} = "$authed";
|
||||||
$response_out->{$station}->{uri_operator} = "$dbt->{operator}->{$varenv->{dbname}}->{operatorApp}";
|
$response_out->{$station}->{uri_operator} = "$dbt->{operator}->{$varenv->{dbname}}->{operatorApp}";
|
||||||
$response_out->{$station}->{description} = "$resp->{site}->{address}" || "";
|
#$response_out->{$station}->{description} = "$resp->{site}->{address}" || "";
|
||||||
|
$response_out->{$station}->{description} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$resp->{site}->{address})) || "";
|
||||||
$response_out->{$station}->{station_group} = ["SX300101"];#Lastenrad alias type_id
|
$response_out->{$station}->{station_group} = ["SX300101"];#Lastenrad alias type_id
|
||||||
$response_out->{$station}->{gps}->{latitude} = "$resp->{site}->{lat}" || "";
|
$response_out->{$station}->{gps}->{latitude} = "$resp->{site}->{lat}" || "";
|
||||||
$response_out->{$station}->{gps}->{longitude} = "$resp->{site}->{lon}" || "";
|
$response_out->{$station}->{gps}->{longitude} = "$resp->{site}->{lon}" || "";
|
||||||
|
@ -169,7 +169,7 @@ sub sig_available {
|
||||||
$bike_id =~ s/S[1-9]X/SX/;
|
$bike_id =~ s/S[1-9]X/SX/;
|
||||||
$bike_id = $1 if($bike_id =~ /(\d+)/);
|
$bike_id = $1 if($bike_id =~ /(\d+)/);
|
||||||
|
|
||||||
print FILE "bike_group $bike_id | $resp->{site}->{id} | @{$bike_group}[0]\n";
|
print FILE "bike-data $bike_id | $resp->{site}->{id} | @{$bike_group}[0]\n";
|
||||||
if($bike && looks_like_number($bike_id) && looks_like_number($resp->{site}->{id}) && ref($bike_group) eq "ARRAY" && @{$bike_group}[0]){
|
if($bike && looks_like_number($bike_id) && looks_like_number($resp->{site}->{id}) && ref($bike_group) eq "ARRAY" && @{$bike_group}[0]){
|
||||||
print FILE "Bike: $bike\n";
|
print FILE "Bike: $bike\n";
|
||||||
if($ctpos->{barcode} && $ctpos->{barcode} == $bike_id){
|
if($ctpos->{barcode} && $ctpos->{barcode} == $bike_id){
|
||||||
|
|
|
@ -185,7 +185,7 @@ sub update_operatorsloop {
|
||||||
#pseudo code copied fom net_booking. have to be done elsewehre because of $apif
|
#pseudo code copied fom net_booking. have to be done elsewehre because of $apif
|
||||||
if(1==2){
|
if(1==2){
|
||||||
my $ctadr = { c_id => $c_id };
|
my $ctadr = { c_id => $c_id };
|
||||||
my ($bike_group,$bike_node,$tariff_content,$user_tour);# = $apif->fetch_tariff($ctadr,"");
|
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash);# = $apif->fetch_tariff($ctadr,"");
|
||||||
foreach my $id (keys (%$tariff_content)){
|
foreach my $id (keys (%$tariff_content)){
|
||||||
# #int18
|
# #int18
|
||||||
#<sharing_type>
|
#<sharing_type>
|
||||||
|
|
|
@ -161,6 +161,8 @@ sub save_contenttranspos {
|
||||||
$update_pos->{int10} = $R::int10 if(looks_like_number($R::int10));
|
$update_pos->{int10} = $R::int10 if(looks_like_number($R::int10));
|
||||||
$update_pos->{int20} = $R::int20 if(looks_like_number($R::int20));
|
$update_pos->{int20} = $R::int20 if(looks_like_number($R::int20));
|
||||||
$update_pos->{int04} = $R::int04 if(looks_like_number($R::int04));
|
$update_pos->{int04} = $R::int04 if(looks_like_number($R::int04));
|
||||||
|
$update_pos->{int07} = $R::int07 if(looks_like_number($R::int07));
|
||||||
|
$update_pos->{int08} = $R::int08 if(looks_like_number($R::int08));
|
||||||
|
|
||||||
$update_pos->{txt01} = $q->escapeHTML($R::txt01) if($R::txt01);
|
$update_pos->{txt01} = $q->escapeHTML($R::txt01) if($R::txt01);
|
||||||
$update_pos->{txt23} = $q->escapeHTML($R::txt23) if($R::txt23);
|
$update_pos->{txt23} = $q->escapeHTML($R::txt23) if($R::txt23);
|
||||||
|
|
|
@ -42,11 +42,12 @@ 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")){
|
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 $coo = $q->cookie('domcookie') || $q->param('sessionid') || "";
|
||||||
|
|
||||||
# my $api_test = "sharee_fr01"; my $bike="FR1538";
|
#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_fr01"; my $bike="FR4781";#Tracking and BVB test
|
||||||
#my $api_test = "sharee_kn"; my $bike="KN205";
|
#my $api_test = "sharee_kn"; my $bike="KN205";
|
||||||
#my $api_test = "sharee_wue"; my $bike="WUE5525";
|
#my $api_test = "sharee_wue"; my $bike="WUE5525";
|
||||||
my $api_test = "sharee_sx"; my $bike="S3X1001";
|
#my $api_test = "sharee_sx"; my $bike="S3X1001";
|
||||||
#my $api_test = "sharee_ren"; my $bike="REN2";
|
#my $api_test = "sharee_ren"; my $bike="REN2";
|
||||||
|
|
||||||
print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"background-color:#ffffff;color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test\&bike=$bike", -target=>'_blank'}," [ tests --> $api_test ] "),"$users_sharee->{txt08}",$q->a({-style=>"color:#$bgcolor1;", -href=>"logout_sharee$session"},"logout")),"\n";
|
print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"background-color:#ffffff;color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test\&bike=$bike", -target=>'_blank'}," [ tests --> $api_test ] "),"$users_sharee->{txt08}",$q->a({-style=>"color:#$bgcolor1;", -href=>"logout_sharee$session"},"logout")),"\n";
|
||||||
|
|
Loading…
Add table
Reference in a new issue