mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 03:36:30 +01:00
station caching
This commit is contained in:
parent
0ce7c7bea5
commit
397c3b1917
7 changed files with 361 additions and 212 deletions
|
@ -884,92 +884,6 @@ sub service_work {
|
|||
}#end service_work
|
||||
|
||||
|
||||
#check and set user-bike rental tarif
|
||||
sub fetch_bike_tariff {
|
||||
my $self = shift;
|
||||
my $varenv = shift;
|
||||
my $auth = shift;
|
||||
my $bike = shift;
|
||||
my $owner = shift;
|
||||
|
||||
my $bike_id = $bike || "";
|
||||
$bike_id =~ s/S[1-9]X/SX/;
|
||||
$bike_id = $1 if($bike_id =~ /(\d+)/);
|
||||
|
||||
my $main_ids = "";
|
||||
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,"");
|
||||
$main_ids = join(",",@{$bike_node});
|
||||
$main_ids =~ s/[a-z_]+//ig;
|
||||
my $ct_bike = {};
|
||||
my $pref_cc = {
|
||||
table => "content",
|
||||
fetch => "one",
|
||||
main_id => "IN::($main_ids)",
|
||||
barcode => $bike_id,
|
||||
template_id => 205,
|
||||
#int10 => 1,
|
||||
};
|
||||
|
||||
$ct_bike = $dbt->fetch_record($dbh,$pref_cc) if($main_ids);
|
||||
|
||||
#$tariff_nr in contentadr are saved by copri or user tarif-select!!!
|
||||
my $tariff_nr = "";
|
||||
my @adr_tariff = ();
|
||||
if($auth->{txt30}){
|
||||
@adr_tariff = ("$auth->{txt30}");
|
||||
@adr_tariff = split(/\s+/,$auth->{txt30}) if($auth->{txt30} =~ /\w\s+\w/);
|
||||
}
|
||||
|
||||
#This is the automatic user tariff setter
|
||||
if(ref($ct_bike) eq "HASH" && $ct_bike->{main_id}){
|
||||
foreach my $id (keys (%$tariff_content)){
|
||||
foreach(@adr_tariff){
|
||||
$bw->log("booking_request adr_tariff array form $auth->{txt30}",$_,"");
|
||||
if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{int12} == $ct_bike->{main_id} && $tariff_content->{$id}->{barcode} && $_ == $tariff_content->{$id}->{barcode}){
|
||||
$bw->log("booking_request tariff loop matches:",$tariff_content->{$id}->{barcode},"");
|
||||
$tariff_nr = $tariff_content->{$id}->{barcode};
|
||||
}
|
||||
}
|
||||
}
|
||||
#if no tarif then update user account to fallback default public or private or hidden tarif
|
||||
if(!$tariff_nr){
|
||||
|
||||
my $update_adr = {
|
||||
table => "contentadr",
|
||||
mtime => "now()",
|
||||
owner => "$owner",
|
||||
c_id => "$auth->{c_id}",
|
||||
};
|
||||
|
||||
my @txt30 = ();
|
||||
foreach my $id (keys (%$tariff_content)){
|
||||
#</sharing_type>
|
||||
if($tariff_content->{$id}->{int18} && ($tariff_content->{$id}->{int18} == 2 || $tariff_content->{$id}->{int18} == 3 || $tariff_content->{$id}->{int18} == 4)){
|
||||
|
||||
#auto set tarif if requested bike matches flot
|
||||
if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{int12} == $ct_bike->{main_id} && $tariff_content->{$id}->{barcode}){
|
||||
$bw->log("booking_request tariff loop matches:",$tariff_content->{$id}->{barcode},"");
|
||||
$tariff_nr = $tariff_content->{$id}->{barcode};
|
||||
push(@txt30, "$tariff_content->{$id}->{barcode}");
|
||||
}
|
||||
#add also other public tarif
|
||||
elsif($tariff_content->{$id}->{int18} && $tariff_content->{$id}->{int18} == 2 && $tariff_content->{$id}->{int12} && $tariff_content->{$id}->{barcode}){
|
||||
push(@txt30, "$tariff_content->{$id}->{barcode}");
|
||||
}
|
||||
}
|
||||
}
|
||||
$bw->log("booking_request NO user tariff defined, update user account to fallback default public or private or hidden",\@txt30,"");
|
||||
$dbt->update_one($dbh,$update_adr,"txt30='@txt30'");
|
||||
}else{
|
||||
$bw->log("booking_request user tariff selected",$tariff_nr,"");
|
||||
}
|
||||
}
|
||||
|
||||
$bw->log("booking_request fetch_bike_tariff result ---> bike $ct_bike->{barcode} matching by bike_node: @{$bike_node} main_ids:$main_ids | bike_group by type_id:@{$bike_group} | Tarif selected: $tariff_nr",$tariff_content->{$tariff_nr}->{ct_name},"");
|
||||
|
||||
return ($ct_bike,$tariff_content->{$tariff_nr});
|
||||
}
|
||||
|
||||
#2022-04-05 refactored bike reservation
|
||||
sub booking_request(){
|
||||
my $self = shift;
|
||||
|
@ -1308,7 +1222,7 @@ sub booking_update(){
|
|||
my $geo_distance_next = 100000;
|
||||
my $station_next = 0;
|
||||
my $geo_debug="";
|
||||
my ($stations,$stations_raw) = $self->stations_available($q,$varenv,$auth,$record_pos);
|
||||
my ($stations,$stations_raw) = $self->stations_available($q,$varenv,$auth,$record_pos,"");
|
||||
|
||||
foreach my $id (sort { $stations_raw->{$a}->{barcode} <=> $stations_raw->{$b}->{barcode} } keys (%$stations_raw)){
|
||||
my $latitude_station = $1 if($stations_raw->{$id}->{txt06} =~ /^(\d+\.\d+)/);
|
||||
|
@ -1996,6 +1910,7 @@ sub bikes_available(){
|
|||
#new rental_description
|
||||
$return->{$id}->{rental_description}->{name} = "$tariff_content->{$tid}->{ct_name}";
|
||||
$return->{$id}->{rental_description}->{id} = "$tariff_content->{$tid}->{barcode}";
|
||||
$return->{$id}->{rental_description}->{tarif_type} = "$adrtarif_hash->{$tariff_content->{$tid}->{barcode}}";
|
||||
$return->{$id}->{rental_description}->{reserve_timerange} = "15";
|
||||
$return->{$id}->{rental_description}->{reserve_timerange} = "30" if($record->{$id}->{int11} == 3);#sig timeout time
|
||||
$return->{$id}->{rental_description}->{rental_info}->{1} = ["Tracking","Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!"] if($record->{$id}->{int25});
|
||||
|
@ -2168,6 +2083,29 @@ sub bikes_all(){
|
|||
return ($op_return,$record,$bikes_on_station);
|
||||
}#end bikes_all
|
||||
|
||||
#station caching for each tarif
|
||||
sub stations_caching {
|
||||
my $self = shift;
|
||||
my $q = shift || "";
|
||||
my $varenv = shift;
|
||||
my $auth = shift || "";
|
||||
|
||||
my $tariff = {
|
||||
table => "content",
|
||||
fetch => "all",
|
||||
keyfield => "barcode",
|
||||
template_id => "210",#Tariff tpl_id
|
||||
};
|
||||
|
||||
my $tariff_all = $dbt->fetch_record($dbh,$tariff);
|
||||
if(ref($tariff_all) eq "HASH"){
|
||||
foreach my $cachme (keys (%$tariff_all)){
|
||||
$self->stations_available($q,$varenv,$auth,"",$cachme);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#stations_available
|
||||
sub stations_available(){
|
||||
my $self = shift;
|
||||
|
@ -2175,11 +2113,12 @@ sub stations_available(){
|
|||
my $varenv = shift;
|
||||
my $auth = shift || "";
|
||||
my $record_pos = shift || {};
|
||||
|
||||
my $cachme = shift || 0;
|
||||
|
||||
my $authed = 0;
|
||||
$authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id});
|
||||
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
||||
my $authcookie = $q->param('authcookie') || $q->cookie('domcookie');
|
||||
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$authcookie,$cachme);
|
||||
|
||||
$bw->log("fetch_tariff adrtarif_hash from $varenv->{dbname}\n",$adrtarif_hash,"");
|
||||
|
||||
|
@ -2278,10 +2217,6 @@ sub stations_available(){
|
|||
my $record_bikes = {};
|
||||
$record_bikes = $dbt->fetch_record($dbh,$bpref,"");
|
||||
|
||||
#user_rental_count
|
||||
my $record_rentals = {};
|
||||
$record_rentals = $self->user_bikes_occupied($dbh,$auth,"") if($auth->{c_id});
|
||||
|
||||
my $hotline_hash = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
|
@ -2303,14 +2238,6 @@ sub stations_available(){
|
|||
}
|
||||
$return->{$id}->{bike_count} = "$bike_count";
|
||||
|
||||
my $user_rental_count = 0;
|
||||
foreach my $r_id (keys (%$record_rentals)){
|
||||
if($record->{$id}->{int04} == $record_rentals->{$r_id}->{int06}){
|
||||
$user_rental_count++;
|
||||
}
|
||||
}
|
||||
$return->{$id}->{user_rental_count} = "$user_rental_count";
|
||||
|
||||
$return->{$id}->{uri_operator} = "$varenv->{wwwhost}";
|
||||
|
||||
$return->{$id}->{authed} = "$authed";
|
||||
|
@ -2341,22 +2268,41 @@ sub stations_available(){
|
|||
$return->{$id}->{operator_data}->{operator_phone} = $hotline_data->{txt07} if($hotline_data->{txt07});
|
||||
$return->{$id}->{operator_data}->{operator_email} = $hotline_data->{txt08} if($hotline_data->{txt08});
|
||||
|
||||
$return->{$id}->{cached} = "0";
|
||||
$op_return->{$dbt->{operator}->{$varenv->{dbname}}->{oprefix} . $id} = $return->{$id};
|
||||
}
|
||||
}
|
||||
|
||||
#json caching
|
||||
#call "stations_available" after each station state change
|
||||
my $public_user = 1;
|
||||
foreach my $atid (keys (%$adrtarif_hash)){
|
||||
$public_user = 0 if($adrtarif_hash->{$atid} == 1);
|
||||
}
|
||||
|
||||
if($dbt->{operator}->{$varenv->{dbname}}->{cache_station} == 1 && $public_user == 1){
|
||||
my $stationsout = $json->pretty->encode({ shareejson => { stations => $op_return } });
|
||||
open(CACHE,">$dbt->{copri_conf}->{basedir}/$dbt->{primary}->{sharee_primary}->{dir_app}/json/stations-$dbt->{operator}->{$varenv->{dbname}}->{oprefix}.json");
|
||||
print CACHE $stationsout;
|
||||
close(CACHE);
|
||||
|
||||
#json caching
|
||||
if($dbt->{operator}->{$varenv->{dbname}}->{cache_station} == 1 && $cachme){
|
||||
$return->{$id}->{withpub} = "0";
|
||||
|
||||
#order by sharing_type
|
||||
foreach my $tarif_key (keys(%$adrtarif_hash)){
|
||||
$return->{$id}->{withpub}= "1" if($adrtarif_hash->{$tarif_key} == 2 || $adrtarif_hash->{$tarif_key} == 5);
|
||||
$return->{$id}->{cached} = "$cachme";
|
||||
$op_return->{$dbt->{operator}->{$varenv->{dbname}}->{oprefix} . $id} = $return->{$id};
|
||||
#my $stationsout = $json->pretty->encode({ shareejson => { stations => $op_return } });
|
||||
my $stationsout = $json->pretty->encode($op_return);
|
||||
|
||||
if($cachme){
|
||||
#not public
|
||||
if($adrtarif_hash->{$tarif_key} == 3 || $adrtarif_hash->{$tarif_key} == 4){
|
||||
$bw->log("tarif_key: $tarif_key, sharing_type: $adrtarif_hash->{$tarif_key} Trigger json-caching stations-$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$tarif_key.json by cachme:$cachme","","");
|
||||
open(CACHE,">$dbt->{copri_conf}->{basedir}/$dbt->{operator}->{$varenv->{dbname}}->{dir_app}/json/stations-$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$tarif_key.json");
|
||||
print CACHE $stationsout;
|
||||
close(CACHE);
|
||||
}
|
||||
#public
|
||||
else{
|
||||
$bw->log("tarif_key: $tarif_key, sharing_type: $adrtarif_hash->{$tarif_key} Trigger json-caching stations-$dbt->{operator}->{$varenv->{dbname}}->{oprefix}.json by cachme:$cachme","","");
|
||||
open(CACHE,">$dbt->{copri_conf}->{basedir}/$dbt->{operator}->{$varenv->{dbname}}->{dir_app}/json/stations-$dbt->{operator}->{$varenv->{dbname}}->{oprefix}.json");
|
||||
print CACHE $stationsout;
|
||||
close(CACHE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}#end caching
|
||||
}
|
||||
}
|
||||
|
||||
return ($op_return, $record);
|
||||
|
@ -2521,12 +2467,13 @@ sub fetch_tariff(){
|
|||
my $dbname = shift;
|
||||
my $adr = shift || {};
|
||||
my $authcookie = shift || "";
|
||||
my $cachme = shift || 0;
|
||||
|
||||
my $merchant_id = "";
|
||||
$merchant_id = $1 if($authcookie && $authcookie =~ /\w+_(\w+)$/);
|
||||
my $tariff_content = "";
|
||||
my $tariff_all = "";
|
||||
my @user_tour = ();
|
||||
my $auth_operator = { c_id => 0 };
|
||||
my $auth_operator = { c_id => 0, txt30 => "" };
|
||||
|
||||
#int18
|
||||
#<sharing_type>
|
||||
|
@ -2544,11 +2491,23 @@ sub fetch_tariff(){
|
|||
|
||||
my ($nodes,$rows) = $dbt->collect_node($dbh,$dbt->{shareedms_conf}->{waren});
|
||||
|
||||
#if no primary address then only 2=public
|
||||
if((ref($adr) ne "HASH" || !$adr->{c_id}) && ($dbname ne "sharee_lv")){
|
||||
#public caching
|
||||
if($cachme eq "public"){
|
||||
$tariff->{int18} = 2;
|
||||
$tariff_content = $dbt->fetch_record($dbh,$tariff);
|
||||
$bw->log("1. Tariff type $tariff->{int18} select on",$dbname,"");
|
||||
$tariff_all = $dbt->fetch_record($dbh,$tariff);
|
||||
$bw->log("$dbname $cachme Tariff type for No operator registered user by int18:$tariff->{int18} select 1:",$tariff_all,"");
|
||||
}
|
||||
elsif(looks_like_number($cachme) && $cachme > 0){
|
||||
$tariff->{barcode} = $cachme;
|
||||
$tariff_all = $dbt->fetch_record($dbh,$tariff);
|
||||
$auth_operator = { txt30 => "$cachme" };
|
||||
$bw->log("$dbname $cachme Tariff type for No operator registered user by barcode:$tariff->{barcode} select 2:",$tariff_all,"");
|
||||
}
|
||||
#if no primary address then only 2=public
|
||||
elsif((ref($adr) ne "HASH" || !$adr->{c_id}) && ($dbname ne "sharee_lv")){
|
||||
$tariff->{int18} = 2;
|
||||
$tariff_all = $dbt->fetch_record($dbh,$tariff);
|
||||
$bw->log("$dbname Tariff type for No operator registered user by int18:$tariff->{int18} select 3:",$tariff_all,"");
|
||||
}
|
||||
#select operators address to get users tarifnr array in txt30
|
||||
elsif(ref($adr) eq "HASH" && $adr->{c_id}){
|
||||
|
@ -2562,7 +2521,7 @@ sub fetch_tariff(){
|
|||
$auth_operator = $dbt->fetch_record($dbh,$authref);
|
||||
|
||||
#shareetool user_tour
|
||||
if($merchant_id && $dbt->{merchant_ids}->{$merchant_id}->{id} && $dbt->{merchant_ids}->{$merchant_id}->{id} == 187){
|
||||
if($auth_operator->{c_id} && $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");
|
||||
if($users_serviceapp->{int09}){
|
||||
$auth_operator->{txt18} =~ s/(\d+)/$dbt->{operator}->{$dbname}->{oprefix}$1/g;
|
||||
|
@ -2571,66 +2530,161 @@ sub fetch_tariff(){
|
|||
}
|
||||
}#end user_tour
|
||||
|
||||
$tariff->{int18} = 4 if($dbname eq "sharee_lv");
|
||||
|
||||
$tariff_content = $dbt->fetch_record($dbh,$tariff);
|
||||
$bw->log("2. Tariff type $tariff->{int18} select on",$dbname,"");
|
||||
#4=hidden
|
||||
if($dbname eq "sharee_lv"){
|
||||
if($auth_operator->{txt30}){
|
||||
$tariff->{int18} = 4;
|
||||
}else{
|
||||
$tariff->{int18} = 9;#disables because not defined
|
||||
}
|
||||
}
|
||||
#else select all available user tarif entries
|
||||
$tariff_all = $dbt->fetch_record($dbh,$tariff);
|
||||
$bw->log("$dbname Tariff type for operator registered user by int18:$tariff->{int18} select 4:",$tariff_all,"");
|
||||
}
|
||||
#end operators address
|
||||
else{
|
||||
$bw->log("3. NO tariff_content on",$dbname,"");
|
||||
$bw->log("$dbname Tariff type NO tariff_all 4:","","");
|
||||
}
|
||||
|
||||
my $oprefix = "";
|
||||
$oprefix = "$dbt->{operator}->{$dbname}->{oprefix}" if($dbt->{operator}->{$dbname}->{oprefix});
|
||||
|
||||
#2022-07-16 refactored
|
||||
#2023-03-13, just hash all tarif_type by tarif-Nr
|
||||
#collect setted user tarifs and available public tarifs
|
||||
my %tarif_hash = ();
|
||||
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)){
|
||||
#public or public-bonus tarifs are public viewable stations
|
||||
if($tariff_content->{$tid}->{int18} && ($tariff_content->{$tid}->{int18} == 2 || $tariff_content->{$tid}->{int18} == 5)){
|
||||
$adrtarif_hash{$tariff_content->{$tid}->{barcode}} = 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
|
||||
}
|
||||
}
|
||||
}
|
||||
if($auth_operator->{txt30} && $auth_operator->{txt30} =~ /\d\s\d/){
|
||||
%tarif_hash = map { $_ => 1 } split(/\s+/,$auth_operator->{txt30});
|
||||
}elsif($auth_operator->{txt30}){
|
||||
$tarif_hash{$auth_operator->{txt30}} = 1;
|
||||
}
|
||||
|
||||
if(ref($tariff_all) eq "HASH"){
|
||||
foreach my $rid (keys (%$tariff_all)){
|
||||
if(ref(\%tarif_hash) eq "HASH" && $tarif_hash{$tariff_all->{$rid}->{barcode}}){
|
||||
foreach my $tk (keys(%tarif_hash)){
|
||||
$bw->log("Tarif FOUND condition: $tk && $rid && $tariff_all->{$rid}->{barcode} == $tk","","");
|
||||
|
||||
if($tk && $rid && $tariff_all->{$rid}->{barcode} == $tk){
|
||||
$adrtarif_hash{$tariff_all->{$rid}->{barcode}} = $tariff_all->{$rid}->{int18} if($tariff_all->{$rid}->{int18});
|
||||
$bw->log("Tarif FOUND with merchant $merchant_id with user-id $auth_operator->{c_id} if($tariff_all->{$rid}->{int12}) (s-type:$tariff_all->{$rid}->{int18})",$tariff_all->{$rid}->{barcode},"");
|
||||
$bike_node{$oprefix . $tariff_all->{$rid}->{int12}} = 1;#sharee bike_node.main_id
|
||||
my $type_id = $nodes->{$tariff_all->{$rid}->{int12}}->{type_id} || "";
|
||||
$bike_group{$oprefix . $type_id} = 1 if($type_id);#sharee bike_node.type_id
|
||||
}
|
||||
}
|
||||
}elsif($tariff_all->{$rid}->{int18} == 2){
|
||||
$adrtarif_hash{$tariff_all->{$rid}->{barcode}} = $tariff_all->{$rid}->{int18};
|
||||
$bw->log("Tarif FOUND with merchant $merchant_id without user-id! if($tariff_all->{$rid}->{int12}) (s-type:$tariff_all->{$rid}->{int18})",$tariff_all->{$rid}->{barcode},"");
|
||||
$bike_node{$oprefix . $tariff_all->{$rid}->{int12}} = 1;#sharee bike_node.main_id
|
||||
my $type_id = $nodes->{$tariff_all->{$rid}->{int12}}->{type_id} || "";
|
||||
$bike_group{$oprefix . $type_id} = 1 if($type_id);#sharee bike_node.type_id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my @tarifnr = ();
|
||||
my @bike_node = ();
|
||||
my @bike_group = ();
|
||||
@tarifnr = keys %tarifnr;
|
||||
@tarifnr = keys %adrtarif_hash;
|
||||
@bike_node = keys %bike_node;
|
||||
@bike_group = keys %bike_group;
|
||||
|
||||
$bw->log("FETCHED_Tarif by dbname:$dbname with merchant $merchant_id and optional userID $adr->{c_id} | bike_node:@bike_node | bike_group:@bike_group | user_tour:@user_tour | tarifnr: @tarifnr",\%adrtarif_hash,"");
|
||||
return (\@bike_group,\@bike_node,\@user_tour,$tariff_content,\%adrtarif_hash);
|
||||
}
|
||||
$bw->log("Tarif FOUND FETCHED_Tarif by dbname:$dbname with merchant $merchant_id and optional userID $adr->{c_id} | bike_node:@bike_node | bike_group:@bike_group | user_tour:@user_tour | tarifnr: @tarifnr",\%adrtarif_hash,"");
|
||||
return (\@bike_group,\@bike_node,\@user_tour,$tariff_all,\%adrtarif_hash);
|
||||
}#end fetch_tariff
|
||||
|
||||
|
||||
#check and set user-bike rental tarif
|
||||
sub fetch_bike_tariff {
|
||||
my $self = shift;
|
||||
my $varenv = shift;
|
||||
my $auth = shift;
|
||||
my $bike = shift;
|
||||
my $owner = shift;
|
||||
|
||||
my $bike_id = $bike || "";
|
||||
$bike_id =~ s/S[1-9]X/SX/;
|
||||
$bike_id = $1 if($bike_id =~ /(\d+)/);
|
||||
|
||||
my $main_ids = "";
|
||||
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,"");
|
||||
$main_ids = join(",",@{$bike_node});
|
||||
$main_ids =~ s/[a-z_]+//ig;
|
||||
my $ct_bike = {};
|
||||
my $pref_cc = {
|
||||
table => "content",
|
||||
fetch => "one",
|
||||
main_id => "IN::($main_ids)",
|
||||
barcode => $bike_id,
|
||||
template_id => 205,
|
||||
#int10 => 1,
|
||||
};
|
||||
|
||||
$ct_bike = $dbt->fetch_record($dbh,$pref_cc) if($main_ids);
|
||||
|
||||
#$tariff_nr in contentadr are saved by copri or user tarif-select!!!
|
||||
my $tariff_nr = "";
|
||||
my @adr_tariff = ();
|
||||
if($auth->{txt30}){
|
||||
@adr_tariff = ("$auth->{txt30}");
|
||||
@adr_tariff = split(/\s+/,$auth->{txt30}) if($auth->{txt30} =~ /\w\s+\w/);
|
||||
}
|
||||
|
||||
#This is the automatic user tariff setter
|
||||
if(ref($ct_bike) eq "HASH" && $ct_bike->{main_id}){
|
||||
foreach my $id (keys (%$tariff_content)){
|
||||
foreach(@adr_tariff){
|
||||
$bw->log("booking_request adr_tariff array form $auth->{txt30}",$_,"");
|
||||
if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{int12} == $ct_bike->{main_id} && $tariff_content->{$id}->{barcode} && $_ == $tariff_content->{$id}->{barcode}){
|
||||
$bw->log("booking_request tariff loop matches:",$tariff_content->{$id}->{barcode},"");
|
||||
$tariff_nr = $tariff_content->{$id}->{barcode};
|
||||
}
|
||||
}
|
||||
}
|
||||
#if no tarif then update user account to fallback default public or private or hidden tarif
|
||||
if(!$tariff_nr){
|
||||
|
||||
my $update_adr = {
|
||||
table => "contentadr",
|
||||
mtime => "now()",
|
||||
owner => "$owner",
|
||||
c_id => "$auth->{c_id}",
|
||||
};
|
||||
|
||||
my @txt30 = ();
|
||||
foreach my $id (keys (%$tariff_content)){
|
||||
#</sharing_type>
|
||||
if($tariff_content->{$id}->{int18} && ($tariff_content->{$id}->{int18} == 2 || $tariff_content->{$id}->{int18} == 3 || $tariff_content->{$id}->{int18} == 4)){
|
||||
|
||||
#auto set tarif if requested bike matches flot
|
||||
if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{int12} == $ct_bike->{main_id} && $tariff_content->{$id}->{barcode}){
|
||||
$bw->log("booking_request tariff loop matches:",$tariff_content->{$id}->{barcode},"");
|
||||
$tariff_nr = $tariff_content->{$id}->{barcode};
|
||||
push(@txt30, "$tariff_content->{$id}->{barcode}");
|
||||
}
|
||||
#add also other public tarif
|
||||
elsif($tariff_content->{$id}->{int18} && $tariff_content->{$id}->{int18} == 2 && $tariff_content->{$id}->{int12} && $tariff_content->{$id}->{barcode}){
|
||||
push(@txt30, "$tariff_content->{$id}->{barcode}");
|
||||
}
|
||||
}
|
||||
}
|
||||
$bw->log("booking_request NO user tariff defined, update user account to fallback default public or private or hidden",\@txt30,"");
|
||||
$dbt->update_one($dbh,$update_adr,"txt30='@txt30'");
|
||||
}else{
|
||||
$bw->log("booking_request user tariff selected",$tariff_nr,"");
|
||||
}
|
||||
}
|
||||
|
||||
$bw->log("booking_request fetch_bike_tariff result ---> bike $ct_bike->{barcode} matching by bike_node: @{$bike_node} main_ids:$main_ids | bike_group by type_id:@{$bike_group} | Tarif selected: $tariff_nr",$tariff_content->{$tariff_nr}->{ct_name},"");
|
||||
|
||||
return ($ct_bike,$tariff_content->{$tariff_nr});
|
||||
}#fetch_bike_tariff
|
||||
|
||||
|
||||
#authout
|
||||
sub authout(){
|
||||
|
@ -2952,13 +3006,13 @@ sub auth_verify(){
|
|||
}
|
||||
|
||||
#if any no public user on request, then don't generate cache
|
||||
my $public_user = 1;
|
||||
if(ref($adrtarif_hash) eq "HASH"){
|
||||
foreach my $atid (keys (%$adrtarif_hash)){
|
||||
$public_user = 0 if($adrtarif_hash->{$atid} == 1);
|
||||
}
|
||||
}
|
||||
$return->{public_user} = "$public_user";
|
||||
#my $public_user = 1;
|
||||
#if(ref($adrtarif_hash) eq "HASH"){
|
||||
# foreach my $atid (keys (%$adrtarif_hash)){
|
||||
# $public_user = 0 if($adrtarif_hash->{$atid} == 1);
|
||||
# }
|
||||
#}
|
||||
#$return->{public_user} = "$public_user";
|
||||
|
||||
print FILE "final return: $return->{authcookie}\n" if($debug);
|
||||
|
||||
|
|
|
@ -67,8 +67,13 @@ sub loop_sharees {
|
|||
my @user_group = ();
|
||||
my @user_tour = ();
|
||||
my $fetch_hash = {};
|
||||
my $o=0;
|
||||
while (my ($key, $op_name) = each %{ $globalconf{operator} }) {
|
||||
my $ret_json = "";
|
||||
my %ret_json_all = ();
|
||||
my %ret_json_private = ();
|
||||
my %ret_json_public = ();
|
||||
my %withpub = ();
|
||||
|
||||
#shareetool, to loop only operators who is the shareetool by usersconf enabled
|
||||
my $users_serviceapp = { u_id => 0 };
|
||||
|
@ -79,26 +84,107 @@ sub loop_sharees {
|
|||
}
|
||||
#every sharee client must have a merchant_id which associate a project
|
||||
if($op_name->{operatorApp} && ($users_serviceapp->{u_id} || $return_merchant->{merchant_id} eq $globalconf{website}->{'shareeweb-sharee'}->{merchant_id} || ($return_merchant->{project_id} eq $op_name->{project}))){
|
||||
|
||||
$o++;
|
||||
if($rest_hash->{request} eq "stations_available"){
|
||||
push(@uri_operator_array, $op_name->{operatorApp});
|
||||
#station caching (empty user_group)
|
||||
##TODO check private public hidden ....
|
||||
#FIXME $auth->{public_user}
|
||||
if(1==2 && $op_name->{cache_station} == 1 && $auth->{public_user} == 1 && $rest_hash->{request} eq "stations_available"){
|
||||
my $primary_cache = "$globalconf{primary}->{sharee_primary}->{primaryApp}/json/stations-$op_name->{oprefix}.json";
|
||||
$ret_json = $self->fetch_operator_json("$primary_cache","");
|
||||
#print "$primary_cache" . "\n" . Dumper($ret_json);
|
||||
|
||||
eval {
|
||||
my $response_in = "";
|
||||
$response_in = decode_json($ret_json);
|
||||
};
|
||||
if ($@){
|
||||
$ret_json = $self->fetch_operator_json("$op_name->{operatorApp}/APIjsonserver",$rest);
|
||||
#print "$op_name->{operatorApp}/APIjsonserver?$rest" . "\n" . Dumper($ret_json);
|
||||
}
|
||||
#if disabled, reads DB
|
||||
if($op_name->{cache_station} == 1){
|
||||
#primary authraw
|
||||
if($authraw->{txt30}){
|
||||
my %prim_tarif_hash = ();
|
||||
if($authraw->{txt30} =~ /\w\s\w/){
|
||||
%prim_tarif_hash = map { $_ => 1 } split(/\s+/,$authraw->{txt30});
|
||||
}elsif($authraw->{txt30}){
|
||||
$prim_tarif_hash{$authraw->{txt30}} = 1;
|
||||
}
|
||||
foreach my $optarif (keys(%prim_tarif_hash)){
|
||||
my $op_key = "";
|
||||
my $tarif_key = "";
|
||||
if($optarif =~ /([A-Z]+)(\d+)/){
|
||||
$op_key = $1;
|
||||
$tarif_key = $2;
|
||||
}
|
||||
if($op_key && $op_key eq $op_name->{oprefix}){
|
||||
#print $optarif . "---" . $op_name->{oprefix} . "\n";
|
||||
$ret_json_private{$optarif} = $self->fetch_operator_json("$op_name->{operatorApp}/json/stations-$optarif.json","");
|
||||
eval {
|
||||
$bw->log("$o $key) Test Decode json-caching, using 1: $op_name->{operatorApp}/json/stations-$optarif.json","","");
|
||||
my $response_in = "";
|
||||
$response_in = decode_json($ret_json_private{$optarif});
|
||||
};
|
||||
if ($@){
|
||||
$bw->log("$o $key) Failure Test reading json-caching, using fallback 1 and generate cache just-in-time: $op_name->{operatorApp}/APIjsonserver?$rest&cachme=$tarif_key",$ret_json,"");
|
||||
#$ret_json_private{$optarif} = $self->fetch_operator_json("$op_name->{operatorApp}/APIjsonserver",$rest);
|
||||
$self->fetch_operator_json("$op_name->{operatorApp}/APIjsonserver","$rest&cachme=$tarif_key");
|
||||
$ret_json_private{$optarif} = $self->fetch_operator_json("$op_name->{operatorApp}/json/stations-$optarif.json","");
|
||||
}
|
||||
}
|
||||
%ret_json_all = %ret_json_private;
|
||||
}
|
||||
}#primary private Tarifs
|
||||
|
||||
$withpub{$op_name->{oprefix}} = 0;
|
||||
foreach my $optarif (keys(%ret_json_all)){
|
||||
my $opx = $1 if($optarif =~ /([A-Z]+)(\d+)/);
|
||||
if($op_name->{oprefix} eq $opx){
|
||||
eval {
|
||||
$bw->log("$o $key) Test Decode json-caching, using 2: ret_json_private hash","","");
|
||||
my $response_in = "";
|
||||
$response_in = decode_json($ret_json_all{$optarif});
|
||||
foreach my $station (keys (%{ $response_in })) {
|
||||
$withpub{$op_name->{oprefix}} = $response_in->{$station}->{withpub};
|
||||
}
|
||||
};
|
||||
if ($@){
|
||||
$bw->log("$o $key) Failure Test reading json-caching, No fallback for ret_json_private hash","","");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#print "$op_name->{oprefix}: $withpub{$op_name->{oprefix}}\n";
|
||||
if($withpub{$op_name->{oprefix}} || $op_name->{withpub}){
|
||||
$ret_json_public{$op_name->{oprefix}} = $self->fetch_operator_json("$op_name->{operatorApp}/json/stations-$op_name->{oprefix}.json","");
|
||||
eval {
|
||||
$bw->log("$o $key) Test Decode json-caching, using 3: $op_name->{operatorApp}/json/stations-$op_name->{oprefix}.json","","");
|
||||
my $response_in = "";
|
||||
$response_in = decode_json($ret_json_public{$op_name->{oprefix}});
|
||||
};
|
||||
if ($@){
|
||||
$bw->log("$o $key) Failure Test reading json-caching, using fallback 3 and generate cache just-in-time: $op_name->{operatorApp}/APIjsonserver?$rest&cachme=public",$ret_json,"");
|
||||
#$ret_json_public{$op_name->{oprefix}} = $self->fetch_operator_json("$op_name->{operatorApp}/APIjsonserver",$rest);
|
||||
$self->fetch_operator_json("$op_name->{operatorApp}/APIjsonserver","$rest&cachme=public");
|
||||
$ret_json_public{$op_name->{oprefix}} = $self->fetch_operator_json("$op_name->{operatorApp}/json/stations-$op_name->{oprefix}.json","");
|
||||
}
|
||||
%ret_json_all = ( %ret_json_all, %ret_json_public );
|
||||
}
|
||||
|
||||
foreach my $optarif (keys(%ret_json_all)){
|
||||
if($ret_json_all{$optarif}){
|
||||
eval {
|
||||
$bw->log("$o $key) Test Decode json-caching, using 3: ret_json_all hash","","");
|
||||
my $response_in = "";
|
||||
$response_in = decode_json($ret_json_all{$optarif});
|
||||
foreach my $result (keys (%{ $response_in })) {
|
||||
$fetch_hash->{$result} = $response_in->{$result};
|
||||
}
|
||||
};
|
||||
if ($@){
|
||||
$bw->log("$o $key) Failure Test reading json-caching, No fallback for ret_json_all hash","","");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}#end caching_stations
|
||||
else{
|
||||
$ret_json = $self->fetch_operator_json("$op_name->{operatorApp}/APIjsonserver",$rest);
|
||||
$bw->log("$o $key) Caching disabled, No reading json-caching, taking: $op_name->{operatorApp}/APIjsonserver?$rest",$ret_json,"");
|
||||
}
|
||||
|
||||
$ret_json = $self->fetch_operator_json("$op_name->{operatorApp}/APIjsonserver",$rest);
|
||||
|
||||
}#end stations_available
|
||||
else{
|
||||
$ret_json = $self->fetch_operator_json("$op_name->{operatorApp}/APIjsonserver",$rest);
|
||||
}
|
||||
|
||||
if($ret_json){
|
||||
push(@uri_operator_array, $op_name->{operatorApp});
|
||||
|
@ -138,11 +224,11 @@ sub loop_sharees {
|
|||
}
|
||||
};
|
||||
if ($@){
|
||||
$bw->log("Failure, eval json from jsonclient","","");
|
||||
$bw->log("$o $key) Failure, eval json from jsonclient",$ret_json,"");
|
||||
warn $@;
|
||||
}
|
||||
}else{
|
||||
$bw->log("NO json from Operator:",$op_name->{operatorApp},"");
|
||||
$bw->log("$o $key) NO json from Operator:",$op_name->{operatorApp},"");
|
||||
}
|
||||
#$bw->log("--> LOOP-end jsonclient loop_sharees user_group:\n",\@user_group,"");
|
||||
}
|
||||
|
|
|
@ -276,6 +276,7 @@ elsif($q->param('request') eq "booking_request"){
|
|||
$sig_book->{rentalId} = "$R::rentalId" if($R::rentalId);#only for cmd tests
|
||||
}
|
||||
$response_book = $apif->booking_request($q,\%varenv,$authraw,$bike,$ct_bike,$ct_tariff,$aowner,$gps,$sig_book);
|
||||
$apif->stations_caching($q,\%varenv,$authraw);
|
||||
}
|
||||
|
||||
#just in time booking
|
||||
|
@ -368,6 +369,7 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
|||
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
|
||||
}else{
|
||||
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,"");
|
||||
$apif->stations_caching($q,\%varenv,$authraw);
|
||||
}
|
||||
$response = {%$response, %$booking_values};
|
||||
|
||||
|
@ -397,6 +399,7 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
|||
#update on Ilockit
|
||||
}else{
|
||||
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
|
||||
$apif->stations_caching($q,\%varenv,$authraw);
|
||||
$response = {%$response, %$booking_values};
|
||||
|
||||
my $record = $apif->user_bikes_occupied($dbh,$authraw,"");
|
||||
|
@ -729,7 +732,8 @@ elsif($q->param('request') eq "stations_available"){
|
|||
($response->{stations},my $return2copri->{stations}) = $si->sig_available($q,\%varenv,$authraw);
|
||||
$tk->sigstation_cupdate($return2copri->{stations});
|
||||
}else{
|
||||
($response->{stations}, my $response_raw) = $apif->stations_available($q,\%varenv,$authraw,"");
|
||||
my $cachme = $R::cachme || "";
|
||||
($response->{stations}, my $response_raw) = $apif->stations_available($q,\%varenv,$authraw,"",$cachme);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -152,9 +152,9 @@ sub update_operatorsloop {
|
|||
delete $record_primary->{txt15};#Bonusnr
|
||||
delete $record_primary->{int07};#Rabatt
|
||||
delete $record_primary->{txt18};#Service tour
|
||||
delete $record_primary->{int05};#Web-Login
|
||||
delete $record_primary->{int16};#payone-cron-interval
|
||||
delete $record_primary->{int19};#Ilockit Admin
|
||||
#delete $record_primary->{int05};#Web-Login
|
||||
#delete $record_primary->{int12};#Vde (remove delete for global setting)
|
||||
delete $record_primary->{int23};#mini_answer count will be saved on operator
|
||||
delete $record_primary->{txt29};#Sonstiges
|
||||
|
|
|
@ -365,14 +365,13 @@ sub handler {
|
|||
$feedb = $pl->new_content($q,$users_dms);
|
||||
}elsif($R::base_edit eq "save_content"){
|
||||
$feedb = $pl->save_content($q,$users_dms,$node_meta,$R::c_id) if(looks_like_number($R::c_id));
|
||||
$apif->stations_caching($q,\%varenv,$users_sharee) if($node_meta->{template_id} =~ /210|225/);
|
||||
}elsif($R::c_id && $R::base_edit eq "remove_chk4rel"){
|
||||
my $delete_key = "delete_content";
|
||||
$feedb->{message} = "failure::Datensatz wirklich löschen. ::?base_edit=$delete_key\&exit_box2=1\&c_id=$R::c_id ::löschen";
|
||||
}elsif($R::c_id && $R::base_edit eq "delete_content"){
|
||||
$feedb = $pl->delete_content($node_meta,$R::c_id);
|
||||
|
||||
#}elsif($R::rel_edit){
|
||||
#$return = $pm->maininit($users_dms);
|
||||
$apif->stations_caching($q,\%varenv,$users_sharee) if($node_meta->{template_id} =~ /210|225/);
|
||||
}
|
||||
}else{
|
||||
$feedb->{message} = "failure::Abbruch. Schreibender Zugriff \"Waren Stammdaten\" verweigert.";
|
||||
|
|
|
@ -604,7 +604,7 @@ EOF
|
|||
elsif($key =~ /int12/ && "$size" eq "select" && $node_meta->{tpl_id} == 210){#Flotte bike_group (bikenode.main_id)
|
||||
my @_valxx = ("");
|
||||
foreach my $rid (sort { $bike_nodes->{$a}->{node_name} cmp $bike_nodes->{$b}->{node_name} } keys (%$bike_nodes)){
|
||||
push (@_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $bike_nodes->{$rid}->{main_id}");
|
||||
push (@_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $dbt->{copri_conf}->{type_id}->{$bike_nodes->{$rid}->{type_id}}");
|
||||
}
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms',-colspan=>'1'},"$des");
|
||||
|
@ -746,14 +746,8 @@ EOF
|
|||
#my @_valxx_filter = ("");
|
||||
my @_valxx = ("");
|
||||
foreach my $rid (sort { $bike_nodes->{$a}->{node_name} cmp $bike_nodes->{$b}->{node_name} } keys (%$bike_nodes)){
|
||||
push (@_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $bike_nodes->{$rid}->{main_id}");
|
||||
#$station_filter_hash{$bike_nodes->{$rid}->{type_id}} = 1;
|
||||
push (@_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $dbt->{copri_conf}->{type_id}->{$bike_nodes->{$rid}->{type_id}}");
|
||||
}
|
||||
#foreach my $type_id (keys (%station_filter_hash)){
|
||||
# push (@_valxx_filter, "$type_id");
|
||||
#}
|
||||
#type_id will be set on submit by selected values
|
||||
#print $q->hidden(-name=>"txt25",-override=>1,-value=>"@_valxx_filter");
|
||||
|
||||
my $height = scalar(@_valxx);
|
||||
print $q->Tr();
|
||||
|
|
|
@ -429,7 +429,14 @@ EOF
|
|||
keyfield => "main_id",
|
||||
};
|
||||
my $bike_nodes = $dbt->fetch_rel4tpl4nd($dbh,$node);
|
||||
my $tariff_all = $db->collect_ct4rel("content","300026",$lang,"","","","","210");
|
||||
my $tariff_all = {};
|
||||
my $tariff = {
|
||||
table => "content",
|
||||
fetch => "all",
|
||||
keyfield => "barcode",
|
||||
template_id => "210",#Tariff tpl_id
|
||||
};
|
||||
$tariff_all = $dbt->fetch_record($dbh,$tariff);
|
||||
|
||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
my $users_dms_primary = { u_id => 0 };
|
||||
|
@ -602,20 +609,16 @@ EOF
|
|||
}elsif($size =~ /select/ && $key =~ /int12/ && $tpl_id =~ /210/){#Tarif for Flot
|
||||
my @s_valxx = ("");
|
||||
foreach my $rid (sort { $bike_nodes->{$a}->{node_name} cmp $bike_nodes->{$b}->{node_name} } keys (%$bike_nodes)){
|
||||
push (@s_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $bike_nodes->{$rid}->{main_id}");
|
||||
push (@s_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $dbt->{copri_conf}->{type_id}->{$bike_nodes->{$rid}->{type_id}}");
|
||||
}
|
||||
print $q->td({-class=>'search_line'},$but->selector_class("s_$key","","",$s_val,@s_valxx)),"\n";
|
||||
}elsif($size =~ /select/ && $key =~ /txt24/ && $tpl_id =~ /225/){#txt24=bike_group (for station filter)
|
||||
#my %station_filter_hash = ();
|
||||
my @s_valxx = ("");
|
||||
foreach my $rid (sort { $bike_nodes->{$a}->{node_name} cmp $bike_nodes->{$b}->{node_name} } keys (%$bike_nodes)){
|
||||
push (@s_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $bike_nodes->{$rid}->{main_id}");
|
||||
#$station_filter_hash{$bike_nodes->{$rid}->{type_id}} = 1;
|
||||
push (@s_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $dbt->{copri_conf}->{type_id}->{$bike_nodes->{$rid}->{type_id}}");
|
||||
|
||||
}
|
||||
#foreach my $type_id (keys (%station_filter_hash)){
|
||||
# push (@s_valxx, "$type_id:$dbt->{copri_conf}->{type_id}->{$type_id} - $type_id");
|
||||
#}
|
||||
print $q->td({-class=>'search_line'},$but->selector_class("s_$key","","",$s_val,@s_valxx)),"\n";
|
||||
|
||||
}elsif($size =~ /select/ && $key =~ /int21|int22/ && $tpl_id == 228){#Bonusnummern
|
||||
|
@ -1023,13 +1026,13 @@ EOF
|
|||
}elsif($ct4rel->{$id}->{template_id} == 210 && $key eq "int12"){
|
||||
my $flotten = "";
|
||||
foreach my $rid (sort { $bike_nodes->{$a}->{node_name} cmp $bike_nodes->{$b}->{node_name} } keys (%$bike_nodes)){
|
||||
$flotten .= "$bike_nodes->{$rid}->{node_name} - $bike_nodes->{$rid}->{main_id}<br />" if($ct4rel->{$id}->{$key} =~ /$bike_nodes->{$rid}->{main_id}/);
|
||||
$flotten .= "$bike_nodes->{$rid}->{node_name} - $dbt->{copri_conf}->{type_id}->{$bike_nodes->{$rid}->{type_id}}<br />" if($ct4rel->{$id}->{$key} =~ /$bike_nodes->{$rid}->{main_id}/);
|
||||
}
|
||||
print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style"},"$flotten"),"\n";
|
||||
}elsif($ct4rel->{$id}->{template_id} == 225 && $key eq "txt24"){
|
||||
my $flotten = "";
|
||||
foreach my $rid (sort { $bike_nodes->{$a}->{node_name} cmp $bike_nodes->{$b}->{node_name} } keys (%$bike_nodes)){
|
||||
$flotten .= "$bike_nodes->{$rid}->{node_name} - $bike_nodes->{$rid}->{main_id}<br />" if($ct4rel->{$id}->{$key} =~ /$bike_nodes->{$rid}->{main_id}/);
|
||||
$flotten .= "$bike_nodes->{$rid}->{node_name} - $dbt->{copri_conf}->{type_id}->{$bike_nodes->{$rid}->{type_id}}<br />" if($ct4rel->{$id}->{$key} =~ /$bike_nodes->{$rid}->{main_id}/);
|
||||
}
|
||||
print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style"},"$flotten"),"\n";
|
||||
}elsif($ct4rel->{$id}->{template_id} == 228 && $key =~ /int21|int22/){
|
||||
|
@ -1071,7 +1074,16 @@ EOF
|
|||
$teaser = substr($ct4rel->{$id}->{$key},0,50) . " ...";
|
||||
}
|
||||
print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style; min-width:200px;"},"$teaser"),"\n";
|
||||
|
||||
}elsif($key eq "txt30" && $node_meta->{template_id} == 202){
|
||||
$txtstyle = "text-align:left;";
|
||||
my @user_tarif = ("$ct4rel->{$id}->{$key}");
|
||||
@user_tarif = split(/\s/,$ct4rel->{$id}->{$key}) if($ct4rel->{$id}->{$key} =~ /\w\s+\w/);
|
||||
my $registered_tarif = "";
|
||||
foreach(@user_tarif){
|
||||
$registered_tarif .= "$_ - $dbt->{copri_conf}->{sharing_type}->{$tariff_all->{$_}->{int18}} - $tariff_all->{$_}->{ct_name} - $bike_nodes->{$tariff_all->{$_}->{int12}}->{node_name} | ";
|
||||
}
|
||||
#print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style"},"$registered_tarif"),"\n";
|
||||
print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style", -title=>"$registered_tarif"},"$ct4rel->{$id}->{$key}"),"\n";
|
||||
#default to anything else
|
||||
}elsif($key =~ /ct_name|node|txt|uri/){
|
||||
$txtstyle = "text-align:left;";
|
||||
|
|
Loading…
Add table
Reference in a new issue