mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 11:46:27 +01:00
saving user language for cms text select
This commit is contained in:
parent
d9974f57a8
commit
7bc18639ab
10 changed files with 70 additions and 305 deletions
|
@ -3099,6 +3099,7 @@ sub authorization(){
|
||||||
my $q = shift;
|
my $q = shift;
|
||||||
my $merchant_id = shift || $q->param('merchant_id') || "";
|
my $merchant_id = shift || $q->param('merchant_id') || "";
|
||||||
my $hw_id = shift || $q->param('hw_id') || "";
|
my $hw_id = shift || $q->param('hw_id') || "";
|
||||||
|
my $lang = shift || "";
|
||||||
my $aowner = shift || 0;
|
my $aowner = shift || 0;
|
||||||
$dbh = "";
|
$dbh = "";
|
||||||
my %varenv = $cf->envonline();
|
my %varenv = $cf->envonline();
|
||||||
|
@ -3140,7 +3141,7 @@ sub authorization(){
|
||||||
$dbh = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname}) if($varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
$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);
|
$record = $dbt->fetch_record($dbh,$authref);
|
||||||
}
|
}
|
||||||
$return = $self->authcookie_manager($dbh,$q,$record,$merchant_id,$hw_id,$aowner);
|
$return = $self->authcookie_manager($dbh,$q,$record,$merchant_id,$hw_id,$lang,$aowner);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$bw->log("authorization fails because of failing condition: if($user_id && length($user_id) >= 4 && length($user_pw) >= $pw_length && length($hw_id) >= 10 && length($merchant_id) >= 8)","","");
|
$bw->log("authorization fails because of failing condition: if($user_id && length($user_id) >= 4 && length($user_pw) >= $pw_length && length($hw_id) >= 10 && length($merchant_id) >= 8)","","");
|
||||||
|
@ -3153,9 +3154,10 @@ sub authcookie_manager {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$dbh = shift;
|
$dbh = shift;
|
||||||
my $q = shift;
|
my $q = shift;
|
||||||
my $record = shift;
|
my $record = shift || {};
|
||||||
my $merchant_id = shift;
|
my $merchant_id = shift || "";
|
||||||
my $hw_id = shift;
|
my $hw_id = shift || "";
|
||||||
|
my $lang = shift || "";
|
||||||
my $aowner = shift || 0;
|
my $aowner = shift || 0;
|
||||||
|
|
||||||
my $user_agent = $q->user_agent();
|
my $user_agent = $q->user_agent();
|
||||||
|
@ -3176,6 +3178,7 @@ sub authcookie_manager {
|
||||||
#owner => "198",#update initiated by primary
|
#owner => "198",#update initiated by primary
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$update->{txt11} = $q->escapeHTML($lang) if($lang);
|
||||||
$update->{txt21} = $q->escapeHTML($q->param('user_device')) if($q->param('user_device'));
|
$update->{txt21} = $q->escapeHTML($q->param('user_device')) if($q->param('user_device'));
|
||||||
$update->{txt25} = $q->escapeHTML($clientIP) if($clientIP);
|
$update->{txt25} = $q->escapeHTML($clientIP) if($clientIP);
|
||||||
$update->{txt26} = $q->escapeHTML($user_agent) if($user_agent);
|
$update->{txt26} = $q->escapeHTML($user_agent) if($user_agent);
|
||||||
|
|
|
@ -198,7 +198,7 @@ elsif($q->param('request') eq "authorization"){
|
||||||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||||
$response = { %$response, %$return_merchant };
|
$response = { %$response, %$return_merchant };
|
||||||
|
|
||||||
my ($auth,$authraw) = $apif->authorization($q,"","",$aowner);
|
my ($auth,$authraw) = $apif->authorization($q,"","",$lang,$aowner);
|
||||||
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
||||||
$response = { %$response, %$auth };
|
$response = { %$response, %$auth };
|
||||||
$response->{response_text} = "Herzlich willkommen im Fahrradmietsystem";
|
$response->{response_text} = "Herzlich willkommen im Fahrradmietsystem";
|
||||||
|
|
|
@ -120,7 +120,7 @@ sub handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
#do updates on invoice by payone transaction data on matching TXID
|
#do updates on invoice by payone transaction data on matching TXID
|
||||||
if($txid && looks_like_number($receivable) && looks_like_number($update_ctt->{int16})){
|
if($txid && looks_like_number($update_ctt->{int19}) && looks_like_number($update_ctt->{int16})){
|
||||||
my $ctt = { c_id => 0 };
|
my $ctt = { c_id => 0 };
|
||||||
my $ctadr = { c_id => 0 };
|
my $ctadr = { c_id => 0 };
|
||||||
my $fetch_ctt = {
|
my $fetch_ctt = {
|
||||||
|
@ -141,7 +141,7 @@ sub handler {
|
||||||
|
|
||||||
if($ctt->{c_id} > 0){
|
if($ctt->{c_id} > 0){
|
||||||
|
|
||||||
#balance > 0 then payment fails
|
#balance > 0 then preauthorization or payment fails
|
||||||
if($update_ctt->{int16} && $update_ctt->{int16} > 0){
|
if($update_ctt->{int16} && $update_ctt->{int16} > 0){
|
||||||
$update_adr->{int12} = $vde_on_fail;
|
$update_adr->{int12} = $vde_on_fail;
|
||||||
$update_ctt->{int14} = 1;
|
$update_ctt->{int14} = 1;
|
||||||
|
@ -153,6 +153,13 @@ sub handler {
|
||||||
$update_ctt->{txt28} = "$now_dt $txaction\n" . $ctt->{txt28};
|
$update_ctt->{txt28} = "$now_dt $txaction\n" . $ctt->{txt28};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Testing, if capture price ne receivable, then capture fails
|
||||||
|
if($txaction eq "capture" && $update_ctt->{int16} == 0 && $ctt->{int01} != $update_ctt->{int19}){
|
||||||
|
$update_adr->{int12} = $vde_on_fail;
|
||||||
|
$update_ctt->{int14} = 1;
|
||||||
|
$update_ctt->{txt28} = "capture failed\n" . $ctt->{txt28};
|
||||||
|
}
|
||||||
|
|
||||||
$dbt->update_record($dbh,$update_ctt,$ctt);
|
$dbt->update_record($dbh,$update_ctt,$ctt);
|
||||||
print FILE Dumper($update_ctt) . "\n";
|
print FILE Dumper($update_ctt) . "\n";
|
||||||
|
|
||||||
|
|
|
@ -1,271 +0,0 @@
|
||||||
package Mod::APIxmlserver;
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
|
||||||
#
|
|
||||||
#Server for sharee xml api
|
|
||||||
#
|
|
||||||
##In DB context $q->escapeHTML must always done by API
|
|
||||||
#
|
|
||||||
#use lib qw(/var/www/copri-bike/shareeapp-lv/src);
|
|
||||||
use warnings;
|
|
||||||
use strict;
|
|
||||||
use Exporter;
|
|
||||||
our @ISA = qw (Exporter);
|
|
||||||
|
|
||||||
use POSIX;
|
|
||||||
use CGI;
|
|
||||||
use Apache2::Const -compile => qw(OK );
|
|
||||||
use Scalar::Util qw(looks_like_number);
|
|
||||||
use LWP::UserAgent;
|
|
||||||
use XML::Simple qw(:strict);
|
|
||||||
|
|
||||||
use Lib::Config;
|
|
||||||
use Mod::DBtank;
|
|
||||||
use Mod::Basework;
|
|
||||||
use Mod::Shareework;
|
|
||||||
use Mod::APIfunc;
|
|
||||||
use Digest::MD5 qw(md5 md5_hex);
|
|
||||||
use Data::Dumper;
|
|
||||||
use Sys::Hostname;
|
|
||||||
my $hostname = hostname;
|
|
||||||
|
|
||||||
sub handler {
|
|
||||||
my ($r) = @_;
|
|
||||||
my $q = new CGI;
|
|
||||||
my $netloc = $q->url(-base=>1);
|
|
||||||
#$q->import_names('R');
|
|
||||||
my $cf = new Config;
|
|
||||||
my $dbt = new DBtank;
|
|
||||||
my $bw = new Basework;
|
|
||||||
my $tk = new Shareework;
|
|
||||||
my $apif = new APIfunc;
|
|
||||||
|
|
||||||
my %varenv = $cf->envonline();
|
|
||||||
my $oprefix = $dbt->{operator}->{$varenv{dbname}}->{oprefix};
|
|
||||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
|
||||||
my $lang="de";
|
|
||||||
my $owner=199;#LastenVelo api (LV api)
|
|
||||||
my @keywords = $q->param;
|
|
||||||
my $debug=1;
|
|
||||||
my $user_agent = $q->user_agent();
|
|
||||||
my $dbh = "";
|
|
||||||
|
|
||||||
if(1==1){
|
|
||||||
foreach(@keywords){
|
|
||||||
if(length($_) > 20 || length($q->param($_)) > 400){
|
|
||||||
print "<text>Failure 19900: amount of characters in $_ exceeds</text>";
|
|
||||||
return Apache2::Const::OK;
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$bw->log("APIxmlserver request:\n--> user-agent '$user_agent'",$q,"");
|
|
||||||
|
|
||||||
print $q->header(-type => "application/xml", -charset => "utf-8", -'Access-Control-Allow-Origin' => "*");
|
|
||||||
|
|
||||||
open(FILE,">>$varenv{logdir}/APIxmlserver.log") if($debug);
|
|
||||||
print FILE "\n*** $now_dt user-agent: '$user_agent' to syshost: $varenv{syshost}\n" if($debug);
|
|
||||||
print FILE "<=== q dump\n " . Dumper($q) . "\n" if($debug);
|
|
||||||
print FILE "<=== DUMP postdata:\n " . Dumper($q->param('POSTDATA')) . "\n" if($debug);
|
|
||||||
|
|
||||||
#print "Content-type: text/xml\n\n";
|
|
||||||
if($q->param('POSTDATA')){
|
|
||||||
my $xmlref = {};
|
|
||||||
$xmlref = XMLin($q->param('POSTDATA'), ForceArray => ['sharee_LastenVelo'], KeyAttr => [ ] );
|
|
||||||
|
|
||||||
$xmlref->{userID} =~ s/\s//g if($xmlref->{userID});
|
|
||||||
$xmlref->{emailID} =~ s/\s//g if($xmlref->{emailID});
|
|
||||||
if(ref($xmlref) eq "HASH" && $xmlref->{todo} && $xmlref->{emailID} && looks_like_number($xmlref->{userID}) && $xmlref->{userID} =~ /^\d+$/){
|
|
||||||
|
|
||||||
#<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
||||||
# <sharee_LastenVelo>
|
|
||||||
# <todo>add_LVuser</todo>
|
|
||||||
# <userID>12345678</userID>
|
|
||||||
# <emailID>ragu@gu-syems.de</emailID>
|
|
||||||
# <pwID>geheim123</pwID>
|
|
||||||
#</sharee_LastenVelo>
|
|
||||||
|
|
||||||
#für update:
|
|
||||||
#<todo>update_LVuser</todo>
|
|
||||||
#<userID>12345678</userID
|
|
||||||
|
|
||||||
#für delete:
|
|
||||||
#<todo>delete_LVuser</todo>
|
|
||||||
#<userID>12345678</userID
|
|
||||||
|
|
||||||
my $pref = {
|
|
||||||
table => "contentadr",
|
|
||||||
fetch => "one",
|
|
||||||
template_id => "202",
|
|
||||||
int01 => "$xmlref->{userID}",
|
|
||||||
};
|
|
||||||
my $record = { c_id => "" };
|
|
||||||
$record = $dbt->fetch_record($dbh,$pref);
|
|
||||||
|
|
||||||
#select if email still exist
|
|
||||||
my $pref_e = {
|
|
||||||
table => "contentadr",
|
|
||||||
fetch => "one",
|
|
||||||
template_id => "202",
|
|
||||||
txt08 => "ilike::" . $q->escapeHTML($xmlref->{emailID}),
|
|
||||||
};
|
|
||||||
my $record_e = { c_id => "" };
|
|
||||||
$record_e = $dbt->fetch_record($dbh,$pref_e);
|
|
||||||
|
|
||||||
my $c_id = "";
|
|
||||||
$bw->log("$xmlref->{todo}",$xmlref,"");
|
|
||||||
print FILE "xmlref\n " . Dumper($xmlref) . "\n" if($debug);
|
|
||||||
|
|
||||||
if($xmlref->{userID} && $xmlref->{emailID} && $xmlref->{pwID}){
|
|
||||||
if($xmlref->{todo} =~ /add_LVuser|update_LVuser/ && !$record->{c_id} && !$record_e->{c_id}){
|
|
||||||
|
|
||||||
my $teltime = time;
|
|
||||||
my $pwmd5 = md5_hex($q->escapeHTML($xmlref->{pwID}));
|
|
||||||
#$c_id = $tk->create_account($owner);
|
|
||||||
my $insert = {
|
|
||||||
table => "contentadr",
|
|
||||||
main_id => "200011",
|
|
||||||
template_id => "202",
|
|
||||||
mtime => 'now()',
|
|
||||||
atime => 'now()',
|
|
||||||
owner => "$owner",
|
|
||||||
int01 => $q->escapeHTML($xmlref->{userID}),
|
|
||||||
txt08 => $q->escapeHTML($xmlref->{emailID}),
|
|
||||||
txt11 => "$pwmd5",
|
|
||||||
txt17 => "sharee_lv",
|
|
||||||
txt19 => "sharee_lv",
|
|
||||||
int03 => "1",
|
|
||||||
txt22 => "DE11111111111111111111",
|
|
||||||
txt23 => "FRSPDE11111",
|
|
||||||
int04 => "1",
|
|
||||||
int13 => "1",
|
|
||||||
int05 => "1",
|
|
||||||
int14 => "1",
|
|
||||||
int16 => "null",
|
|
||||||
txt01 => "no name",
|
|
||||||
txt03 => "fake str. 1",
|
|
||||||
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",
|
|
||||||
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}){
|
|
||||||
|
|
||||||
my $pwmd5 = md5_hex($xmlref->{pwID});
|
|
||||||
my $update = {
|
|
||||||
table => "contentadr",
|
|
||||||
mtime => 'now()',
|
|
||||||
owner => "$owner",
|
|
||||||
int01 => "$xmlref->{userID}",
|
|
||||||
txt08 => "$xmlref->{emailID}",
|
|
||||||
txt11 => "$pwmd5",
|
|
||||||
int04 => "1",
|
|
||||||
int13 => "1",
|
|
||||||
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});
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $item (keys(%$xmlref)){
|
|
||||||
print "<$item>$xmlref->{$item}</$item>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}elsif(ref($xmlref) eq "HASH" && $xmlref->{todo} && $xmlref->{todo} eq "available" && $xmlref->{bikeID} =~ /\d+/){
|
|
||||||
|
|
||||||
#<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
||||||
#<sharee_LastenVelo>
|
|
||||||
#<todo>available</todo>
|
|
||||||
#<bikeID>17</bikeID>
|
|
||||||
#</sharee_LastenVelo>
|
|
||||||
|
|
||||||
my $bike_id = $1 if($xmlref->{bikeID} =~ /(\d+)/);
|
|
||||||
my $pref_cc = {
|
|
||||||
table => "content",
|
|
||||||
fetch => "one",
|
|
||||||
template_id => "205",
|
|
||||||
barcode => $bike_id,
|
|
||||||
int10 => "!=::1",#if not available
|
|
||||||
};
|
|
||||||
|
|
||||||
my $record_cc = $dbt->fetch_record($dbh,$pref_cc);
|
|
||||||
|
|
||||||
my $update_cc = {
|
|
||||||
table => "content",
|
|
||||||
int10 => "1",
|
|
||||||
mtime => "now()",
|
|
||||||
owner => "$owner",
|
|
||||||
};
|
|
||||||
|
|
||||||
$bw->log("APIxmlserver update to available",$update_cc,"");
|
|
||||||
print FILE "update_cc\n " . Dumper($update_cc) . "\n" if($debug);
|
|
||||||
$dbt->update_record($dbh,$update_cc,$record_cc) if($record_cc->{c_id});
|
|
||||||
|
|
||||||
}elsif(ref($xmlref) eq "HASH" && $xmlref->{todo} && $xmlref->{todo} eq "requested" && $xmlref->{bikeID} =~ /\d+/){
|
|
||||||
|
|
||||||
#<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
||||||
#<sharee_LastenVelo>
|
|
||||||
#<todo>requested</todo>
|
|
||||||
#<bikeID>17</bikeID>
|
|
||||||
#<userID>123456</userID>
|
|
||||||
#<emailID>mail@here.de</emailID>
|
|
||||||
#</sharee_LastenVelo>
|
|
||||||
|
|
||||||
}#end if(ref($xmlref)
|
|
||||||
else{
|
|
||||||
print "<text>Hossa, kein valides xml</text>";
|
|
||||||
}
|
|
||||||
}#end if($q->param('POSTDATA'))
|
|
||||||
else{
|
|
||||||
print "<text>NO DATA</text>";
|
|
||||||
}
|
|
||||||
|
|
||||||
close(FILE) if($debug);
|
|
||||||
return Apache2::Const::OK;
|
|
||||||
}
|
|
||||||
1;
|
|
|
@ -1595,7 +1595,7 @@ sub insert_contenttrans(){
|
||||||
my $owner = shift || 0;
|
my $owner = shift || 0;
|
||||||
|
|
||||||
$owner="199" if(!$owner);
|
$owner="199" if(!$owner);
|
||||||
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 $sth = $dbh->prepare("INSERT INTO contenttrans (ct_name,txt00,int10,txt02,txt01,txt03,txt06,txt07,txt08,txt10,txt11,owner,itime) VALUES('$invoice_nr','Rechnung','$ctadr->{c_id}','$ctadr->{txt02}','$ctadr->{txt01}','$ctadr->{txt03}','$ctadr->{txt06}','$ctadr->{txt07}','$ctadr->{txt08}','$ctadr->{txt10}','$ctadr->{txt11}','$owner','now()') RETURNING c_id");
|
||||||
|
|
||||||
my $rows = $sth->execute();
|
my $rows = $sth->execute();
|
||||||
my $last_id;
|
my $last_id;
|
||||||
|
|
|
@ -66,8 +66,7 @@ sub handler {
|
||||||
|
|
||||||
my $lang = "en";
|
my $lang = "en";
|
||||||
$lang = $1 if($q->http('Accept-Language') =~ /^(\w+)/);
|
$lang = $1 if($q->http('Accept-Language') =~ /^(\w+)/);
|
||||||
#$lang = lc($R::lang) if($R::lang);
|
$lang = lc($lang) if($lang);
|
||||||
#print $lang;
|
|
||||||
|
|
||||||
my $feedb = {
|
my $feedb = {
|
||||||
c_id => "",
|
c_id => "",
|
||||||
|
@ -140,7 +139,7 @@ sub handler {
|
||||||
|
|
||||||
my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co
|
my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co
|
||||||
#3. authorize
|
#3. authorize
|
||||||
my $author = $apif->authorization($q,$varenv{merchant_id},$hw_id,$aowner);#$co like browser hw_id
|
my $author = $apif->authorization($q,$varenv{merchant_id},$hw_id,$lang,$aowner);#$co like browser hw_id
|
||||||
#4. verify and get user values
|
#4. verify and get user values
|
||||||
($api_return,$users_sharee) = $apif->auth_verify($q,$author->{authcookie},"");
|
($api_return,$users_sharee) = $apif->auth_verify($q,$author->{authcookie},"");
|
||||||
|
|
||||||
|
@ -199,7 +198,7 @@ sub handler {
|
||||||
#Like login_sharee, redundant
|
#Like login_sharee, redundant
|
||||||
my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co
|
my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co
|
||||||
#3. authorize
|
#3. authorize
|
||||||
my $author = $apif->authorization($q,$varenv{merchant_id},$hw_id,$aowner);#$co like browser hw_id
|
my $author = $apif->authorization($q,$varenv{merchant_id},$hw_id,$lang,$aowner);#$co like browser hw_id
|
||||||
#print "3. authorize: " . $author->{authcookie} . " -- " . $q->param('authcookie') . " ++ " . $coo . "<br>";
|
#print "3. authorize: " . $author->{authcookie} . " -- " . $q->param('authcookie') . " ++ " . $coo . "<br>";
|
||||||
|
|
||||||
#4. verify and get user values
|
#4. verify and get user values
|
||||||
|
@ -264,15 +263,13 @@ sub handler {
|
||||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}$session");
|
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}$session");
|
||||||
exit 0;
|
exit 0;
|
||||||
}elsif($users_sharee->{c_id} && !$payable_check){
|
}elsif($users_sharee->{c_id} && !$payable_check){
|
||||||
#print redirect("$varenv{wwwhost}/$varenv{mandant}/$varenv{profile}");
|
|
||||||
#print redirect("$varenv{wwwhost}/$varenv{mandant}/$varenv{start}");
|
|
||||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_2}$session");
|
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_2}$session");
|
||||||
exit 0;
|
exit 0;
|
||||||
}elsif(!$users_sharee->{c_id} || ($users_sharee->{c_id} && $users_sharee->{c_id} !~ /^\d+$/)){
|
}elsif(!$users_sharee->{c_id} || ($users_sharee->{c_id} && $users_sharee->{c_id} !~ /^\d+$/)){
|
||||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Anmelden?failure=1$session_and");
|
print redirect("$varenv{wwwhost}/$varenv{mandant}/Anmelden?failure=1$session_and");
|
||||||
exit 0;
|
exit 0;
|
||||||
}else{
|
}else{
|
||||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/$varenv{profile}$session");
|
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}$session");
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -582,7 +579,7 @@ sub handler {
|
||||||
|
|
||||||
$dbt->update_operatorsloop($varenv{dbname},$users_sharee->{c_id},"update");
|
$dbt->update_operatorsloop($varenv{dbname},$users_sharee->{c_id},"update");
|
||||||
|
|
||||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/$varenv{profile}?$returnwww$session_and");
|
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?$returnwww$session_and");
|
||||||
exit 0;
|
exit 0;
|
||||||
}else{
|
}else{
|
||||||
$update_adr->{txt28} = $now_dt . " else pseudocardpan\n" . $q->escapeHTML($payone_return);
|
$update_adr->{txt28} = $now_dt . " else pseudocardpan\n" . $q->escapeHTML($payone_return);
|
||||||
|
|
|
@ -63,7 +63,7 @@ sub mail_transport(){
|
||||||
|
|
||||||
my $ret = 1;
|
my $ret = 1;
|
||||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||||
open(EMA, ">> $dbt->{copri_conf}->{logdir}/mailTransport.log");
|
open(EMA, ">> $dbt->{copri_conf}->{logdir}/MailTransport.log");
|
||||||
|
|
||||||
my $mail_from = $sendref->{mail_from} || $mailxconf->{$sendref->{mailxcfg}}->{mail_from};
|
my $mail_from = $sendref->{mail_from} || $mailxconf->{$sendref->{mailxcfg}}->{mail_from};
|
||||||
my $mail_to = $sendref->{mail_to} || $mailxconf->{$sendref->{mailxcfg}}->{mail_to};
|
my $mail_to = $sendref->{mail_to} || $mailxconf->{$sendref->{mailxcfg}}->{mail_to};
|
||||||
|
@ -109,7 +109,7 @@ sub mail_transport(){
|
||||||
$smtp->datasend("To: $mail_to\n");
|
$smtp->datasend("To: $mail_to\n");
|
||||||
$smtp->datasend("Bcc: $mail_bcc\n") if($mail_bcc);
|
$smtp->datasend("Bcc: $mail_bcc\n") if($mail_bcc);
|
||||||
$smtp->datasend("Subject: $subject\n");
|
$smtp->datasend("Subject: $subject\n");
|
||||||
#$smtp->datasend("\n") if(!$attachBinaryFile);
|
$smtp->datasend("\t\n") if(!$attachBinaryFile);
|
||||||
$smtp->datasend("MIME-Version: 1.0\n");
|
$smtp->datasend("MIME-Version: 1.0\n");
|
||||||
$smtp->datasend("Content-type: multipart/mixed;\n\tboundary=\"$boundary\"\n");
|
$smtp->datasend("Content-type: multipart/mixed;\n\tboundary=\"$boundary\"\n");
|
||||||
$smtp->datasend("\n");
|
$smtp->datasend("\n");
|
||||||
|
|
|
@ -196,8 +196,25 @@ sub preinit(){
|
||||||
#Add Parts from content to contenttranspos#################
|
#Add Parts from content to contenttranspos#################
|
||||||
my $pos_id = 0;
|
my $pos_id = 0;
|
||||||
|
|
||||||
my $ctt = $db->get_content1("contenttrans",$R::c_id4trans);
|
my $ctt = { c_id => 0 };
|
||||||
my $ctadr = $db->get_content1("contentadr",$ctt->{int10});
|
if(looks_like_number($R::c_id4trans)){
|
||||||
|
my $pref_ctt = {
|
||||||
|
table => "contenttrans",
|
||||||
|
fetch => "one",
|
||||||
|
c_id => $R::c_id4trans,
|
||||||
|
};
|
||||||
|
$ctt = $dbt->fetch_tablerecord($dbh,$pref_ctt);
|
||||||
|
}
|
||||||
|
my $ctadr = { c_id => 0 };
|
||||||
|
if(looks_like_number($ctt->{int10})){
|
||||||
|
my $pref_adr = {
|
||||||
|
table => "contentadr",
|
||||||
|
fetch => "one",
|
||||||
|
c_id => $ctt->{int10},
|
||||||
|
};
|
||||||
|
$ctadr = $dbt->fetch_tablerecord($dbh,$pref_adr);
|
||||||
|
}
|
||||||
|
|
||||||
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct,"",$ctadr,"","","","0",$users_dms->{u_id},"");
|
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct,"",$ctadr,"","","","0",$users_dms->{u_id},"");
|
||||||
|
|
||||||
$i_rows += 1 if($pos_id > 0);
|
$i_rows += 1 if($pos_id > 0);
|
||||||
|
@ -337,9 +354,7 @@ sub preinit(){
|
||||||
$valxx =~ s/^\s+//; $valxx =~ s/\s+$//;
|
$valxx =~ s/^\s+//; $valxx =~ s/\s+$//;
|
||||||
$valxx .= ".00" if($valxx =~ /^\d+$/ && $_ =~ /int\d+/);
|
$valxx .= ".00" if($valxx =~ /^\d+$/ && $_ =~ /int\d+/);
|
||||||
#print "|$_:$ct_exist2->{$_} -- $valxx|<br>";
|
#print "|$_:$ct_exist2->{$_} -- $valxx|<br>";
|
||||||
if($_ =~ /sort4pos_\d+/ && $valxx =~ /^\d+$/){
|
if("$ct_exist2->{$_}" ne "$valxx"){
|
||||||
$db->updater("contenttverpos","c_id",$1,"sort","$valxx") if($_ =~ /sort4pos_(\d+)/);
|
|
||||||
}elsif(("$ct_exist2->{$_}" ne "$valxx") || $R::ckid_main || $_ =~ /txt10|txt11/ || $R::edit_main){
|
|
||||||
if($_ eq "ct_name" && $valxx && $table){
|
if($_ eq "ct_name" && $valxx && $table){
|
||||||
$u_rows +=$db->updater("$table","c_id",$c_id,"$_","$valxx");
|
$u_rows +=$db->updater("$table","c_id",$c_id,"$_","$valxx");
|
||||||
}
|
}
|
||||||
|
@ -615,8 +630,16 @@ sub preinit(){
|
||||||
|
|
||||||
my $print_return = "";
|
my $print_return = "";
|
||||||
my $exit_code = 1;
|
my $exit_code = 1;
|
||||||
my $table = "contenttrans";
|
|
||||||
my $ctt = $db->get_content1($table,$c_id4print);
|
my $ctt = { c_id => 0 };
|
||||||
|
my $pref_ctt = {
|
||||||
|
table => "contenttrans",
|
||||||
|
fetch => "one",
|
||||||
|
c_id => $R::c_id4trans,
|
||||||
|
};
|
||||||
|
$ctt = $dbt->fetch_tablerecord($dbh,$pref_ctt);
|
||||||
|
my $lang_ctt = $ctt->{txt11} || "de";#2023-08-10
|
||||||
|
|
||||||
my $praefix = "$ctt->{txt00}-$varenv{praefix}";#like Rechnung-sharee_operator
|
my $praefix = "$ctt->{txt00}-$varenv{praefix}";#like Rechnung-sharee_operator
|
||||||
|
|
||||||
|
|
||||||
|
@ -647,7 +670,7 @@ sub preinit(){
|
||||||
if(-f "$varenv{basedir}/pdfinvoice/$praefix-$ctt->{ct_name}.pdf" && (($R::set_state eq "buchen" && $R::send_invoice && $ctt->{int01} && $ctt->{int01} != 0) || ($ib_key eq "send_invoice_again"))){
|
if(-f "$varenv{basedir}/pdfinvoice/$praefix-$ctt->{ct_name}.pdf" && (($R::set_state eq "buchen" && $R::send_invoice && $ctt->{int01} && $ctt->{int01} != 0) || ($ib_key eq "send_invoice_again"))){
|
||||||
|
|
||||||
my $cms_message_key = "email-invoice";
|
my $cms_message_key = "email-invoice";
|
||||||
$varenv{cms} = $dbt->fetch_cms($dbh,{ lang => "de" });
|
$varenv{cms} = $dbt->fetch_cms($dbh,{ lang => $lang_ctt });
|
||||||
if(!$varenv{cms}->{$cms_message_key}->{txt}){
|
if(!$varenv{cms}->{$cms_message_key}->{txt}){
|
||||||
return "failure::Achtung, CMS-Text '$cms_message_key' ist nicht vorhanden. Es wurde keine eMail versandt!";
|
return "failure::Achtung, CMS-Text '$cms_message_key' ist nicht vorhanden. Es wurde keine eMail versandt!";
|
||||||
}
|
}
|
||||||
|
@ -658,7 +681,7 @@ sub preinit(){
|
||||||
|
|
||||||
if($ib_key eq "send_invoice_cms" && $R::cms_message_key){
|
if($ib_key eq "send_invoice_cms" && $R::cms_message_key){
|
||||||
|
|
||||||
$varenv{cms} = $dbt->fetch_cms($dbh,{ lang => "de" });
|
$varenv{cms} = $dbt->fetch_cms($dbh,{ lang => $lang_ctt });
|
||||||
if(!$varenv{cms}->{$R::cms_message_key}->{txt}){
|
if(!$varenv{cms}->{$R::cms_message_key}->{txt}){
|
||||||
return "failure::Achtung, CMS-Text '$R::cms_message_key' ist nicht vorhanden. Es wurde keine eMail versandt!";
|
return "failure::Achtung, CMS-Text '$R::cms_message_key' ist nicht vorhanden. Es wurde keine eMail versandt!";
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,9 +50,10 @@ my $owner = 181;
|
||||||
sub sms_ack_digest {
|
sub sms_ack_digest {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $ctadr = shift;
|
my $ctadr = shift;
|
||||||
|
my $lang = $ctadr->{txt11} || $ctadr->{txt10};
|
||||||
|
|
||||||
my %varenv = ();
|
my %varenv = ();
|
||||||
$varenv{cms} = $dbt->fetch_cms($dbh,{ lang => $ctadr->{txt10} });
|
$varenv{cms} = $dbt->fetch_cms($dbh,{ lang => $lang });
|
||||||
|
|
||||||
#Ack digest
|
#Ack digest
|
||||||
my $ack_digest = $q->unescapeHTML($ctadr->{txt34}) || "";
|
my $ack_digest = $q->unescapeHTML($ctadr->{txt34}) || "";
|
||||||
|
@ -140,8 +141,9 @@ sub sms_message {
|
||||||
};
|
};
|
||||||
$ctadr = $dbt->fetch_tablerecord($dbh_primary,$pref_adr);
|
$ctadr = $dbt->fetch_tablerecord($dbh_primary,$pref_adr);
|
||||||
$sms_to = $ctadr->{txt07};
|
$sms_to = $ctadr->{txt07};
|
||||||
|
my $lang = $ctadr->{txt11} || $ctadr->{txt10};
|
||||||
|
|
||||||
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $ctadr->{txt10} });
|
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $lang });
|
||||||
}
|
}
|
||||||
|
|
||||||
my $sms_from = "$varenv{cms}->{'sms-from-info'}->{txt}";
|
my $sms_from = "$varenv{cms}->{'sms-from-info'}->{txt}";
|
||||||
|
|
|
@ -47,7 +47,7 @@ my $cmstext_select = $ARGV[5] || "";
|
||||||
my $with_pdf = $ARGV[6] || "";
|
my $with_pdf = $ARGV[6] || "";
|
||||||
|
|
||||||
open(EMA, ">> $dbt->{copri_conf}->{logdir}/mailTransportcms.log");
|
open(EMA, ">> $dbt->{copri_conf}->{logdir}/mailTransportcms.log");
|
||||||
print EMA "\n$now_dt, start mailTransportcms.pl syshost: $syshost, todo:$todo, adr_id:$adr_id, ct_id:$ct_id, temppw:$temppw\n";
|
print EMA "\n$now_dt, start mailTransportcms.pl syshost: $syshost, todo:$todo, adr_id:$adr_id, ct_id:$ct_id, temppw:$temppw, cmstext_select:$cmstext_select, with_pdf:$with_pdf\n";
|
||||||
|
|
||||||
|
|
||||||
#mailxcfg is shareeconf/mailx.cfg <block> selection!
|
#mailxcfg is shareeconf/mailx.cfg <block> selection!
|
||||||
|
@ -153,10 +153,11 @@ sub send_invoice {
|
||||||
my $ct_id = shift || "";
|
my $ct_id = shift || "";
|
||||||
my $cms_message_key = shift || "email-invoice";
|
my $cms_message_key = shift || "email-invoice";
|
||||||
my $with_pdf = shift || "";
|
my $with_pdf = shift || "";
|
||||||
|
my $lang = $ctadr->{txt11} || $ctadr->{txt10};
|
||||||
|
|
||||||
my $dbh = $dbt->dbconnect_extern($dbt->{operator}->{$varenv{dbname}}->{database}->{dbname},"iso-8859-1");
|
my $dbh = $dbt->dbconnect_extern($dbt->{operator}->{$varenv{dbname}}->{database}->{dbname},"iso-8859-1");
|
||||||
my $project = $dbt->{operator}->{$varenv{dbname}}->{project} || "";
|
my $project = $dbt->{operator}->{$varenv{dbname}}->{project} || "";
|
||||||
$varenv{cms} = $dbt->fetch_cms($dbh,{ lang => $ctadr->{txt10} });
|
$varenv{cms} = $dbt->fetch_cms($dbh,{ lang => $lang });
|
||||||
|
|
||||||
if(!$varenv{cms}->{$cms_message_key}->{txt}){
|
if(!$varenv{cms}->{$cms_message_key}->{txt}){
|
||||||
exit 1;
|
exit 1;
|
||||||
|
@ -197,6 +198,7 @@ sub send_emailack {
|
||||||
my $todo = shift;
|
my $todo = shift;
|
||||||
my $sendref = shift;
|
my $sendref = shift;
|
||||||
my $ctadr = shift;
|
my $ctadr = shift;
|
||||||
|
my $lang = $ctadr->{txt11} || $ctadr->{txt10};
|
||||||
|
|
||||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
||||||
my $pref_ctu = {
|
my $pref_ctu = {
|
||||||
|
@ -207,7 +209,7 @@ sub send_emailack {
|
||||||
my $uadr = { c_id => 0 };
|
my $uadr = { c_id => 0 };
|
||||||
$uadr = $dbt->fetch_tablerecord($dbh_primary,$pref_ctu);
|
$uadr = $dbt->fetch_tablerecord($dbh_primary,$pref_ctu);
|
||||||
|
|
||||||
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $ctadr->{txt10} });
|
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $lang });
|
||||||
my $cms_message_key = "email-emailack";
|
my $cms_message_key = "email-emailack";
|
||||||
|
|
||||||
#Ack digest
|
#Ack digest
|
||||||
|
@ -228,6 +230,7 @@ sub send_password {
|
||||||
my $sendref = shift;
|
my $sendref = shift;
|
||||||
my $ctadr = shift;
|
my $ctadr = shift;
|
||||||
my $temppw = shift;
|
my $temppw = shift;
|
||||||
|
my $lang = $ctadr->{txt11} || $ctadr->{txt10};
|
||||||
|
|
||||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
||||||
my $pref_ctu = {
|
my $pref_ctu = {
|
||||||
|
@ -238,7 +241,7 @@ sub send_password {
|
||||||
my $uadr = { c_id => 0 };
|
my $uadr = { c_id => 0 };
|
||||||
$uadr = $dbt->fetch_tablerecord($dbh_primary,$pref_ctu);
|
$uadr = $dbt->fetch_tablerecord($dbh_primary,$pref_ctu);
|
||||||
|
|
||||||
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $ctadr->{txt10} });
|
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $lang });
|
||||||
my $cms_message_key = "email-temppassword";
|
my $cms_message_key = "email-temppassword";
|
||||||
|
|
||||||
#temp pw
|
#temp pw
|
||||||
|
@ -258,6 +261,7 @@ sub send_cpupdate_message {
|
||||||
my $todo = shift;
|
my $todo = shift;
|
||||||
my $sendref = shift;
|
my $sendref = shift;
|
||||||
my $ctadr = shift || {};
|
my $ctadr = shift || {};
|
||||||
|
my $lang = $ctadr->{txt11} || $ctadr->{txt10};
|
||||||
|
|
||||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
||||||
|
|
||||||
|
@ -269,7 +273,7 @@ sub send_cpupdate_message {
|
||||||
my $uadr = { c_id => 0 };
|
my $uadr = { c_id => 0 };
|
||||||
$uadr = $dbt->fetch_tablerecord($dbh_primary,$pref_ctu);
|
$uadr = $dbt->fetch_tablerecord($dbh_primary,$pref_ctu);
|
||||||
|
|
||||||
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $ctadr->{txt10} });
|
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $lang });
|
||||||
my $cms_message_key = "email-cpupdate-message";
|
my $cms_message_key = "email-cpupdate-message";
|
||||||
$cms_message_key = "email-proactive-cpupdate-message" if($todo eq "send_proactive_cpupdate_message");
|
$cms_message_key = "email-proactive-cpupdate-message" if($todo eq "send_proactive_cpupdate_message");
|
||||||
$sendref = prepare_content($sendref,$ctadr,$uadr,"",$varenv{cms}->{$cms_message_key}->{txt});
|
$sendref = prepare_content($sendref,$ctadr,$uadr,"",$varenv{cms}->{$cms_message_key}->{txt});
|
||||||
|
|
Loading…
Add table
Reference in a new issue