mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 11:46:27 +01:00
tarif handling for caching
This commit is contained in:
parent
729dad2be4
commit
0ce7c7bea5
16 changed files with 305 additions and 148 deletions
|
@ -12,6 +12,7 @@ use strict;
|
|||
use warnings;
|
||||
use POSIX;
|
||||
use CGI; # only for debugging
|
||||
use JSON;
|
||||
use Digest::MD5 qw(md5 md5_hex);
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
use DateTime;
|
||||
|
@ -28,8 +29,7 @@ use Mod::Pricing;
|
|||
#use Mod::APIsigclient;#no!
|
||||
use Data::Dumper;
|
||||
use Sys::Hostname;
|
||||
my $hostname = hostname;
|
||||
|
||||
my $json = JSON->new->allow_nonref;
|
||||
my $cf = new Config;
|
||||
my $lb = new Libenz;
|
||||
my $dbt = new DBtank;
|
||||
|
@ -1786,9 +1786,9 @@ sub rental_to_feedback{
|
|||
|
||||
|
||||
#user bikes occupied
|
||||
sub user_bikes_occupied(){
|
||||
sub user_bikes_occupied {
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $dbh = shift;
|
||||
my $auth = shift;
|
||||
my $show_dialog = shift || "";
|
||||
|
||||
|
@ -1807,7 +1807,8 @@ sub user_bikes_occupied(){
|
|||
##selects also int28 > 0 bikes to view once miniquery
|
||||
#it will only defined on booking_request, because there must be available
|
||||
#$pref->{show_dialog} = "1" if($show_dialog);
|
||||
my $record = $dbt->collect_post($dbh,$pref);
|
||||
my $record = {};
|
||||
$record = $dbt->collect_post($dbh,$pref) if($auth->{c_id});
|
||||
return $record;
|
||||
}#end user_bikes_occupied
|
||||
|
||||
|
@ -1827,6 +1828,8 @@ sub rentals(){
|
|||
|
||||
#new sharee_pricing
|
||||
(my $return_counting->{$id}, my $counting) = $pri->counting_rental(\%varenv,$record->{$id},"");
|
||||
#$bw->log("rentals-rentalog",$return_counting->{$id}->{rentalog},"");
|
||||
$return_counting->{$id}->{rentalog} = "";#just for debuggiog, removed to reduce data in json
|
||||
my $return_feed->{$id} = $pri->fetch_rentalfeed(\%varenv,$record->{$id},$return_counting->{$id});
|
||||
$return->{$id} = { %{ $return_counting->{$id} }, %{ $return_feed->{$id} } };
|
||||
|
||||
|
@ -2142,11 +2145,13 @@ sub bikes_all(){
|
|||
$return->{$id}->{system} = "Ilockit";
|
||||
$return->{$id}->{Ilockit_GUID} = "$record->{$id}->{txt17}";
|
||||
$return->{$id}->{Ilockit_ID} = "$record->{$id}->{txt18}";
|
||||
#shareetool
|
||||
if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} == 187 && scalar(@{$user_tour} >= 1)){
|
||||
#shareetool servicetool
|
||||
#if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} == 187 && scalar(@{$user_tour} >= 1)){
|
||||
if($q->param('authcookie') && $varenv->{merchant_id} && $varenv->{merchant_id} eq $dbt->{appsframe}->{shareetool}->{merchant_id} && scalar(@{$user_tour} >= 1)){
|
||||
#2023-01-18 temporarly for Konstanz deactivated
|
||||
if(${$user_tour}[0] !~ /KN\d/){
|
||||
my @service_code = split(/\s/,$record->{$id}->{txt23});
|
||||
$return->{$id}->{service_code} = [@service_code];
|
||||
my @service_code = split(/\s/,$record->{$id}->{txt23});
|
||||
$return->{$id}->{service_code} = [@service_code];
|
||||
}
|
||||
}
|
||||
}elsif($record->{$id}->{int11} eq "3"){
|
||||
|
@ -2176,6 +2181,8 @@ sub stations_available(){
|
|||
$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'));
|
||||
|
||||
$bw->log("fetch_tariff adrtarif_hash from $varenv->{dbname}\n",$adrtarif_hash,"");
|
||||
|
||||
#station_group and bike_group alias bike nodes.type_id
|
||||
my $station_group = "";
|
||||
$station_group = $record_pos->{int29} if(ref($record_pos) eq "HASH" && $record_pos->{int29});
|
||||
|
@ -2273,7 +2280,7 @@ sub stations_available(){
|
|||
|
||||
#user_rental_count
|
||||
my $record_rentals = {};
|
||||
$record_rentals = $self->user_bikes_occupied($q,$auth,"") if($auth->{c_id});
|
||||
$record_rentals = $self->user_bikes_occupied($dbh,$auth,"") if($auth->{c_id});
|
||||
|
||||
my $hotline_hash = {
|
||||
table => "contentuser",
|
||||
|
@ -2286,6 +2293,8 @@ sub stations_available(){
|
|||
|
||||
my $op_return = {};
|
||||
foreach my $id (sort { $record->{$a}->{barcode} <=> $record->{$b}->{barcode} } keys (%$record)){
|
||||
$record->{$id}->{txt06} =~ s/\s//g if($record->{$id}->{txt06});
|
||||
if($record->{$id}->{txt06} && $record->{$id}->{txt06} =~ /\d+\.\d+\,\d+\.\d+/){
|
||||
my $bike_count = 0;
|
||||
foreach my $b_id (keys (%$record_bikes)){
|
||||
if($record->{$id}->{int04} == $record_bikes->{$b_id}->{int04}){
|
||||
|
@ -2295,12 +2304,13 @@ 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";
|
||||
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";
|
||||
|
@ -2308,7 +2318,6 @@ sub stations_available(){
|
|||
|
||||
$return->{$id}->{station} = "$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{int04}";
|
||||
$return->{$id}->{uri_operator} = "$varenv->{wwwhost}";
|
||||
$record->{$id}->{txt06} =~ s/\s//g;
|
||||
($return->{$id}->{gps}->{latitude},$return->{$id}->{gps}->{longitude}) = split(/,/,$record->{$id}->{txt06});
|
||||
my $description = $q->unescapeHTML($record->{$id}->{txt01}) || "";
|
||||
$return->{$id}->{description} = "$description";
|
||||
|
@ -2324,20 +2333,32 @@ sub stations_available(){
|
|||
$return->{$id}->{operator_data} = {
|
||||
"operator_name" => "",
|
||||
"operator_hours" => "",
|
||||
"operator_color" => "",
|
||||
"operator_logo" => "",
|
||||
"operator_phone" => "",
|
||||
"operator_email" => "",
|
||||
};
|
||||
$return->{$id}->{operator_data}->{operator_name} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$hotline_data->{txt01})) if($hotline_data->{txt01});
|
||||
$return->{$id}->{operator_data}->{operator_hours} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$hotline_data->{txt84})) if($hotline_data->{txt84});
|
||||
$return->{$id}->{operator_data}->{operator_color} = $hotline_data->{txt85} if($hotline_data->{txt85});
|
||||
$return->{$id}->{operator_data}->{operator_logo} = $hotline_data->{img01} if($hotline_data->{img01});
|
||||
$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});
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
return ($op_return, $record);
|
||||
}#end stations_available
|
||||
|
||||
|
@ -2575,7 +2596,10 @@ sub fetch_tariff(){
|
|||
}
|
||||
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);
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2604,7 +2628,7 @@ sub fetch_tariff(){
|
|||
@bike_node = keys %bike_node;
|
||||
@bike_group = keys %bike_group;
|
||||
|
||||
$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 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);
|
||||
}
|
||||
|
||||
|
@ -2901,15 +2925,11 @@ sub auth_verify(){
|
|||
$return->{last_used_operator} = {
|
||||
"operator_name" => "",
|
||||
"operator_hours" => "",
|
||||
"operator_color" => "",
|
||||
"operator_logo" => "",
|
||||
"operator_phone" => "",
|
||||
"operator_email" => "",
|
||||
};
|
||||
$return->{last_used_operator}->{operator_name} = $hotline_data->{txt01} if($hotline_data->{txt01});
|
||||
$return->{last_used_operator}->{operator_hours} = $hotline_data->{txt84} if($hotline_data->{txt84});
|
||||
$return->{last_used_operator}->{operator_color} = $hotline_data->{txt85} if($hotline_data->{txt85});
|
||||
$return->{last_used_operator}->{operator_logo} = $hotline_data->{img01} if($hotline_data->{img01});
|
||||
$return->{last_used_operator}->{operator_phone} = $hotline_data->{txt07} if($hotline_data->{txt07});
|
||||
$return->{last_used_operator}->{operator_email} = $hotline_data->{txt08} if($hotline_data->{txt08});
|
||||
}
|
||||
|
@ -2931,6 +2951,15 @@ sub auth_verify(){
|
|||
print FILE "users_serviceapp: $users_serviceapp->{u_id} | $return->{authcookie}\n" if($debug);
|
||||
}
|
||||
|
||||
#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";
|
||||
|
||||
print FILE "final return: $return->{authcookie}\n" if($debug);
|
||||
|
||||
close(FILE) if($debug);
|
||||
|
|
|
@ -39,6 +39,7 @@ my $json = JSON->new->allow_nonref;
|
|||
sub loop_sharees {
|
||||
my $self = shift;
|
||||
my $q = shift || "";
|
||||
my $auth = shift;
|
||||
my $authraw = shift;
|
||||
my $return_merchant = shift || "";
|
||||
my @keywords = $q->param;
|
||||
|
@ -77,15 +78,27 @@ sub loop_sharees {
|
|||
$bw->log("shareetool select_users $return_merchant->{aowner} on $op_name->{database}->{dbname} $authraw->{c_id} $authraw->{txt17}",$users_serviceapp->{u_id},"");
|
||||
}
|
||||
#every sharee client must have a merchant_id which associate a project
|
||||
#if($op_name->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $op_name->{project}))){
|
||||
|
||||
#to reduce request time by ($return_merchant->{project_id} eq "Freiburg") we do it only for shareeweb-sharee.copri.eu
|
||||
#if($op_name->{operatorApp} && ($users_serviceapp->{u_id} || $return_merchant->{project_id} eq "Freiburg" || ($return_merchant->{project_id} eq $op_name->{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}))){
|
||||
|
||||
#$bw->log("--> LOOP-start ($return_merchant->{merchant_id}) jsonclient loop_sharees $key by operatorApp: $op_name->{operatorApp}, netloc: $netloc if($return_merchant->{project_id} eq $op_name->{project} || $users_serviceapp->{u_id} > 0)\n","","");
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
$ret_json = $self->fetch_operator_json("$op_name->{operatorApp}/APIjsonserver",$rest);
|
||||
#print Dumper($ret_json);
|
||||
|
||||
if($ret_json){
|
||||
push(@uri_operator_array, $op_name->{operatorApp});
|
||||
|
|
|
@ -67,7 +67,7 @@ my $response = {
|
|||
apiserver => "$apiserver",
|
||||
response => "$respreq",
|
||||
uri_primary => "$dbt->{primary}->{sharee_primary}->{primaryApp}",
|
||||
copri_version => "4.1.22.19",
|
||||
copri_version => "4.1.23.03",
|
||||
user_id => "",
|
||||
authcookie => "",
|
||||
new_authcoo => "0",
|
||||
|
@ -84,7 +84,6 @@ my $response = {
|
|||
lang => "de",
|
||||
last_used_operator => {
|
||||
operator_name => "sharee.bike | TeilRad GmbH",
|
||||
operator_color => "#009699",
|
||||
operator_email => "hotline\@sharee.bike",
|
||||
operator_phone => "+49 761 45370097",
|
||||
operator_hours => "Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr",
|
||||
|
@ -157,8 +156,8 @@ if($q->param('request') eq "auth_verify"){
|
|||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
$response = { %$response, %$auth };
|
||||
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
||||
$response = { %$response, %$auth };
|
||||
}else{
|
||||
$response = { %$response, %$auth };
|
||||
}else{
|
||||
$response->{response_state} = "Failure 1001: authcookie not defined";
|
||||
$response->{response_text} = "Entschuldigung, die Sitzung wurde unterbrochen";
|
||||
}
|
||||
|
@ -214,7 +213,7 @@ elsif($q->param('request') eq "booking_request"){
|
|||
$bike_id = $1 if($bike_id =~ /(\d+)/);
|
||||
|
||||
#check count of occcupied/requested bikes
|
||||
my $record = $apif->user_bikes_occupied($q,$authraw,"");
|
||||
my $record = $apif->user_bikes_occupied($dbh,$authraw,"");
|
||||
my $count=0;
|
||||
my $still_requested = 0;
|
||||
foreach my $id (keys(%$record)){
|
||||
|
@ -311,7 +310,7 @@ elsif($q->param('request') eq "booking_request"){
|
|||
}
|
||||
|
||||
#return list of occupied/requested bikes
|
||||
$record = $apif->user_bikes_occupied($q,$authraw,"");
|
||||
$record = $apif->user_bikes_occupied($dbh,$authraw,"");
|
||||
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");#returns JSON rental values
|
||||
|
||||
}#end still_requested
|
||||
|
@ -392,7 +391,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);
|
||||
$response = {%$response, %$booking_values};
|
||||
|
||||
my $record = $apif->user_bikes_occupied($q,$authraw,"show_dialog");
|
||||
my $record = $apif->user_bikes_occupied($dbh,$authraw,"show_dialog");
|
||||
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");
|
||||
|
||||
#update on Ilockit
|
||||
|
@ -400,12 +399,12 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
|||
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
|
||||
$response = {%$response, %$booking_values};
|
||||
|
||||
my $record = $apif->user_bikes_occupied($q,$authraw,"");
|
||||
my $record = $apif->user_bikes_occupied($dbh,$authraw,"");
|
||||
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");
|
||||
}
|
||||
}#end occupied|available
|
||||
else{
|
||||
my $record = $apif->user_bikes_occupied($q,$authraw,"");
|
||||
my $record = $apif->user_bikes_occupied($dbh,$authraw,"");
|
||||
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");
|
||||
}
|
||||
|
||||
|
@ -429,7 +428,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,$authraw,$return_merchant);
|
||||
($response->{bikes_occupied},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant);
|
||||
}else{
|
||||
$response->{response_state} = "Failure 1001: authcookie not defined";
|
||||
$response->{response_text} = "Entschuldigung, die Sitzung wurde unterbrochen";
|
||||
|
@ -440,7 +439,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 };
|
||||
my $record = $apif->user_bikes_occupied($q,$authraw,"show_dialog");
|
||||
my $record = $apif->user_bikes_occupied($dbh,$authraw,"show_dialog");
|
||||
$response->{bikes_occupied} = $apif->rentals($record,$authraw,"1");
|
||||
}else{
|
||||
$response->{response_state} = "Failure 1001: authcookie not defined";
|
||||
|
@ -461,7 +460,7 @@ elsif($q->param('request') eq "bikes_available"){
|
|||
my $authraw = {};
|
||||
($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,$authraw,$return_merchant);
|
||||
($response->{bikes},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant);
|
||||
#$bw->log("X bikes_available $varenv{syshost} $stamp: $response->{user_group}",$response,"");
|
||||
}else{
|
||||
($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
|
||||
|
@ -497,7 +496,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,$authraw,$return_merchant);
|
||||
($response->{bikes},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant);
|
||||
}else{
|
||||
($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
|
||||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
|
@ -638,7 +637,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,$authraw,$return_merchant);
|
||||
($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant);
|
||||
}else{
|
||||
($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
|
||||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
|
@ -662,41 +661,60 @@ elsif($q->param('request') eq "stations_available"){
|
|||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
|
||||
my $user_agent_subversion = 1000;
|
||||
$user_agent_subversion = $3 if($user_agent =~ /3\.0\.(\d+)/);
|
||||
#$user_agent = "3.0.348";#test
|
||||
$user_agent_subversion = $1 if($user_agent =~ /3\.0\.(\d+)/);
|
||||
|
||||
#for tests only contributors with service-tour defined
|
||||
if(1==2 && $user_agent_subversion <= 398 && $authraw->{txt18} && $authraw->{c_id} =~ /$dbt->{copri_conf}->{contributors}/){
|
||||
my $pref_ctu = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
ct_name => "App-update-message",
|
||||
};
|
||||
my $uadr = { c_id => 0 };
|
||||
$uadr = $dbt->fetch_tablerecord($dbh,$pref_ctu);
|
||||
$response->{merchant_message} = $uadr->{txt01};
|
||||
$response->{merchant_message} = $uadr->{txt02} if($q->param('lang') eq "en");
|
||||
}
|
||||
#bayern-maintanance-message
|
||||
#merchant_message timerange
|
||||
my $lnow = strftime("%Y-%m-%d %H:%M:%S", localtime(time));
|
||||
my $localtime = Time::Piece->strptime($lnow, "%Y-%m-%d %H:%M:%S");
|
||||
my $epoch_now = $localtime->epoch;
|
||||
my $maintanance_start = Time::Piece->strptime("2023-02-16 21:00:00", "%Y-%m-%d %H:%M:%S");
|
||||
my $maintanance_end = Time::Piece->strptime("2023-02-17 03:00:00", "%Y-%m-%d %H:%M:%S");
|
||||
my $maintanance_start = Time::Piece->strptime("2023-03-06 00:00:00", "%Y-%m-%d %H:%M:%S");
|
||||
my $maintanance_end = Time::Piece->strptime("2023-04-01 01:00:00", "%Y-%m-%d %H:%M:%S");
|
||||
my $epoch_start = $maintanance_start->epoch;
|
||||
my $epoch_end = $maintanance_end->epoch;
|
||||
if(1==1 && $return_merchant->{merchant_id} eq $dbt->{appsframe}->{LastenradBayern}->{merchant_id} && $epoch_now >= $epoch_start && $epoch_now <= $epoch_end){
|
||||
my $pref_ctu = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
ct_name => "bayern-maintanance-message",
|
||||
};
|
||||
my $uadr = { c_id => 0 };
|
||||
$uadr = $dbt->fetch_tablerecord($dbh,$pref_ctu);
|
||||
$response->{merchant_message} = $uadr->{txt01};
|
||||
|
||||
#App update message
|
||||
if($user_agent_subversion <= 348){
|
||||
if($epoch_now >= $epoch_start && $epoch_now <= $epoch_end){
|
||||
my $pref_ctu = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
ct_name => "App-update-message",
|
||||
};
|
||||
my $uadr = { c_id => 0 };
|
||||
$uadr = $dbt->fetch_tablerecord($dbh,$pref_ctu);
|
||||
$response->{merchant_message} = $uadr->{txt01} . $user_agent;
|
||||
$response->{merchant_message} = $uadr->{txt02} if($q->param('lang') eq "en");
|
||||
}else{
|
||||
$apif->authout($q,$coo);
|
||||
}
|
||||
}
|
||||
|
||||
#user_rental
|
||||
$response->{user_rental} = {};
|
||||
if($authraw->{txt19} && $authraw->{txt19} =~ /sharee_/){
|
||||
my $last_used_operator = $authraw->{txt19};
|
||||
my $dbh_operator = $dbt->dbconnect_extern("$last_used_operator");
|
||||
my $record_rentals = {};
|
||||
$record_rentals = $apif->user_bikes_occupied($dbh_operator,$authraw,"");
|
||||
foreach my $r_id (keys (%$record_rentals)){
|
||||
if($record_rentals->{$r_id}->{c_id}){
|
||||
my $prefix = $record_rentals->{$r_id}->{txt12};
|
||||
my $station_type = "A-B";
|
||||
$station_type = "A-A" if($record_rentals->{$r_id}->{int41});
|
||||
$response->{user_rental} = { $record_rentals->{$r_id}->{c_id} => {
|
||||
bike_id => "$prefix$record_rentals->{$r_id}->{barcode}",
|
||||
station_id => "$prefix$record_rentals->{$r_id}->{int06}",
|
||||
station_group => "$prefix$record_rentals->{$r_id}->{int29}",
|
||||
station_type => "$station_type",
|
||||
}};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$response = { %$response, %$auth };
|
||||
($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$authraw,$return_merchant);
|
||||
($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant);
|
||||
}else{
|
||||
($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
|
||||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
|
|
|
@ -136,12 +136,12 @@ sub handler {
|
|||
txt08 => $q->escapeHTML($xmlref->{emailID}),
|
||||
txt11 => "$pwmd5",
|
||||
txt17 => "sharee_lv",
|
||||
txt19 => "sharee_lv",
|
||||
int03 => "1",
|
||||
txt22 => "DE11111111111111111111",
|
||||
txt23 => "FRSPDE11111",
|
||||
int04 => "1",
|
||||
int13 => "1",
|
||||
txt30 => "5511",
|
||||
int05 => "1",
|
||||
int14 => "1",
|
||||
int16 => "null",
|
||||
|
@ -150,21 +150,38 @@ sub handler {
|
|||
txt06 => "79999 freiburg",
|
||||
txt07 => "$teltime",
|
||||
ct_name => "LV-12345678",
|
||||
txt30 => "LV5511",#Prim hidden Tarif
|
||||
};
|
||||
$c_id = $dbt->insert_contentoid($dbh,$insert);
|
||||
$dbt->update_operatorsloop($varenv{dbname},$c_id,"update");
|
||||
|
||||
#set lv tarif
|
||||
my $update = {
|
||||
table => "contentadr",
|
||||
txt15 => "LV2sharee",#Fcode
|
||||
txt30 => "5511",#Tarif
|
||||
};
|
||||
my $dbh_operator = $dbt->dbconnect_extern("sharee_lv");
|
||||
my $record->{c_id} = $c_id;
|
||||
my $rows = $dbt->update_record($dbh_operator,$update,$record);
|
||||
|
||||
}elsif($xmlref->{todo} eq "update_LVuser" && $record_e->{c_id}){
|
||||
|
||||
#keep all and add only LV userID if user email still exist
|
||||
my $update = {
|
||||
table => "contentadr",
|
||||
txt17 => "sharee_lv",
|
||||
txt30 => "5511",
|
||||
mtime => 'now()',
|
||||
owner => "$owner",
|
||||
int01 => $q->escapeHTML($xmlref->{userID}),
|
||||
};
|
||||
my $rows = $dbt->update_record($dbh,$update,$record_e);
|
||||
$dbt->update_operatorsloop($varenv{dbname},$record_e->{c_id},"update");
|
||||
|
||||
#set lv tarif
|
||||
my $dbh_operator = $dbt->dbconnect_extern("sharee_lv");
|
||||
$update->{txt15} = "LV2sharee";
|
||||
$update->{txt30} = "5511";
|
||||
my $rows = $dbt->update_record($dbh_operator,$update,$record_e);
|
||||
|
||||
}elsif($xmlref->{todo} eq "update_LVuser" && $record->{c_id}){
|
||||
|
||||
|
@ -181,8 +198,16 @@ sub handler {
|
|||
int14 => "1",
|
||||
};
|
||||
my $rows = $dbt->update_record($dbh,$update,$record);
|
||||
$dbt->update_operatorsloop($varenv{dbname},$record->{c_id},"update");
|
||||
|
||||
#set lv tarif
|
||||
my $dbh_operator = $dbt->dbconnect_extern("sharee_lv");
|
||||
$update->{txt15} = "LV2sharee";
|
||||
$update->{txt30} = "5511";
|
||||
my $rows = $dbt->update_record($dbh_operator,$update,$record);
|
||||
|
||||
}elsif($xmlref->{todo} eq "delete_LVuser"){
|
||||
#xml deleting deletes only on operator
|
||||
$dbt->delete_content($dbh,"contentadr",$record->{c_id});
|
||||
}
|
||||
|
||||
|
|
|
@ -147,10 +147,8 @@ sub update_operatorsloop {
|
|||
my $dbh_operator = $self->dbconnect_extern("$sharee_operator");
|
||||
if($todo eq "update"){
|
||||
|
||||
#this will be saved by operator DMS and have to keep intividual
|
||||
$bw->log("disabled condition: if($sharee_operator ne $dbname || $record_primary->{owner} == 197 || $dbname","","");
|
||||
delete $record_primary->{txt17};#operators
|
||||
delete $record_primary->{txt30} if($dbname ne "sharee_lv" && $record_primary->{txt30} ne "5511");#Tarif, exception sharee_lv;#Tarif
|
||||
delete $record_primary->{txt30};#tarifs
|
||||
delete $record_primary->{txt15};#Bonusnr
|
||||
delete $record_primary->{int07};#Rabatt
|
||||
delete $record_primary->{txt18};#Service tour
|
||||
|
@ -161,7 +159,6 @@ sub update_operatorsloop {
|
|||
delete $record_primary->{int23};#mini_answer count will be saved on operator
|
||||
delete $record_primary->{txt29};#Sonstiges
|
||||
delete $record_primary->{txt35};#Umfragelink
|
||||
#}
|
||||
|
||||
my $update = {
|
||||
%$record_primary,
|
||||
|
@ -178,33 +175,9 @@ sub update_operatorsloop {
|
|||
table => "contentadr",
|
||||
mtime => 'now()',
|
||||
};
|
||||
#owner => "198",
|
||||
|
||||
my $c_id = $self->insert_contentoid($dbh_operator,$insert,"");
|
||||
$rows = 1 if($c_id);
|
||||
#pseudo code copied fom net_booking. have to be done elsewehre because of $apif
|
||||
if(1==2){
|
||||
my $ctadr = { c_id => $c_id };
|
||||
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash);# = $apif->fetch_tariff($ctadr,"");
|
||||
foreach my $id (keys (%$tariff_content)){
|
||||
# #int18
|
||||
#<sharing_type>
|
||||
# 2 = "public"
|
||||
# 3 = "private"
|
||||
# 4 = "hidden-lv"
|
||||
# 5 = "public-bonus"
|
||||
#</sharing_type>
|
||||
my $update_op = {
|
||||
table => "contentadr",
|
||||
};
|
||||
if($tariff_content->{$id}->{int18} && ($tariff_content->{$id}->{int18} == 2 || $tariff_content->{$id}->{int18} == 3 || $tariff_content->{$id}->{int18} == 4)){
|
||||
#if($tariff_content->{$id}->{int12} && $tariff_content->{$id}->{int12} == $ct->{main_id} && $tariff_content->{$id}->{barcode}){
|
||||
$update_op->{txt30} = $tariff_content->{$id}->{barcode};
|
||||
$rows = $self->update_record($dbh_operator,$update,$ctadr);
|
||||
#}
|
||||
}
|
||||
}
|
||||
}#end of reminder
|
||||
|
||||
}
|
||||
}elsif($todo eq "delete"){
|
||||
|
@ -214,7 +187,6 @@ sub update_operatorsloop {
|
|||
}
|
||||
}
|
||||
}
|
||||
#}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
@ -976,6 +948,8 @@ sub update_record(){
|
|||
if($key =~ /(mtime|atime|pay_time|invoice_time|warn_time)$/){
|
||||
if($value && $value =~ /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$|^\d{2}\.\d{2}\.\d{4}$/){
|
||||
$set .= " $key='$value',";
|
||||
}elsif($key =~ /warn_time/ && $value eq "null"){
|
||||
$set .= " $key=null,";
|
||||
}else{
|
||||
$set .= " $key='now()',";
|
||||
}
|
||||
|
@ -1051,7 +1025,7 @@ sub insert_contentoid {
|
|||
|
||||
if($insert->{table} eq "contentadr" && $reset_keys eq "reset_adropkeys"){
|
||||
delete $insert->{txt17};#operators
|
||||
delete $insert->{txt30} if($source ne "sharee_lv" && $insert->{txt30} ne "5511");#Tarif, exception sharee_lv
|
||||
delete $insert->{txt30};#tarifs
|
||||
delete $insert->{txt15};#Bonusnr
|
||||
delete $insert->{int07};#Rabatt
|
||||
delete $insert->{txt18};#Service tour
|
||||
|
|
|
@ -255,7 +255,14 @@ sub save_text2contenttrans {
|
|||
$update_ctt->{$_} = "$valxx";
|
||||
}
|
||||
}
|
||||
elsif($_ =~ /txt|int|state|time/){
|
||||
elsif($_ =~ /int|time/){
|
||||
if(!$valxx){
|
||||
$update_ctt->{$_} = "null";
|
||||
}else{
|
||||
$update_ctt->{$_} = "$valxx";
|
||||
}
|
||||
}
|
||||
elsif($_ =~ /txt|state/){
|
||||
$update_ctt->{$_} = "$valxx";
|
||||
}
|
||||
}
|
||||
|
@ -263,9 +270,9 @@ sub save_text2contenttrans {
|
|||
if($ctt->{c_id}){
|
||||
$u_rows += $dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
#empty warn_time if warnstate not set
|
||||
if(!$R::int06 || !$R::warn_time){
|
||||
$dbt->update_one($dbh,$update_ctt,"warn_time=null",$c_id);
|
||||
}
|
||||
#if(!$R::int06 || !$R::warn_time){
|
||||
# $dbt->update_one($dbh,$update_ctt,"warn_time=null",$c_id);
|
||||
#}
|
||||
if($R::txt22 && $R::txt22 eq "Zahlungseingang"){
|
||||
$dbt->update_one($dbh,$update_ctt,"int14=null",$c_id);
|
||||
$dbt->update_one($dbh,$update_ctt,"pay_time=now()",$c_id);
|
||||
|
@ -1000,13 +1007,50 @@ sub set_usertarif {
|
|||
open(FILE,">>$varenv{logdir}/save_account.log") if($debug);
|
||||
print FILE "\n*Prelib--> $now_dt| dbname: $dbname | c_id: $adr_bonus->{c_id} | txt15: $adr_bonus->{txt15}\n" if($debug);
|
||||
|
||||
my $oprefix = $dbt->{operator}->{$dbname}->{oprefix};
|
||||
my $ret = $adr_bonus->{ret};
|
||||
my $i = 0;
|
||||
my $dbh_operator = $dbt->dbconnect_extern($dbname);#operator connect
|
||||
|
||||
my $tariff_all = { barcode => 0, txt18 => 0};
|
||||
my $tariff = {
|
||||
table => "content",
|
||||
fetch => "all",
|
||||
keyfield => "barcode",
|
||||
template_id => "210",#Tariff tpl_id
|
||||
};
|
||||
$tariff_all = $dbt->fetch_record($dbh_operator,$tariff);
|
||||
|
||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
my $adref = {
|
||||
table => "contentadr",
|
||||
fetch => "one",
|
||||
template_id => "202",
|
||||
c_id => "$adr_bonus->{c_id}",
|
||||
};
|
||||
|
||||
my $adr_primary = { c_id => 0 };
|
||||
$adr_primary = $dbt->fetch_record($dbh_primary,$adref) if($adr_bonus->{c_id});
|
||||
|
||||
#collect Tarif with prefix saving on primary
|
||||
my %prim_tarif_hash = ();
|
||||
if($adr_primary->{txt30} && $adr_primary->{txt30} =~ /\w\s\w/){
|
||||
%prim_tarif_hash = map { $_ => 1 } split(/\s+/,$adr_primary->{txt30});
|
||||
}elsif($adr_primary->{txt30}){
|
||||
$prim_tarif_hash{$adr_primary->{txt30}} = 1;
|
||||
}
|
||||
|
||||
#first delete operator tarif in prim_tarif_hash. we will fill up downunder
|
||||
foreach my $rid (sort { $tariff_all->{$a}->{barcode} <=> $tariff_all->{$b}->{barcode} } keys (%$tariff_all)){
|
||||
print FILE "--> Cleanup operator specific prim_tarif_hash: $tariff_all->{$rid}->{barcode}\n";
|
||||
delete $prim_tarif_hash{$oprefix . $tariff_all->{$rid}->{barcode}};
|
||||
}
|
||||
|
||||
if($adr_bonus->{txt15} =~ /\w+/){
|
||||
if(1==1){
|
||||
my %tarif_hash = ();
|
||||
my @new_txt30 = ();
|
||||
|
||||
#collect multiple tarif by bonusnr
|
||||
my $pref_cc = {
|
||||
table => "content",
|
||||
|
@ -1017,19 +1061,32 @@ sub set_usertarif {
|
|||
ct_name => "ilike::$adr_bonus->{txt15}",
|
||||
};
|
||||
|
||||
$bonus_collect = $dbt->fetch_record($dbh_operator,$pref_cc) if(ref($bonus_collect->{1}) ne "HASH");
|
||||
|
||||
foreach my $sourcetarif (@{$adr_bonus->{txt30_array}}){
|
||||
$tarif_hash{$sourcetarif} = 1;
|
||||
#additional and only! save privat or hidden tarif to primary to get caching
|
||||
if($tariff_all->{$sourcetarif}->{int18} == 3 || $tariff_all->{$sourcetarif}->{int18} == 4){
|
||||
$prim_tarif_hash{$oprefix . $sourcetarif} = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$bonus_collect = $dbt->fetch_record($dbh_operator,$pref_cc) if(ref($bonus_collect->{1}) ne "HASH");
|
||||
print FILE "Prelib bonus_collect:\n" . Dumper($bonus_collect) . "\n";
|
||||
print FILE "Prelib bonus_collect by request txt15: $adr_bonus->{txt15}\n";
|
||||
foreach my $id (keys (%$bonus_collect)){
|
||||
$i++;
|
||||
print FILE "$i)-1-> loop bonus_collect and find $bonus_collect->{$id}->{ct_name} = $adr_bonus->{txt15}\n|==>Take and insert Tarif $bonus_collect->{$id}->{int22}\n" if($debug);
|
||||
print FILE "$i)-2-> delete if($bonus_collect->{$id}->{int21} && $bonus_collect->{$id}->{int21} != $bonus_collect->{$id}->{int22})\n" if($debug);
|
||||
$tarif_hash{$bonus_collect->{$id}->{int22}} = 1;
|
||||
$tarif_hash{$bonus_collect->{$id}->{int22}} = 1;
|
||||
|
||||
#additional and only! save privat or hidden tarif to primary to get caching
|
||||
if($tariff_all->{$bonus_collect->{$id}->{int22}}->{int18} == 3 || $tariff_all->{$bonus_collect->{$id}->{int22}}->{int18} == 4){
|
||||
$prim_tarif_hash{$oprefix . $bonus_collect->{$id}->{int22}} = 1;
|
||||
}
|
||||
|
||||
if($bonus_collect->{$id}->{int21} && $bonus_collect->{$id}->{int21} != $bonus_collect->{$id}->{int22}){
|
||||
print FILE "$i)-2-> delete if($bonus_collect->{$id}->{int21} && $bonus_collect->{$id}->{int21} != $bonus_collect->{$id}->{int22})\n" if($debug);
|
||||
delete $tarif_hash{$bonus_collect->{$id}->{int21}};
|
||||
delete $prim_tarif_hash{$oprefix . $bonus_collect->{$id}->{int21}};
|
||||
print FILE "$i)-3-> delete done $bonus_collect->{$id}->{int21}\n" if($debug);
|
||||
}
|
||||
|
||||
|
@ -1039,13 +1096,36 @@ sub set_usertarif {
|
|||
print FILE "Final -3-> txt30: @new_txt30\n" if($debug);
|
||||
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt30='@new_txt30'");
|
||||
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'");
|
||||
|
||||
#collect Tarif with prefix saving on primary
|
||||
my @prim_txt30 = keys %prim_tarif_hash;
|
||||
$u_rows = $dbt->update_one($dbh_primary,$adr_bonus,"txt30='@prim_txt30'");
|
||||
|
||||
}
|
||||
$ret = "failure::txt30#top2" if(!$adr_bonus->{txt30_array} || $adr_bonus->{txt30_array} !~ /\d/);
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
print FILE "-4-> update Tarif txt30: @{$adr_bonus->{txt30_array}}\n" if($debug);
|
||||
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt30='@{$adr_bonus->{txt30_array}}'");
|
||||
$u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15=''");
|
||||
|
||||
#collect Tarif with prefix saving on primary
|
||||
#delete bonus tarif on primary if not defined by operator
|
||||
#additional and only! save privat or hidden tarif to primary to get caching
|
||||
foreach my $rid (sort { $tariff_all->{$a}->{barcode} <=> $tariff_all->{$b}->{barcode} } keys (%$tariff_all)){
|
||||
foreach(@{$adr_bonus->{txt30_array}}){
|
||||
if($tariff_all->{$rid}->{barcode} == $_ && ($tariff_all->{$_}->{int18} == 3 || $tariff_all->{$_}->{int18} == 4)){
|
||||
print FILE "--> Adding private/hidden key on operator to primary: $_\n";
|
||||
$prim_tarif_hash{$oprefix . $_} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my @prim_txt30 = keys %prim_tarif_hash;
|
||||
$u_rows = $dbt->update_one($dbh_primary,$adr_bonus,"txt30='@prim_txt30'");
|
||||
|
||||
$ret = "failure::txt30#top3" if(!$adr_bonus->{txt30_array} || $adr_bonus->{txt30_array} !~ /\d/);
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,6 @@ sub save_account(){
|
|||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt17='@operators'");
|
||||
}
|
||||
#Web-Login|Rabatt|Vde|payone cron-intervall|Ilockit-Admin|miniq
|
||||
#elsif($_ =~ /int05|int07|int16|int19/){
|
||||
elsif($_ =~ /int05|int07|int16|int19|int23/){
|
||||
$u_rows = $dbt->update_one("",$update_primary,"$_=$valxx");
|
||||
}
|
||||
|
@ -257,11 +256,9 @@ sub save_account(){
|
|||
#txt15=Bonus- oder Antragsnummer (falls vorhanden)=15
|
||||
#only check bonusnr and add operators dbname.
|
||||
#bonustarif will be set after operator insert
|
||||
#TODO, check bonusnr insert on sharee_kn Operator (Giese)
|
||||
elsif($_ eq "txt15"){
|
||||
#only done by App web iframe Anmelde-Registration formular
|
||||
print FILE "Bonusnr request $_: $valxx\n" if($debug);
|
||||
|
||||
#--> Only done by App web iframe Anmelde-Registration formular
|
||||
if($varenv{dbname} eq $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
|
||||
my %txt17 = ();
|
||||
if($ctadr->{txt17} =~ /\w\s\w/){
|
||||
|
@ -271,7 +268,7 @@ sub save_account(){
|
|||
}
|
||||
|
||||
#accept SWK codes without prefix
|
||||
if($valxx && $owner && ($owner == 195 || $owner == 185 || $owner == 176 || $varenv{dbname} eq "sharee_kn")){
|
||||
if($valxx && $owner && ($owner == 195 || $owner == 176)){
|
||||
my $valappend = $valxx;
|
||||
$valxx = "KN-$valappend";
|
||||
print FILE "Prepare SWK Bonusnr by prefix $valxx" . "\n" if($debug);
|
||||
|
@ -295,8 +292,8 @@ sub save_account(){
|
|||
int03 => ">::0",
|
||||
ct_name => "ilike::$bonusnr",
|
||||
};
|
||||
my $bonus_record = { c_id => 0 };
|
||||
$bonus_record = $dbt->fetch_record($dbh_operator,$pref_bo);
|
||||
my $bonus_record = { c_id => 0, ct_name => "" };
|
||||
$bonus_record = $dbt->fetch_record($dbh_operator,$pref_bo) if($bonusnr);
|
||||
my $bonus_collect = {};#will be hash on matchin SWK bonus
|
||||
#also if SWK file matches
|
||||
if(!$bonus_record->{c_id} && $operator_conf->{database}->{dbname} eq "sharee_kn"){
|
||||
|
@ -369,7 +366,7 @@ sub save_account(){
|
|||
};
|
||||
$ctadr_operator = $dbt->fetch_record($dbh_operator,$authref);
|
||||
|
||||
print FILE "operator adr update preview with bonusnr:\n" . Dumper($adr_bonus) . "\n";
|
||||
print FILE "Bonusnr set_usertarif done by primary:\n" . Dumper($adr_bonus) . "\n";
|
||||
$ret = $pl->set_usertarif($dbh,$operator_conf->{database}->{dbname},$adr_bonus,$bonus_collect);
|
||||
|
||||
#count down only if not file greped with static kn c_id and not still used
|
||||
|
@ -392,13 +389,13 @@ sub save_account(){
|
|||
}
|
||||
#sharee txt30=Tarif (multible) and Bonusnummer txt15 automatic
|
||||
elsif($_ eq "txt30"){
|
||||
#only done by Operator DMS
|
||||
#--> Only done by Operator DMS
|
||||
if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
|
||||
my @txt30 = $q->param('txt30');#multiple select sharee Tarif
|
||||
@txt30 = grep {!/null/} @txt30;
|
||||
my $bonusnr = $q->escapeHTML("$R::txt15");#on Operator DMS without oprefix-
|
||||
|
||||
my $bonushash = {
|
||||
my $adr_bonus = {
|
||||
table => "contentadr",
|
||||
mtime => "now()",
|
||||
c_id => $c_id,
|
||||
|
@ -407,7 +404,8 @@ sub save_account(){
|
|||
owner => $owner,
|
||||
ret => $ret,
|
||||
};
|
||||
$ret = $pl->set_usertarif($dbh,$varenv{dbname},$bonushash);
|
||||
print FILE "Bonusnr set_usertarif done by operator:\n" . Dumper($adr_bonus) . "\n";
|
||||
$ret = $pl->set_usertarif($dbh,$varenv{dbname},$adr_bonus,"");
|
||||
}
|
||||
#phonenr
|
||||
}elsif($_ eq "txt07"){
|
||||
|
|
|
@ -808,25 +808,42 @@ EOF
|
|||
}
|
||||
print $q->td({-class=>'content1_cms', -colspan=>'3'},$q->textarea(-id=>"$key", -class=>"etxt", -style=>"border: 1px solid silver;$h $w", -name=>"$key", -override=>'1',-default=>"$ctrel->{$key}")),"\n";
|
||||
}
|
||||
elsif($key =~ /txt15/ && $varenv{syshost} =~ /sharee/ && $node_meta->{tpl_id} == 202){
|
||||
my $record_bonus = {c_id => 0};
|
||||
my $pref_cc = {
|
||||
elsif($key =~ /txt15/ && $varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname} && $node_meta->{tpl_id} == 202){
|
||||
my $bonus_record = { c_id => 0, ct_name => "" };
|
||||
|
||||
#check after saving to see if matches
|
||||
if($varenv{dbname} eq "sharee_kn"){
|
||||
$bonus_record->{ct_name} = $lb->grep_filecontent("$dbt->{copri_conf}->{basedir}/$dbt->{operator}->{$varenv{dbname}}->{dir_app}/ftp/SWK_codes/got_last.csv","$ctrel->{txt15}") if($ctrel->{txt15});
|
||||
}
|
||||
if(!$bonus_record->{ct_name}){
|
||||
my $pref_cc = {
|
||||
table => "content",
|
||||
fetch => "one",
|
||||
template_id => "228",
|
||||
ct_name => "$ctrel->{txt15}",
|
||||
};
|
||||
$record_bonus = $dbt->fetch_record($dbh,$pref_cc);
|
||||
};
|
||||
$bonus_record = $dbt->fetch_record($dbh,$pref_cc) if($ctrel->{txt15});
|
||||
}
|
||||
|
||||
my @tariff = ("$ctrel->{txt30}");
|
||||
@tariff = split(/\s/,$ctrel->{txt30}) if($ctrel->{txt30} =~ /\s/);
|
||||
foreach my $tf_id (@tariff){
|
||||
$tf_id =~ s/\s//g;
|
||||
#print "$record_bonus->{int22} == $tf_id<br>";
|
||||
if($record_bonus->{int22} == $tf_id && $varenv{syshost} ne "shareedms-kn"){
|
||||
$postdes = "Tarif: $record_bonus->{int21} - $record_bonus->{int22} (public - bonus)";
|
||||
$postdes .= $q->span({-style=>'color:red;padding-left:10px;'},"Fehler: Bonusnummer") if(!$ctrel->{$key});
|
||||
my $sharing_type = "public-bonus";
|
||||
$sharing_type = $dbt->{copri_conf}->{sharing_type}->{$tariff_all->{$tf_id}->{int18}};
|
||||
if($bonus_record->{int22} && $tf_id && $bonus_record->{int22} == $tf_id){
|
||||
$postdes .= "*code aktiviert $sharing_type Tarif Nr. $bonus_record->{int22}. ";
|
||||
}
|
||||
if((!$ctrel->{txt15} || $bonus_record->{ct_name} ne $ctrel->{txt15}) && $tf_id && $tariff_all->{$tf_id}->{int18} != 2){
|
||||
$postdes .= $q->span({-style=>'color:red;padding-left:10px;'},"Achtung, $sharing_type Tarif $tf_id ohne *code aktiviert. ");
|
||||
}
|
||||
}
|
||||
if($ctrel->{txt15} && $bonus_record->{ct_name} ne $ctrel->{txt15}){
|
||||
$postdes .= $q->span({-style=>'color:red;padding-left:10px;'},"*code ist nicht vorhanden! ");
|
||||
}elsif($ctrel->{txt15} && $bonus_record->{ct_name} eq $ctrel->{txt15}){
|
||||
my $sharing_type = "public-bonus";
|
||||
$sharing_type = $dbt->{copri_conf}->{sharing_type}->{$tariff_all->{$bonus_record->{int22}}->{int18}} if($bonus_record->{int22});
|
||||
$postdes .= "Ok, $sharing_type *code vorhanden. Trotzdem Tarif Einstellung prüfen.";
|
||||
}
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||
|
@ -840,7 +857,7 @@ EOF
|
|||
print $q->td({-class=>'content1_cms',-colspan=>'2'},$q->textfield(-class=>'etxt', -style=>"width:$w;",-name=>"$key", -override=>'1', -default=>"$ctrel->{$key}"), $postdes),"\n";
|
||||
}
|
||||
}
|
||||
elsif($key =~ /txt/ && $key ne "txt12"){
|
||||
elsif($key =~ /txt/ && $key !~ /txt12|txt15/){
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||
print $q->td({-class=>'content1_cms',-colspan=>'2'},$q->textfield(-class=>'etxt', -style=>"width:$w;",-name=>"$key", -override=>'1', -default=>"$ctrel->{$key}"), $postdes),"\n";
|
||||
|
|
|
@ -155,6 +155,9 @@ sub tpl(){
|
|||
$node_meta->{tpl_order} =~ s/txt17=[\w\s=]+,//;
|
||||
$node_meta->{tpl_order} =~ s/txt19=[\w\s=]+,//;
|
||||
}
|
||||
if($table eq "contentadr" && $varenv{dbname} eq $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
|
||||
$node_meta->{tpl_order} =~ s/Tarife/private Tarife/;
|
||||
}
|
||||
$node_meta->{tpl_order} =~ s/c_id=raw=[\w\s=]+// if($users_dms->{u_id} != $dbt->{copri_conf}->{superu_id});
|
||||
|
||||
my @tpl_order = split /,/,$node_meta->{tpl_order};
|
||||
|
|
|
@ -75,8 +75,7 @@ sub tpl(){
|
|||
$ctf = $dbt->fetch_tablerecord($dbh,$pref_cu);
|
||||
|
||||
my $ctadr = $db->get_content1("contentadr",$ctt->{int10});
|
||||
my $buchen_mtime = $lb->time4de($ctt->{mtime});
|
||||
my $vibuchen_mtime = $lb->time4de($ctt->{mtime},1);
|
||||
my $vibuchen_mtime = "(nicht verfügbar, siehe Internas und log)";
|
||||
|
||||
my @tpl_order = ("txt01=Beschreibung","ct_name=Nummer","date_time=timerange","int03=Menge (Miet - Gratis Zeit)","int02=Preis","int07=Rabatt","int04=Gesamt");
|
||||
my $tplf = $db->get_tpl("201");#Kunden-Faktura, ex Firma
|
||||
|
|
|
@ -18,6 +18,7 @@ for i in $(find . -type d -and -name cache); do chmod -R ug+rwx $i;done
|
|||
for i in $(find . -type d -and -name pdf); do chmod -R ug+rwx $i;done
|
||||
for i in $(find . -type d -and -name xml); do chmod -R ug+rwx $i;done
|
||||
for i in $(find . -type d -and -name site); do chmod -R ug+rwx $i;done
|
||||
for i in $(find . -type d -and -name json); do chmod -R ug+rwx $i;done
|
||||
for i in $(find . -type d -and -name shareeconf); do chmod -R go-rwx $i;done
|
||||
for i in $(find . -type d -and -name shareeconf); do chmod -R ug+rx $i;done
|
||||
for i in $(find . -type d -and -name sql); do chmod -R go-rwx $i;done
|
||||
|
|
1
copri4/shareeapp-operator/json
Symbolic link
1
copri4/shareeapp-operator/json
Symbolic link
|
@ -0,0 +1 @@
|
|||
../shareedms-operator/json
|
|
@ -76,13 +76,7 @@ sub tpl(){
|
|||
|
||||
print "<div class='form-group'>\n";
|
||||
|
||||
if($users_sharee->{c_id} && !$users_sharee->{int04} && $R::sharee_edit !~ /delete_account/){
|
||||
print $q->div({-class=>'content1',-style=>'padding-top:1em;'}, "E-Mail Bestätigung"),"\n";
|
||||
print $q->div({-class=>'content2'}, "Wir haben eine Nachricht an Ihre angegebene E-Mail Adresse versandt. Nach erfolgreicher Bestätigung können Sie unser Mietradsystem nutzen."),"\n";
|
||||
print $q->div({-class=>'content2'},$q->a({-href=>"$varenv->{wwwhost}?sharee_edit=send_email"},"Senden wiederholen")),"\n";
|
||||
|
||||
#Account löschen
|
||||
}elsif($viewsel[1] eq "Account" && $R::sharee_edit =~ /delete_account/){
|
||||
if($viewsel[1] eq "Account" && $R::sharee_edit =~ /delete_account/){
|
||||
if($R::sharee_edit eq "delete_account1" && $users_sharee->{c_id}){
|
||||
#
|
||||
my ($cttpos,$operator_hash) = $apif->user_rentals_history($q,$users_sharee);
|
||||
|
|
|
@ -138,6 +138,7 @@ Weitere Personen aus Ihrem Haushalt profitieren jedoch ebenfalls, falls Sie weit
|
|||
};
|
||||
|
||||
$ctadrcoupon->{$sharee_operator} = $dbt->fetch_tablerecord($dbh_operator,$prefcoupon);
|
||||
$ctadrcoupon->{$sharee_operator}->{oprefix} = "$dbt->{operator}->{$sharee_operator}->{oprefix}";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -557,7 +558,7 @@ Nach Abschluss der Registrierung erhalten Sie sowohl auf die von Ihnen hinterleg
|
|||
print $q->div(" ");
|
||||
foreach my $opid (keys(%$ctadrcoupon)){
|
||||
if($ctadrcoupon->{$opid}->{txt15} && ($aowner != 195 && $aowner != 185 && $aowner != 176)){
|
||||
print $q->div("$bonus_saved $ctadrcoupon->{$opid}->{txt15}"),"\n";
|
||||
print $q->div("$bonus_saved $ctadrcoupon->{$opid}->{oprefix}-$ctadrcoupon->{$opid}->{txt15}"),"\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -334,15 +334,18 @@ sub tplselect(){
|
|||
&Calorin::tpl($node_meta,$users_dms,$mode,$feedb);
|
||||
}
|
||||
|
||||
if($return =~ /failure/ || (ref($feedb) eq "HASH" && $feedb->{message} =~ /failure/)){
|
||||
$feedb->{message} = "$return" if($return);
|
||||
if(ref($feedb) eq "HASH" && $feedb->{message} =~ /failure/){
|
||||
require "Mod/Failure.pm";
|
||||
&Failure::tpl($varenv,$users_dms->{u_id},$feedb);
|
||||
}elsif($return =~ /failure/){
|
||||
$feedb->{message} = "$return";
|
||||
require "Mod/Failure.pm";
|
||||
&Failure::tpl($varenv,$users_dms->{u_id},$feedb);
|
||||
}else{
|
||||
if(($R::ct_trans !~ /close/) && ($ct_table =~ /contenttrans/) && ($R::ct_trans || $R::trans2edit || $R::ctpos_activ || $R::select_part || $R::set_main_id)){
|
||||
&Modalbox::mobox($node_meta,$users_dms,$return);
|
||||
}elsif(($R::ct_trans !~ /close/) && ($ct_table =~ /content$|contentadr|contentuser|contentpos|users$|contenttranspos/ && ($R::ct_trans || $R::rel_edit || $R::base_edit)) || ($R::node2edit && $R::node2edit =~ /edit/)){
|
||||
&Modalbox3::mobox3($node_meta,$users_dms,$feedb,$return,$mode) if($R::rel_edit !~ /delete|save/ && $R::ct_trans !~ /delete/ && $R::base_edit !~ /delete|save/ && !$R::service_id);
|
||||
&Modalbox3::mobox3($node_meta,$users_dms,$feedb,$return,$mode) if($R::rel_edit !~ /delete|save/ && $R::ct_trans !~ /delete/ && $R::base_edit !~ /delete/ && !$R::service_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
1
copri4/shareeweb-project/json
Symbolic link
1
copri4/shareeweb-project/json
Symbolic link
|
@ -0,0 +1 @@
|
|||
../shareedms-operator/json
|
Loading…
Add table
Reference in a new issue