operator build debug and fix. Faktura warning state

This commit is contained in:
ragu 2022-11-16 21:22:00 +01:00
parent 2e2c824dbe
commit 5b32d2b7f5
40 changed files with 254 additions and 1203 deletions

View file

@ -1420,7 +1420,7 @@ sub booking_update(){
$booking_values->{lock_state} = "$dbt->{copri_conf}->{lock_state}->{$booking->{int20}}";
#user_miniquest_count on operator
my $dbh_primary = $dbt->dbconnect_extern("sharee_primary");
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
my $adref = {
table => "contentadr",
fetch => "one",
@ -1660,7 +1660,7 @@ sub user_rentals_history(){
}
my %operator_hash = ();
if($varenv{dbname} eq "sharee_primary"){
if($varenv{dbname} eq $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
if($auth->{txt17}){
if($auth->{txt17} =~ /\w\s\w/){
%operator_hash = map { $_ => "$dbt->{operator}{$_}->{operatorApp}" } split(/\s+/,$auth->{txt17});
@ -1707,7 +1707,7 @@ sub rental_to_feedback{
my $show_dialog = {};
if($dbt->{operator}->{$varenv->{dbname}}->{project} eq "Bayern"){
my $dbh_primary = $dbt->dbconnect_extern("sharee_primary");
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
my $adref = {
table => "contentadr",
fetch => "one",
@ -2565,8 +2565,8 @@ sub authout(){
#print Dumper($update);
my $rows = 0;
$rows = $dbt->update_record($dbh,$update,$record);
if($varenv{dbname} ne "sharee_primary"){
my $dbh_prim = $dbt->dbconnect_extern("sharee_primary");
if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
my $dbh_prim = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
$rows = $dbt->update_record($dbh_prim,$update,$record);
}
if($rows == 1){
@ -2634,9 +2634,9 @@ sub auth_verify(){
#$bw->log("auth_verified on operator $varenv{dbname} anchor 1",$auth_operator->{c_id},"");
#just part of operator-routing (sharee account management)
if($varenv{dbname} ne "sharee_primary"){
if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
#primary select
my $dbh_primary = $dbt->dbconnect_extern("sharee_primary");
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
$auth_primary = $dbt->fetch_record($dbh_primary,$authref);
if($auth_primary->{c_id} && $auth_primary->{c_id} > 0){
@ -2748,14 +2748,14 @@ sub auth_verify(){
#$bw->log("auth_verified on primary anchor 4 FAILS by dbname $varenv{dbname}.",$auth_primary->{c_id},"");
print FILE "auth_verified on primary anchor 4 FAILS by dbname $varenv{dbname} | pri $auth_primary->{c_id}\n" if($debug);
}
}else{# if($varenv{dbname} eq "sharee_primary")
}else{# if($varenv{dbname} eq $dbt->{primary}->{sharee_primary}->{database}->{dbname})
$auth_primary = $dbt->fetch_record($dbh,$authref);
#$bw->log("auth_verified on operator anchor 4 by dbname $varenv{dbname}",$auth_primary->{c_id},"");
print FILE "auth_verified on operator anchor 4 by dbname $varenv{dbname} | pri $auth_primary->{c_id}\n" if($debug);
$record = $auth_primary;
}#end if($varenv{dbname} ne "sharee_primary")
}#end if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname})
if($varenv{dbname} ne "sharee_primary"){
if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv{dbname},$record,$q->param('authcookie'));
}
@ -2831,7 +2831,7 @@ sub auth_verify(){
#Servicetool only users with users.int09=1
#shareetool
if($varenv{dbname} ne "sharee_primary" && $return->{merchant_id} && $dbt->{merchant_ids}->{$return->{merchant_id}}->{id} && $dbt->{merchant_ids}->{$return->{merchant_id}}->{id} == 187){
if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname} && $return->{merchant_id} && $dbt->{merchant_ids}->{$return->{merchant_id}}->{id} && $dbt->{merchant_ids}->{$return->{merchant_id}}->{id} == 187){
my $users_serviceapp = { u_id => 0 };
$users_serviceapp = $dbt->select_users($dbh,$record->{c_id},"and int09=1");
#$bw->log("users_serviceapp: $users_serviceapp->{u_id} && $varenv{dbname} && $return->{merchant_id} && $dbt->{merchant_ids}->{$return->{merchant_id}}->{id}","","");
@ -2888,14 +2888,14 @@ sub authorization(){
#Servicetool, only users with users.int09=1
#shareetool
if($varenv{dbname} ne "sharee_primary" && $aowner && $aowner eq "187"){
if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname} && $aowner && $aowner eq "187"){
my $users_serviceapp = { u_id => 0 };
$users_serviceapp = $dbt->select_users($dbh,$record->{c_id},"and int09=1");
$record = { c_id => 0 } if(!$users_serviceapp->{u_id});
}else{
#2021-10-13 because of keep DMS authcookie
#2021-12-23 user must always be registered on sharee_primary
$dbh = $dbt->dbconnect_extern("sharee_primary") if($varenv{dbname} ne "sharee_primary");
$dbh = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname}) if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname});
$record = $dbt->fetch_record($dbh,$authref);
}
$return = $self->authcookie_manager($dbh,$q,$record,$merchant_id,$hw_id,$aowner);
@ -2978,7 +2978,7 @@ sub authcookie_manager {
my $rows = $dbt->update_record($dbh,$update,$record);
#update also operator cookies
if($varenv{dbname} eq "sharee_primary" && $record->{txt17}){
if($varenv{dbname} eq $dbt->{primary}->{sharee_primary}->{database}->{dbname} && $record->{txt17}){
my $auth_primary = $record;
my %operator_hash = ();
if($auth_primary->{txt17} =~ /\w\s\w/){

View file

@ -67,7 +67,7 @@ my $response = {
apiserver => "$apiserver",
response => "$respreq",
uri_primary => "$dbt->{primary}->{sharee_primary}->{primaryApp}",
copri_version => "4.1.22.6",
copri_version => "4.1.22.19",
user_id => "",
authcookie => "",
new_authcoo => "0",

View file

@ -419,8 +419,8 @@ sub sig_booking {
my $endpoint = "$dbt->{operator}->{$varenv->{dbname}}->{endpoint}/";
my %json = ();
$ctadr->{txt08} =~ s/n/m/i; $ctadr->{txt08} =~ s/i/j/i; $ctadr->{txt08} =~ s/l/i/i; $ctadr->{txt08} =~ s/-/\./; $ctadr->{txt08} =~ s/_/-/; $ctadr->{txt08} =~ s/[a-z]\@/\@/;
$ctadr->{txt08} =~ s/[a-z]-/-/; $ctadr->{txt08} =~ s/[a-z]_/_/; $ctadr->{txt08} =~ s/[a-z]\@/\@/i;
$ctadr->{txt08} =~ s/[a-z]\./\./ if($ctadr->{txt08} =~ /\.\w+\@/);
#reservation start
if($todo eq "reserve"){
$endpoint .= "bikes/reserve";

View file

@ -56,7 +56,7 @@ sub dbconnect_extern {
my $self = shift;
my $dbname = shift;
my $instance_type = "operator";
$instance_type = "primary" if($dbname eq "sharee_primary");
$instance_type = "primary" if($dbname eq $self->{primary}->{sharee_primary}->{database}->{dbname});
my $globalconf_file = "/var/www/copri4/shareeconf/global.cfg";
my $conf = Config::General->new($globalconf_file);
@ -122,7 +122,7 @@ sub update_operatorsloop {
template_id => "202",
c_id => "$adrc_id",
};
my $dbh_primary = $self->dbconnect_extern("sharee_primary");
my $dbh_primary = $self->dbconnect_extern($self->{primary}->{sharee_primary}->{database}->{dbname});
my $source_primary = $dbh_primary->get_info( $GetInfoType{SQL_DATABASE_NAME} );
my $record_primary = { c_id => 0 };
$record_primary = $self->fetch_record($dbh_primary,$authref) if($adrc_id && $adrc_id > 0);
@ -133,8 +133,7 @@ sub update_operatorsloop {
if($record_primary->{c_id}){
my %operator_hash = ();
#keep in mind, shareedms-operators updates sharee_primary, that's because we have to also loop
#if($dbname eq "sharee_primary"){
#keep in mind, shareedms-operators updates primary, that's because we have to also loop
if($record_primary->{txt17}){
if($record_primary->{txt17} =~ /\w\s\w/){
%operator_hash = map { $_ => "$self->{operator}{$_}->{operatorApp}" } split(/\s+/,$record_primary->{txt17});
@ -148,8 +147,7 @@ sub update_operatorsloop {
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 eq \"sharee_primary\"","","");
#if($sharee_operator ne "$dbname" || $record_primary->{owner} == 197 || $dbname eq "sharee_primary"){
$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->{txt15};#Bonusnr
@ -276,12 +274,11 @@ sub users_map(){
sub channel_map(){
my $self = shift;
my $channel = {
167 => "sig cmd",
#167 => "sig cmd",
168 => "shareeio",
169 => "sigo connector",
172 => "reserve timeout",
#173 => "merchant fallback",#mig
#175 => "example App",#mig
176 => "Mein konrad App",#mig
177 => "LastenradBay App",#mig
179 => "cronjob",
@ -296,13 +293,16 @@ sub channel_map(){
188 => "sys API",
192 => "web Bayern",
#193 => "web demo",#mig
#194 => "web example",#mig
195 => "web konrad",#mig and import
196 => "copri",#mig
197 => "web sharee.bike",#mig
198 => "primary",#mig
199 => "LV API",#mig
201 => "web Renta",#mig
294 => "example Web",#mig
295 => "example App",#mig
296 => "example Op",#mig
298 => "example Pr",#mig
};
return $channel;
}
@ -385,6 +385,17 @@ sub collect_node {
return ($nodes,$rows);
}
#
sub collect_relation {
my $self = shift;
my $dbh = shift || $dbh_intern;
my $main_id = shift || "";
my $sth = $dbh->prepare("SELECT * FROM relation");
my $rc = $sth->execute();
my $rel = $sth->fetchall_hashref("rel_id");
return $rel;
}
# Nodes einer Ebene mit relation
sub collect_noderel {
my $self = shift;
@ -1234,6 +1245,15 @@ sub delete_noderel(){
return $rc;
}
sub delete_relation(){
my $self = shift;
my $dbh = shift || $dbh_intern;
my $rel_id = shift;
my $sth = $dbh->prepare("DELETE FROM relation WHERE rel_id=$rel_id");
my $rc = $sth->execute();
return $rc;
}
sub delete_template(){
my $self = shift;
my $dbh = shift || $dbh_intern;
@ -1448,7 +1468,7 @@ sub insert_contenttrans(){
my $owner = shift || 0;
$owner="199" if(!$owner);
my $sth = $dbh->prepare("INSERT INTO contenttrans (ct_name,txt00,int10,txt02,txt01,txt03,txt06,txt07,txt08,txt09,txt15,txt17,txt18,txt19,owner,itime) VALUES('$invoice_nr','Rechnung','$ctadr->{c_id}','$ctadr->{txt02}','$ctadr->{txt01}','$ctadr->{txt03}','$ctadr->{txt06}','$ctadr->{txt07}','$ctadr->{txt08}','$ctadr->{txt09}','$ctadr->{txt15}','$ctadr->{txt17}','$ctadr->{txt18}','$ctadr->{txt19}','$owner','now()') RETURNING c_id");
my $sth = $dbh->prepare("INSERT INTO contenttrans (ct_name,txt00,int10,txt02,txt01,txt03,txt06,txt07,txt08,owner,itime) VALUES('$invoice_nr','Rechnung','$ctadr->{c_id}','$ctadr->{txt02}','$ctadr->{txt01}','$ctadr->{txt03}','$ctadr->{txt06}','$ctadr->{txt07}','$ctadr->{txt08}','$owner','now()') RETURNING c_id");
my $rows = $sth->execute();
my $last_id;

View file

@ -64,7 +64,7 @@ sub handler {
#request primary will jsonclient loop_sharees
my $uri_request = $dbt->{primary}->{sharee_primary}->{primaryApp};
#detect DMS, because this will do it directly without loop_sharees
$uri_request = $dbt->{operator}->{$varenv{dbname}}->{operatorApp} if($varenv{dbname} ne "sharee_primary" && $varenv{syshost} =~ /shareedms-/);
$uri_request = $dbt->{operator}->{$varenv{dbname}}->{operatorApp} if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname} && $varenv{syshost} =~ /shareedms-/);
if($R::request eq "stations_available"){
station_information($api_return,\%varenv,$users_sharee,$uri_request,$project);

View file

@ -309,7 +309,7 @@ sub handler {
#DMS Kunden rw
if($R::base_edit && $node_meta->{ct_table} eq "contentadr"){
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::c_id with: $R::base_edit","","");
my $dbh_primary = $dbt->dbconnect_extern("sharee_primary");
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
my $users_dms_primary = { u_id => 0 };
$users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int02 >= 1");
@ -365,7 +365,7 @@ sub handler {
#DMS Faktura
if($node_meta->{ct_table} eq "contenttrans"){
$bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}|$R::c_id4trans,$R::tpl_id4trans with: $R::ct_trans","","");
my $dbh_primary = $dbt->dbconnect_extern("sharee_primary");
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
my $users_dms_primary = { u_id => 0 };
$users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int02 >= 1");

View file

@ -1,262 +0,0 @@
package Mod::KMLout;
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
#
#without login only public Stations have to be viewable:
#https://shareeapp-primary.copri-bike.de/KMLout
#
#with login and valid autcookie:
#https://shareeapp-primary.copri-bike.de/KMLout?sessionid=a49aba2b5440be72816db2_rafo87znqx
#
#
use warnings;
use strict;
use POSIX;
use Exporter;
our @ISA = qw (Exporter);
use CGI::Cookie ();
use CGI ':standard';
use Apache2::Const -compile => qw(OK );
use Scalar::Util qw(looks_like_number);
use JSON;
use LWP::UserAgent;
use Lib::Config;
use Mod::DBtank;
use Mod::APIfunc;
use Mod::Basework;
use Data::Dumper;
my $bw = new Basework;
sub handler {
my $r = shift;
my $q = new CGI;
$q->import_names('R');
my $dbt = new DBtank;
my $apif = new APIfunc;
my $cf = new Config;
my %varenv = $cf->envonline();
my $coo = $q->cookie('domcookie') || $R::sessionid || "";
my $users_sharee = { c_id => 0 };
my $api_return = { authcookie => '' };
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
if($dbt->{website}->{$varenv{syshost}}->{merchant_id}){
$api_return->{authcookie} = $dbt->{website}->{$varenv{syshost}}->{merchant_id} if(!$api_return->{authcookie});
}elsif($dbt->{operator}->{$varenv{dbname}}->{merchant_id}){
$api_return->{authcookie} = $dbt->{operator}->{$varenv{dbname}}->{merchant_id} if(!$api_return->{authcookie});
}elsif($dbt->{primary}->{$varenv{dbname}}->{merchant_id}){
$api_return->{authcookie} = $dbt->{primary}->{$varenv{dbname}}->{merchant_id} if(!$api_return->{authcookie});
}
$users_sharee->{c_id} = "0" if(!$users_sharee->{c_id});
$bw->log("kmlGenerator handler with api_return: ",$api_return,"");
my $kmlfile = kmlGenerator($api_return,\%varenv,$users_sharee);
#print $q->header();
#print out kml file, used by Karte.pm js maps
if(1==1){
print $q->header(-type => "application/vnd.google-earth.kml+xml", -charset=>"utf-8");
if (open(my $fh, '<', "$varenv{basedir}/xml/$kmlfile")) {
while (my $row = <$fh>) {
print "$row";
}
}
}
return Apache2::Const::OK;
}
sub kmlGenerator {
my $authcookie = shift || { authcookie => '' };
my $varenv = shift;
my $users_sharee = shift || { c_id => 0 };
$users_sharee->{c_id} = "0" if(!$users_sharee->{c_id});
my $dbt = new DBtank;
my $json = JSON->new->allow_nonref;
my $project = "all";
$project = $dbt->{website}->{$varenv->{syshost}}->{project} if($dbt->{website}->{$varenv->{syshost}}->{project});
$project = $dbt->{operator}->{$varenv->{dbname}}->{project} if($dbt->{operator}->{$varenv->{dbname}}->{project});
#print "$project | $varenv->{syshost} | $users_sharee->{c_id} | $authcookie->{authcookie}";
my $icon_green = "Open_Green.png";
my $icon_red = "Open_Red.png";
my $icon_blue = "Open_Blue.png";
if($project eq "Bayern"){
$icon_green = "LastenradBay_Standortpfeil_gruen_03a.png";
$icon_red = "LastenradBay_Standortpfeil_rot_03a.png";
$icon_blue = "LastenradBay_Standortpfeil_blau_03a.png";
#$icon_green = "LastenradBay-custom-marker-gruen.png";
#$icon_red = "LastenradBay-custom-marker-rot.png";
#$icon_blue = "LastenradBay-custom-marker-bayblau.png";
}
my $timestamp = strftime "%Y%m%d%H%M%S", localtime;
my $kmlfile = "sharee-$timestamp-$users_sharee->{c_id}.kml";
$bw->log("kmlGenerator with: ",$kmlfile,"");
#request primary will jsonclient loop_sharees
my $uri_request = $dbt->{primary}->{sharee_primary}->{primaryApp};
#detect DMS, because this will do it directly without loop_sharees
$uri_request = $dbt->{operator}->{$varenv->{dbname}}->{operatorApp} if($varenv->{dbname} ne "sharee_primary" && $varenv->{syshost} =~ /shareedms-/);
my $rest_stations = "request=stations_available&project=$project&authcookie=$authcookie->{authcookie}";
my $rest_bikes = "request=bikes_available&project=$project&authcookie=$authcookie->{authcookie}";
my $station_hash = {};
my $bike_hash = {};
my $lastenrad = 300101;
my $e_lastenrad = 300102;
my $stadtrad = 300103;
my %place_name;
my %place_desc;
my %place_pin;
my %place_longitude;
my %place_latitude;
#reading shareejson
my $stations_json = fetch_primary_json("",$uri_request,$rest_stations);
my $bikes_json = fetch_primary_json("",$uri_request,$rest_bikes);
open(XML,">$varenv->{basedir}/xml/$kmlfile") || die "$0 can not write $!";
print XML "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
print XML "<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n";
print XML "<Document>\n";
print XML "<name>sharee.bike</name>\n";
print XML "<description>bike stations for $users_sharee->{c_id}</description>\n";
if($stations_json && $bikes_json){
#decode json to hash
my $response_stations = decode_json($stations_json);
my $response_bikes = decode_json($bikes_json);
#BIG LOOP
#loop stations hash
foreach my $station (keys (%{ $response_stations->{shareejson}->{stations} })) {
$station_hash->{$station} = $response_stations->{shareejson}->{stations}->{$station};
$place_pin{$station} = $icon_red;
my $station_desc = "Mietradstation $station";
if($response_stations->{shareejson}->{stations}->{$station}->{description}){
$station_desc = "Mietradstation: $response_stations->{shareejson}->{stations}->{$station}->{description} $station";
#$bw->log("KMLout station_desc: ",$station_desc,"");
}
$place_name{$station} = "$station_desc";
if($response_stations->{shareejson}->{stations}->{$station}->{state} eq "available" && $response_stations->{shareejson}->{stations}->{$station}->{gps}->{latitude} =~ /\d{1,2}\.\d+/ && $response_stations->{shareejson}->{stations}->{$station}->{gps}->{longitude} =~ /\d{1,2}\.\d+/){
$place_latitude{$station} = $response_stations->{shareejson}->{stations}->{$station}->{gps}->{latitude};
$place_longitude{$station} = $response_stations->{shareejson}->{stations}->{$station}->{gps}->{longitude};
$place_desc{$station} = "";
#print "\n--- Station $station hat folgende Räder ---\n";
#loop station_group array
foreach my $station_group (@{ $response_stations->{shareejson}->{stations}->{$station}->{station_group} }){
#print "station_group ($station): " . $station_group . "\n";
my $station_groupID = 0;
#loop bikes hash
foreach my $bike (keys (%{ $response_bikes->{shareejson}->{bikes} })) {
$bike_hash->{$bike} = $response_bikes->{shareejson}->{bikes}->{$bike};
#loop bike_group array
foreach my $bike_group (@{ $response_bikes->{shareejson}->{bikes}->{$bike}->{bike_group} }){
#print "bike_group ($bike): " . $bike_group . "\n";
my $bike_groupID = 0;
$station_groupID = $1 if($station_group =~ /(\d+)/);
$bike_groupID = $1 if($bike_group =~ /(\d+)/);
#$bw->log("KMLout bike available if: $station_groupID == $bike_groupID && $station eq $response_bikes->{shareejson}->{bikes}->{$bike}->{station}","","");
#if Lastenrad
if($station_groupID == $lastenrad && $station_groupID == $bike_groupID && $station eq $response_bikes->{shareejson}->{bikes}->{$bike}->{station}){
$place_pin{$station} = $icon_green;
$place_desc{$station} .= "<p align='left'>&bull; Verfügbar: $response_bikes->{shareejson}->{bikes}->{$bike}->{description} $bike</p>";
#print "($station) Lastenrad $bike\n";
}
#if E-Lastenrad
if($station_groupID == $e_lastenrad && $station_groupID == $bike_groupID && $station eq $response_bikes->{shareejson}->{bikes}->{$bike}->{station}){
$place_pin{$station} = $icon_green;
$place_desc{$station} .= "<p align='left'>&bull; Verfügbar: $response_bikes->{shareejson}->{bikes}->{$bike}->{description} $bike</p>";
#print "($station) E-Lastenrad $bike\n";
}
#if Stadtrad
if($station_groupID == $stadtrad && $station_groupID == $bike_groupID && $station eq $response_bikes->{shareejson}->{bikes}->{$bike}->{station}){
$place_pin{$station} = $icon_green;
$place_desc{$station} .= "<p align='left'>&bull; Verfügbar: $response_bikes->{shareejson}->{bikes}->{$bike}->{description} $bike</p>";
#print "($station) Stadtrad $bike\n";
}
}
}
}
print XML " <Style id=\"$place_pin{$station}\">\n";
print XML " <IconStyle>\n";
print XML " <Icon>\n";
print XML " <href>$varenv->{metahost}/img/$place_pin{$station}</href>\n";
print XML " </Icon>\n";
print XML " </IconStyle>\n";
print XML " </Style>\n";
print XML " <Placemark>\n";
print XML " <name>$place_name{$station}</name>\n";
print XML " <description><![CDATA[ $place_desc{$station} ]]></description>\n";
print XML " <styleUrl>#$place_pin{$station}</styleUrl>\n";
print XML " <Point>\n";
print XML " <coordinates>$place_longitude{$station}, $place_latitude{$station}</coordinates>\n";
print XML " </Point>\n";
print XML " </Placemark>\n";
}
}#end BIG LOOP
}#end if json
print XML "</Document>\n";
print XML "</kml>\n";
close(XML);
chmod 0666, "$varenv->{basedir}/xml/$kmlfile";
return $kmlfile;
}#end kmlGenerator
#requestor
sub fetch_primary_json {
my $self = shift;
my $primary_server = shift || "";
my $rest = shift || "";
my $primary_request = "$primary_server/APIjsonserver?$rest";
$bw->log("kmlGenerator primary_request: ",$primary_request,"");
#print "GET_json >> " . $primary_request . "\n";
my $ua = LWP::UserAgent->new;
$ua->agent("sharee KMLout");
my $req = HTTP::Request->new(GET => "$primary_request");
$req->content_type('application/x-www-form-urlencoded');
$req->content($rest);
#Pass request to the user agent and get a response back
my $res = $ua->request($req);
# Check the outcome of the response
if ($res->is_success) {
#print $res->content;
return $res->content;
#print $res->status_line, "\n";
}else {
return "";
#print $res->status_line, "\n";
}
}
1;

View file

@ -541,12 +541,11 @@ sub insert_relation(){
# insert relationlist for multi relation in listing mode
sub insert_relationlist(){
my $self = shift;
my ($table,$main_id,$lang,$c_id,$tpl_id,$foreign_key,$mastermain_id,$dbinit) = @_;
my ($table,$main_id,$lang,$c_id,$tpl_id,$foreign_key,$dbinit) = @_;
$dbh = $dbt->dbconnect() if($dbinit);#because of ajax
$c_id = 0 if(!$c_id);
$tpl_id = 0 if(!$tpl_id);
$mastermain_id = 0 if(!$mastermain_id);
my $sth = $dbh->prepare("INSERT INTO relation (main_id,content_id,$foreign_key,template_id,lang,change,mastermain_id) VALUES('$main_id','$c_id','$c_id','$tpl_id','$lang','now()',$mastermain_id) RETURNING rel_id");
my $sth = $dbh->prepare("INSERT INTO relation (main_id,content_id,$foreign_key,template_id,lang,change) VALUES('$main_id','$c_id','$c_id','$tpl_id','$lang','now()') RETURNING rel_id");
my $rows = $sth->execute();
my $last_id;

View file

@ -530,6 +530,10 @@ sub preinit(){
my $table = "contenttrans";
$u_rows += $db->updater($table,"c_id",$R::c_id4trans,"txt22","$R::txt22",$users_dms->{u_id});
}
if($R::warning_state && $R::c_id4trans){
my $table = "contenttrans";
$u_rows += $db->updater($table,"c_id",$R::c_id4trans,"txt19","$R::txt19",$users_dms->{u_id});
}
###SET Relation (like move doc-type)
#executed by Terminal submit-buttons

View file

@ -762,15 +762,13 @@ sub maininit(){
}
#2.2. insert relation for linking
if($R::rel_edit =~ /relate_/){
my $mastermain_id = $R::main_id;
$return_rel_id = $db->insert_relationlist($table,$R::set_main_id,$lang,$R::set_content_id,$R::template_id,$foreign_key,$mastermain_id) if($R::rel_edit =~ /relate_/);
$return_rel_id = $db->insert_relationlist($table,$R::set_main_id,$lang,$R::set_content_id,$R::template_id,$foreign_key) if($R::rel_edit =~ /relate_/);
}
}
}elsif($ctrel_ck->{rel_id} > 1){
return "failure::Abbruch, die Content-Node Relation existiert bereits";
}else{
my $mastermain_id = $R::mastermain_id || $R::main_id;
$return_rel_id = $db->insert_relationlist($table,$R::set_main_id,$lang,$R::set_content_id,$R::template_id,$foreign_key,$mastermain_id);
$return_rel_id = $db->insert_relationlist($table,$R::set_main_id,$lang,$R::set_content_id,$R::template_id,$foreign_key);
}
$i_rows += 1 if($return_rel_id > 0);

View file

@ -506,7 +506,7 @@ sub operator_accounting2calc {
$oac->{int01} = $ctpos->{int01} / 119 * 100 if($key eq "int01" && $ctpos->{int01});#invoice capture netto
if($ctpos->{state} =~ /Lastschrift/){
$oac->{int93} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int01");#7,5%
$oac->{int93} = $oac->{int01} / 100 * $ctf->{$key} if($key eq "int01");#7,5%
$oac->{int93} = sprintf('%.3f', $oac->{int93});
$oac->{int98} = $oac->{int93} * 0.19 if($oac->{int93});#UmSt auf 7,5%
$oac->{int98} = sprintf('%.3f', $oac->{int98});
@ -519,7 +519,7 @@ sub operator_accounting2calc {
$oac->{int97} = 0;
}
if($ctpos->{state} =~ /Kreditkarte/){
$oac->{int93} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int01");#7,5%
$oac->{int93} = $oac->{int01} / 100 * $ctf->{$key} if($key eq "int01");#7,5%
$oac->{int93} = sprintf('%.3f', $oac->{int93});
$oac->{int98} = $oac->{int93} * 0.19 if($oac->{int93});#UmSt auf 7,5%
$oac->{int98} = sprintf('%.3f', $oac->{int98});
@ -536,7 +536,7 @@ sub operator_accounting2calc {
$oac->{int02} = $oac->{int01} + $oac->{int94} + $oac->{int95} + $oac->{int96} + $oac->{int97};
$oac->{int02} = sprintf('%.3f', $oac->{int02});
#operator invoice
$oac->{int100} = ($oac->{int93} + $oac->{int98}) * -1;
$oac->{int100} = $oac->{int93} + $oac->{int98};
$oac->{int100} = sprintf('%.3f', $oac->{int100});
}
}

View file

@ -320,7 +320,10 @@ td {
$height = "200px;";
$margin = "0;";
}
print $q->div({-style=>"$position width:$width;text-align:right;border:0px solid black;margin:$margin"},"$line",$q->img({-src=>"$varenv->{metahost}/img/$ctf->{img01}",-height=>"$height"})),"\n";
my $logo = $ctf->{img01};
$logo = "Logo-sharee_right.png" if($ctt->{int10} == 2);
print $q->div({-style=>"$position width:$width;text-align:right;border:0px solid black;margin:$margin"},"$line",$q->img({-src=>"$varenv->{metahost}/img/$logo",-height=>"$height"})),"\n";
}#end header_small
#header_big
@ -341,7 +344,9 @@ td {
$margin = "0;";
}
print $q->div({-style=>"width:$width;text-align:right;border:0px solid black;margin:$margin"},$q->img({-src=>"$varenv->{metahost}/img/$ctf->{img01}",-height=>"$height"})),"\n";
my $logo = $ctf->{img01};
$logo = "Logo-sharee_right.png" if($ctt->{int10} == 2);
print $q->div({-style=>"width:$width;text-align:right;border:0px solid black;margin:$margin"},$q->img({-src=>"$varenv->{metahost}/img/$logo",-height=>"$height"})),"\n";
print $q->start_table({-width=>'100%',-border=>'0',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'}),"\n";
print "<tr>\n";
@ -437,7 +442,7 @@ td {
#int9x are not in db
#operator invoice
if($ctt->{txt00} eq "Rechnung"){
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int93=TeilRad Gebühren","int100=Summe");
@tpl_order = ("c_id=ID","int01=Netto Erlös","state=Zahlungsart","int93=Entgeld TeilRad GmbH");
}
#operator accounting
else{
@ -517,7 +522,7 @@ td {
}
elsif($key =~ /int/){
$oac->{$key} =~ s/\./,/;
if($key eq "int02"){
if($key =~ /int02|int93/){
print CSV "$oac->{$key}\n";
}else{
print CSV "$oac->{$key};";
@ -606,7 +611,7 @@ td {
}
print $q->Tr("\n");
print $q->td({-class=>'tdsum',-colspan=>1},"Gesamtbetrag");
print $q->td({-class=>'tdsum',-colspan=>1},"Entgeld TeilRad GmbH");
print $q->td({-class=>'tdint',-nowrap=>"1"},"$sum_paid €");
}
#Summe Betreiber Abrechnung (Gutschrift)

View file

@ -68,7 +68,7 @@ sub delete_account {
$bw->log("delete_account",$c_id,"");
open(FILE,">>$varenv{logdir}/delete_account.log") if($debug);
my $dbh_primary = $dbt->dbconnect_extern("sharee_primary");
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
my $authref = {
table => "contentadr",
fetch => "one",
@ -80,7 +80,7 @@ sub delete_account {
print FILE "\n*-->DB $varenv{dbname} $now_dt| owner: $owner | c_id: $c_id \n" if($debug);
#First on operator DMS delete and then second on primary delete txt17 operator DB
if($varenv{dbname} ne "sharee_primary"){
if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
$d_rows += $dbt->delete_content($dbh,"contentadr",$c_id);
my $update_primary = {
@ -159,9 +159,9 @@ sub save_account(){
open(FILE,">>$varenv{logdir}/save_account.log") if($debug);
#Always on sharee_primary
if($varenv{dbname} ne "sharee_primary"){
$dbh = $dbt->dbconnect_extern("sharee_primary");
print FILE "\n*-->If no-primary connect DB sharee_primary (mvar: $varmerch->{merchant_id}|$varmerch->{dbname}|$varenv{dbname}) $now_dt| c_id: $c_id| owner: $owner\n" if($debug);
if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
$dbh = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
print FILE "\n*-->If no-primary connect DB $dbt->{primary}->{sharee_primary}->{database}->{dbname} (mvar: $varmerch->{merchant_id}|$varmerch->{dbname}|$varenv{dbname}) $now_dt| c_id: $c_id| owner: $owner\n" if($debug);
}else{
#keep in mind, should be only done by web-app user Formular (primary)
print FILE "\n*-->Else take local copri-Instance DB $varenv{dbname} (mvar: $varmerch->{merchant_id}|$varmerch->{dbname}) $now_dt| c_id: $c_id| owner: $owner\n" if($debug);
@ -256,7 +256,7 @@ sub save_account(){
#only done by App web iframe Anmelde-Registration formular
print FILE "Bonusnr request $_: $valxx\n" if($debug);
if($varenv{dbname} eq "sharee_primary"){
if($varenv{dbname} eq $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
my %txt17 = ();
if($ctadr->{txt17} =~ /\w\s\w/){
%txt17 = map { $_ => 1 } split(/\s+/,$ctadr->{txt17});
@ -387,7 +387,7 @@ sub save_account(){
#sharee txt30=Tarif (multible) and Bonusnummer txt15 automatic
elsif($_ eq "txt30"){
#only done by Operator DMS
if($varenv{dbname} ne "sharee_primary"){
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-
@ -437,7 +437,7 @@ sub save_account(){
}
$u_rows = $dbt->update_one($dbh,$update_primary,"$_='$valxx'");
}
}elsif($_ eq "int12" && $varenv{dbname} ne "sharee_primary"){
}elsif($_ eq "int12" && $varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
my $vde_on_fail = 0;
$vde_on_fail = 2 if($valxx && $valxx == 1);
$u_rows = $dbt->update_one($dbh,$update_primary,"$_=$vde_on_fail");