mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-11 22:37:27 +02:00
Refactoring some mailing methodes and adding cms text
This commit is contained in:
parent
75a23dc3f4
commit
7736fee89d
20 changed files with 376 additions and 731 deletions
|
@ -907,7 +907,7 @@ sub booking_request(){
|
|||
my $response_text = "";
|
||||
|
||||
#state and lock_state is only defined if requestes incl. occupied
|
||||
$bw->log("booking_request bike to state $bike | $state | $lock_state, tarif $ct_tariff->{barcode}, auth:$auth->{c_id}",$auth->{c_id},"");
|
||||
$bw->log("log booking_request bike:$bike, state:$state, lock_state:$lock_state, tarif:$ct_tariff->{barcode}, auth:$auth->{c_id}",$auth->{txt08},"");
|
||||
|
||||
my $update_adr = {
|
||||
table => "contentadr",
|
||||
|
@ -1154,7 +1154,14 @@ sub booking_update(){
|
|||
$gps_data->{gps} = "$gps_data->{latitude},$gps_data->{longitude}" if($gps_data->{latitude} && $gps_data->{longitude});
|
||||
}
|
||||
|
||||
$bw->log("booking_update bike to state $bike | $state | $lock_state, auth:$auth->{c_id}, gps:$gps_data->{gps}",$auth->{c_id},"");
|
||||
my $update_pos = {
|
||||
table => "contenttranspos",
|
||||
mtime => "now()",
|
||||
};
|
||||
|
||||
my $logging = "log booking_update bike:$bike, state:$state, lock_state:$lock_state, userID:$auth->{c_id}, gps:$gps_data->{gps}";
|
||||
$bw->log("$logging",$auth->{c_id},"");
|
||||
$update_pos->{txt24} = $record_pos->{txt24} . "\n$logging";
|
||||
|
||||
my $Ilockit_GUID = "";
|
||||
$Ilockit_GUID = $q->escapeHTML($q->param('Ilockit_GUID')) if($q->param('Ilockit_GUID') && $q->param('Ilockit_GUID') =~ /\w+-\w+-\w+-\w+$/);
|
||||
|
@ -1185,10 +1192,6 @@ sub booking_update(){
|
|||
|
||||
#set rent state if lock_system 2=Ilockit || 3=sigo
|
||||
if($record_pos->{int11} && ($record_pos->{int11} == 2 || $record_pos->{int11} == 3)){
|
||||
my $update_pos = {
|
||||
table => "contenttranspos",
|
||||
mtime => "now()",
|
||||
};
|
||||
|
||||
if($user_agent && $user_agent !~ /axios/){#keep device info if sig push
|
||||
$update_pos->{txt21} = $q->escapeHTML($q->param('user_device')) if($q->param('user_device'));
|
||||
|
@ -1413,10 +1416,18 @@ sub booking_update(){
|
|||
my $booking = $dbt->fetch_tablerecord($dbh,$booking_pos);
|
||||
|
||||
if(ref($booking) eq "HASH" && $booking->{ct_name}){
|
||||
#$booking_values->{bike} = "$booking->{ct_name}";
|
||||
#deprecated
|
||||
$booking_values->{bike} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}$booking->{barcode}";
|
||||
$booking_values->{state} = "$dbt->{copri_conf}->{bike_state}->{$booking->{int10}}";
|
||||
$booking_values->{lock_state} = "$dbt->{copri_conf}->{lock_state}->{$booking->{int20}}";
|
||||
#new object after rental end
|
||||
$booking_values->{bike_returned} = {};
|
||||
if($booking->{int10} == 1){
|
||||
$booking_values->{bike_returned}->{bike} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}$booking->{barcode}";
|
||||
$booking_values->{bike_returned}->{station} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}$booking->{int04}";
|
||||
$booking_values->{bike_returned}->{state} = "$dbt->{copri_conf}->{bike_state}->{$booking->{int10}}";
|
||||
$booking_values->{bike_returned}->{lock_state} = "$dbt->{copri_conf}->{lock_state}->{$booking->{int20}}";
|
||||
}
|
||||
|
||||
#user_miniquest_count on operator
|
||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
|
@ -2001,8 +2012,8 @@ sub bikes_all(){
|
|||
my $pref = {
|
||||
table => "content",
|
||||
fetch => "all",
|
||||
keyfield => "barcode",#2018-02-21 changed to bike id
|
||||
template_id => "205",#Leihrad_liste
|
||||
keyfield => "barcode",
|
||||
template_id => "205",
|
||||
};
|
||||
|
||||
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
||||
|
@ -2018,7 +2029,11 @@ sub bikes_all(){
|
|||
$pref->{int04} = "=::$station_id" if(looks_like_number($station_id));
|
||||
if(looks_like_number($bike_id)){
|
||||
$pref->{ barcode} = "=::$bike_id";
|
||||
$pref->{int10} = "!=::3";#2022-12-02 do not select occupied bikes in servicetool by direct bike-select
|
||||
#2022-12-02 not select occupied bikes in servicetool by direct select-bike
|
||||
$pref->{int10} = "!=::3";
|
||||
#}else{
|
||||
#2023-05-23 not select requested and occupied bikes in servicetool by list-bikes?
|
||||
#$pref->{int10} = "IN::(1,4,5,6)";
|
||||
}
|
||||
|
||||
my $record = {};
|
||||
|
@ -2201,7 +2216,7 @@ sub stations_available(){
|
|||
}elsif($station_group && $type_id =~ /(\d+)/){
|
||||
my $group_id = $1;
|
||||
if($group_id == $station_group){
|
||||
$pref_sql = " and ct.txt25 like '%$group_id%' and ct.int42=0";
|
||||
$pref_sql = " and ct.txt25 like '%$group_id%' and (ct.int42=0 OR ct.int42 is null)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ my $response = {
|
|||
apiserver => "$apiserver",
|
||||
response => "$respreq",
|
||||
uri_primary => "$dbt->{primary}->{sharee_primary}->{primaryApp}",
|
||||
copri_version => "4.1.23.03",
|
||||
copri_version => "4.1.23.10",
|
||||
user_id => "",
|
||||
authcookie => "",
|
||||
new_authcoo => "0",
|
||||
|
@ -161,7 +161,9 @@ if($q->param('request') eq "auth_verify"){
|
|||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
$response = { %$response, %$return_merchant };
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $auth = {};
|
||||
my $authraw = {};
|
||||
($auth,$authraw) = $apif->auth_verify($q);
|
||||
$response = { %$response, %$auth };
|
||||
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
||||
$response = { %$response, %$auth };
|
||||
|
@ -211,7 +213,9 @@ elsif($q->param('request') eq "booking_request"){
|
|||
my $rows = 0;
|
||||
$response = { %$response, %$return_merchant };
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $auth = {};
|
||||
my $authraw = {};
|
||||
($auth,$authraw) = $apif->auth_verify($q);
|
||||
$response = { %$response, %$auth };
|
||||
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
||||
my $bike = $q->escapeHTML($q->param('bike')) || "";
|
||||
|
@ -343,7 +347,9 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
|||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
$response = { %$response, %$return_merchant };
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $auth = {};
|
||||
my $authraw = {};
|
||||
($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $rows = 0;
|
||||
$response = { %$response, %$auth };
|
||||
|
||||
|
@ -436,7 +442,9 @@ elsif($q->param('request') eq "user_bikes_occupied"){
|
|||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
$response = { %$response, %$return_merchant };
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $auth = {};
|
||||
my $authraw = {};
|
||||
($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,$auth,$authraw,$return_merchant,"");
|
||||
|
@ -446,8 +454,9 @@ elsif($q->param('request') eq "user_bikes_occupied"){
|
|||
}
|
||||
|
||||
}else{
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $auth = {};
|
||||
my $authraw = {};
|
||||
($auth,$authraw) = $apif->auth_verify($q);
|
||||
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
||||
$response = { %$response, %$auth };
|
||||
my $record = $apif->user_bikes_occupied($dbh,$authraw,"show_dialog");
|
||||
|
@ -508,8 +517,10 @@ elsif($q->param('request') eq "bikes_all"){
|
|||
($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
|
||||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
$response = { %$response, %$return_merchant };
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
|
||||
my $auth = {};
|
||||
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,$auth,$authraw,$return_merchant,"");
|
||||
}else{
|
||||
|
@ -650,7 +661,9 @@ elsif($q->param('request') eq "stations_all"){
|
|||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
$response = { %$response, %$return_merchant };
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $auth = {};
|
||||
my $authraw = {};
|
||||
($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,$auth,$authraw,$return_merchant,"");
|
||||
}else{
|
||||
|
@ -673,7 +686,9 @@ elsif($q->param('request') eq "stations_available"){
|
|||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
$response = { %$response, %$return_merchant };
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $auth = {};
|
||||
my $authraw = {};
|
||||
($auth,$authraw) = $apif->auth_verify($q);
|
||||
|
||||
my $user_agent_subversion = 1000;
|
||||
#$user_agent = "Meinkonrad/3.0.363";#test
|
||||
|
@ -684,7 +699,7 @@ elsif($q->param('request') eq "stations_available"){
|
|||
my $localtime = Time::Piece->strptime($lnow, "%Y-%m-%d %H:%M:%S");
|
||||
my $epoch_now = $localtime->epoch;
|
||||
my $merchant_message_start = Time::Piece->strptime("2023-05-15 00:00:00", "%Y-%m-%d %H:%M:%S");
|
||||
my $merchant_message_end = Time::Piece->strptime("2023-05-21 23:00:00", "%Y-%m-%d %H:%M:%S");
|
||||
my $merchant_message_end = Time::Piece->strptime("2023-05-21 23:59:00", "%Y-%m-%d %H:%M:%S");
|
||||
my $epoch_start = $merchant_message_start->epoch;
|
||||
my $epoch_end = $merchant_message_end->epoch;
|
||||
|
||||
|
@ -705,6 +720,12 @@ elsif($q->param('request') eq "stations_available"){
|
|||
$response->{merchant_message} = $varenv{cms}->{'App-merchant-message'}->{txt};
|
||||
}
|
||||
}
|
||||
#disabled sig is offline message
|
||||
if(1==2 && $user_agent =~ /bayern/i){
|
||||
if($epoch_now >= $epoch_start && $epoch_now <= $epoch_end){
|
||||
$response->{merchant_message} = $varenv{cms}->{'App-merchant-message-bayern'}->{txt};
|
||||
}
|
||||
}
|
||||
|
||||
$response = { %$response, %$auth };
|
||||
($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant,"");
|
||||
|
@ -715,6 +736,10 @@ elsif($q->param('request') eq "stations_available"){
|
|||
$q->param(-name=>'request',-value=>"user_bikes_occupied");
|
||||
($response->{bikes_occupied},my $uri_operator_array,my $user_group,my $user_tour) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant,$last_used_operator);
|
||||
}
|
||||
if(length($coo) > 20 && !$auth->{authcookie}){
|
||||
$response->{response_state} = "Failure 1001: authcookie not defined";
|
||||
$response->{response_text} = "Entschuldigung, die Sitzung wurde unterbrochen";
|
||||
}
|
||||
|
||||
}else{
|
||||
($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
|
||||
|
@ -743,7 +768,9 @@ elsif($q->param('request') eq "user_feedback" || $q->param('request') eq "user_m
|
|||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
$response = { %$response, %$return_merchant };
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $auth = {};
|
||||
my $authraw = {};
|
||||
($auth,$authraw) = $apif->auth_verify($q);
|
||||
$response = { %$response, %$auth };
|
||||
$response->{uri_operator} = "$varenv{wwwhost}";
|
||||
|
||||
|
@ -783,7 +810,9 @@ elsif($q->param('request') eq "service_done"){
|
|||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
$response = { %$response, %$return_merchant };
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $auth = {};
|
||||
my $authraw = {};
|
||||
($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $station_id = $1 if($q->param('station') =~ /(\d+)/);
|
||||
#my $bike_id = $1 if($q->param('bike') =~ /(\d+)/);
|
||||
|
||||
|
@ -956,7 +985,9 @@ elsif($q->param('request') eq "service_work"){
|
|||
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||
$response = { %$response, %$return_merchant };
|
||||
|
||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $auth = {};
|
||||
my $authraw = {};
|
||||
($auth,$authraw) = $apif->auth_verify($q);
|
||||
my $station_id = "";
|
||||
$station_id = $1 if($q->param('station') =~ /(\d+)/);
|
||||
#$bike_id = $1 if($q->param('bike') =~ /(\d+)/);
|
||||
|
|
|
@ -125,7 +125,6 @@ sub sig_available {
|
|||
$response_out->{$station}->{description} = "";
|
||||
#$response_out->{$station}->{description} = "$resp->{site}->{address}" || "";
|
||||
$response_out->{$station}->{description} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$resp->{site}->{address})) || "";
|
||||
$response_out->{$station}->{station_group} = ["SX300101"];#Lastenrad alias type_id
|
||||
$response_out->{$station}->{gps}->{latitude} = "$resp->{site}->{lat}" || "";
|
||||
$response_out->{$station}->{gps}->{longitude} = "$resp->{site}->{lon}" || "";
|
||||
$response_out->{$station}->{gps_radius} = "75";
|
||||
|
@ -138,6 +137,13 @@ sub sig_available {
|
|||
$response_out->{$station}->{state} = "maintenance";
|
||||
}
|
||||
|
||||
#new station category
|
||||
$response_out->{$station}->{station_type}->{$dbt->{copri_conf}->{type_id}->{'300101'}}->{bike_group} = "SX300101";
|
||||
$response_out->{$station}->{station_type}->{$dbt->{copri_conf}->{type_id}->{'300101'}}->{bike_count} = "$response_out->{$station}->{bike_count}";
|
||||
|
||||
#deprecated
|
||||
$response_out->{$station}->{station_group} = ["SX300101"];#Lastenrad alias type_id
|
||||
|
||||
$response_out->{$station}->{operator_data} = {
|
||||
"operator_name" => "",
|
||||
"operator_hours" => "",
|
||||
|
@ -402,12 +408,13 @@ sub sig_booking {
|
|||
my $self = shift;
|
||||
my $varenv = shift || {};
|
||||
my $todo = shift || "";
|
||||
my $ctadr = shift || {};
|
||||
my $authraw = shift || {};
|
||||
my $ct_bike = shift || {};
|
||||
my $ctpos = shift || {};
|
||||
|
||||
my $dbh = "";
|
||||
my $owner = 169;
|
||||
my $ctadr = $authraw;
|
||||
my $sig_book = {};
|
||||
|
||||
open(FILE,">>$varenv->{logdir}/APIsigclient.log");
|
||||
|
|
|
@ -689,12 +689,14 @@ sub collect_post(){
|
|||
sub fetch_cms {
|
||||
my $self = shift;
|
||||
my $dbh = shift || $dbh_intern;
|
||||
my $fetch = shift;
|
||||
my $fetch = shift || {};
|
||||
|
||||
my $langfield = "txt02";#default to en
|
||||
$langfield = "txt01" if($fetch->{lang} eq "de");
|
||||
$langfield = "txt03" if($fetch->{lang} eq "fr");
|
||||
my $sql = "SELECT ct_name, coalesce($langfield, txt02) AS txt FROM contentuser, relation where template_id=194 and c_id=content_id";
|
||||
my $lang = "";
|
||||
$lang = lc($fetch->{lang}) if($fetch->{lang});
|
||||
$langfield = "txt01" if($lang eq "de");
|
||||
$langfield = "txt03" if($lang eq "fr");
|
||||
my $sql = "SELECT ct_name, coalesce($langfield, txt01) AS txt FROM contentuser, relation where template_id=194 and c_id=content_id";
|
||||
my $sth = $dbh->prepare($sql);
|
||||
my $rc = $sth->execute();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ sub mobox3(){
|
|||
my $bg_color = "white";
|
||||
my $bg_color2 = $node_meta->{bg_color} || "grey";
|
||||
my $title = "Content Editor \"$node_meta->{tpl_name}\"";
|
||||
$title = "Artikel Editor" if($node_meta->{ct_table} eq "content");
|
||||
$title = "Parts Editor" if($node_meta->{ct_table} eq "content");
|
||||
$title = "Kunden Editor" if($node_meta->{ct_table} eq "contentadr");
|
||||
$title = "DMS-Account Zugriffsberechtigung" if($node_meta->{ct_table} eq "users");
|
||||
$title = "Service Editor" if($node_meta->{ct_table} eq "contentpos");
|
||||
|
|
|
@ -742,9 +742,9 @@ sub payone_capture(){
|
|||
print EMA "\n$now_dt\n$topdf --page-size A4 \"$varenv->{wwwhost}/Printpreview?printer_id=PDF\&mandant_main_id=$mandant_id\&main_id=$main_id\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$ctt->{c_id}\&u_id=$owner\&pkey=$apikeyconf{pdfprinter}->{pkey}\" $varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\n";
|
||||
|
||||
#send_invoice infomail, only if eMail never sent
|
||||
if(-f "$varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf" && !$ctt->{txt30}){
|
||||
system("$varenv->{basedir}/src/scripts/mailTransport.pl '$varenv->{syshost}' 'send_invoice' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'");
|
||||
print EMA "---> Sent Invoice e-mail command: $varenv->{basedir}/src/scripts/mailTransport.pl '$varenv->{syshost}' 'send_invoice' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'\n";
|
||||
if(-f "$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/pdfinvoice/$praefix-$ctt->{ct_name}.pdf" && !$ctt->{txt30}){
|
||||
system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_invoice' '$ctt->{int10}' '$ctt->{c_id}' ''");
|
||||
print EMA "---> Payment send_invoice e-mail command: $dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_invoice' '$ctt->{int10}' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf' ''\n";
|
||||
}
|
||||
close EMA;
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ sub save_content {
|
|||
$valxx = $q->escapeHTML("$val");
|
||||
$valxx =~ s/,/./;
|
||||
$valxx =~ s/\s//g;
|
||||
if($valxx && looks_like_number($valxx)){
|
||||
if(looks_like_number($valxx) || $valxx == 0){
|
||||
$update_ct->{$_} = "$valxx";
|
||||
}elsif(!$valxx || $valxx eq "null"){
|
||||
$update_ct->{$_} = "null";
|
||||
|
|
|
@ -671,6 +671,9 @@ sub preinit(){
|
|||
my $c_id4print = $R::c_id4trans;
|
||||
$c_id4print= $R::c_id if($R::printer_id =~ /Adresse|Kunde/);
|
||||
if($c_id4print){
|
||||
open(EMA, ">> $varenv{logdir}/copri-print.log");
|
||||
print EMA "$today4db\n";
|
||||
|
||||
my $print_return = "";
|
||||
my $exit_code = 1;
|
||||
my $table = "contenttrans";
|
||||
|
@ -695,13 +698,8 @@ sub preinit(){
|
|||
$print_return = `$topdf --page-size $psize "$varenv{wwwhost}$script/Printpreview?printer_id=$R::printer_id\&mandant_main_id=$mandant_main_id\&main_id=$node->{main_id}\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$c_id4print\&u_id=$users_dms->{u_id}\&pkey=$apikeyconf{pdfprinter}->{pkey}" "$varenv{pdf}/$praefix-$ctt->{ct_name}.pdf" 2>&1`;
|
||||
$exit_code = $?;
|
||||
|
||||
if(1==1){#debugging
|
||||
my $filesize = -s "$varenv{pdf}/$praefix-$ctt->{ct_name}.pdf";
|
||||
open(EMA, ">> $varenv{logdir}/copri-print.log");
|
||||
print EMA "$today4db\n$topdf --page-size $psize $varenv{wwwhost}$script/Printpreview?printer_id=$R::printer_id\&mandant_main_id=$mandant_main_id\&main_id=$node->{main_id}\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$c_id4print\&u_id=$users_dms->{u_id}\&pkey=$apikeyconf{pdfprinter}->{pkey} $varenv{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\nset_state: $R::set_state\n";
|
||||
close EMA;
|
||||
#exit 0;
|
||||
}
|
||||
print EMA "$topdf --page-size $psize $varenv{wwwhost}$script/Printpreview?printer_id=$R::printer_id\&mandant_main_id=$mandant_main_id\&main_id=$node->{main_id}\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$c_id4print\&u_id=$users_dms->{u_id}\&pkey=$apikeyconf{pdfprinter}->{pkey} $varenv{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\nset_state: $R::set_state\n";
|
||||
|
||||
if($R::set_state ne "buchen"){#no redirect if buchen incl. print_pdf
|
||||
if( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf"){
|
||||
|
@ -714,11 +712,13 @@ sub preinit(){
|
|||
}
|
||||
}
|
||||
|
||||
if(-f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.pdf" && (($R::set_state eq "buchen" && $R::send_invoice && $ctt->{int01} && $ctt->{int01} != 0) || ($ib_key eq "send_invoice_again"))){
|
||||
system("$varenv{basedir}/src/scripts/mailTransport.pl '$varenv{syshost}' 'send_invoice' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'");
|
||||
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"))){
|
||||
system("$dbt->{copri_conf}->{basedir}/$varenv{syshost}/src/scripts/mailTransportcms.pl '$varenv{syshost}' 'send_invoice' '$ctt->{int10}' '$ctt->{c_id}' ''");
|
||||
print EMA "---> Prelogic send_invoice e-mail command: $dbt->{copri_conf}->{basedir}/$varenv{syshost}/src/scripts/mailTransportcms.pl '$varenv{syshost}' 'send_invoice' '$ctt->{int10}' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'\n";
|
||||
|
||||
}
|
||||
#
|
||||
close EMA;
|
||||
}#end c_id4print
|
||||
|
||||
#SET Tagesabschluss
|
||||
|
|
|
@ -145,7 +145,7 @@ sub sms_message {
|
|||
#todo send_alarm2hotline
|
||||
if($todo eq "send_alarm2hotline"){
|
||||
$sms_from = "RadAlarm";
|
||||
$sms_message .= "Diebstahlalarm $bike. Öffne das Alarmjournal für weitere Informationen: $dbt->{operator}->{$varenv{dbname}}->{operatorDMS}/DMS/Alarmjournal";
|
||||
$sms_message .= "Alarmmeldung zu Rad $bike. Öffne das Alarmjournal für weitere Informationen: $dbt->{operator}->{$varenv{dbname}}->{operatorDMS}/DMS/Alarmjournal";
|
||||
}
|
||||
|
||||
#todo fraud_rental
|
||||
|
|
|
@ -757,31 +757,30 @@ sub save_transact(){
|
|||
|
||||
|
||||
#Send sms after payable check and !int13
|
||||
sub smsack(){
|
||||
sub smsack {
|
||||
my $self = shift;
|
||||
my $ctadr = shift;
|
||||
$smstrans->sms_ack_digest($ctadr);
|
||||
return;
|
||||
}
|
||||
|
||||
#Send email after payable check and !int04
|
||||
sub emailack(){
|
||||
sub emailack {
|
||||
my $self = shift;
|
||||
my $varenv = shift;
|
||||
my $adr_id = shift || "";
|
||||
|
||||
system(`$varenv->{basedir}/src/Mod/newsletter_tink.pl "$varenv->{basedir}" "$varenv->{wwwhost}" "emailack" "$adr_id" ""`);
|
||||
#TODO
|
||||
#system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_emailack' '$adr_id' ''");
|
||||
system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_emailack' '$adr_id' ''");
|
||||
return;
|
||||
}
|
||||
|
||||
#Password forgotten send email
|
||||
sub send_password(){
|
||||
sub send_password {
|
||||
my $self = shift;
|
||||
my $varenv = shift;
|
||||
my $email = shift || "";
|
||||
my $coo = shift || "";
|
||||
my $owner = shift || "";
|
||||
|
||||
my $dbh = "";
|
||||
$email = $q->escapeHTML($email);
|
||||
$email =~ s/\s//g;
|
||||
|
||||
|
@ -789,12 +788,27 @@ sub send_password(){
|
|||
|
||||
if($email && $email =~ /\w\@\w/ && $pwmd5 && length($pwmd5) > 20 && $email !~ /$dbt->{copri_conf}->{test_accounts}/i){
|
||||
my $pwsha256=sha256_base64($pwmd5) || "";
|
||||
$db->updater("contentadr","1","1","txt04","$pwsha256","$owner","txt08","ilike","$email");
|
||||
system(`$varenv->{basedir}/src/Mod/newsletter_tink.pl "$varenv->{basedir}" "$varenv->{wwwhost}" "send_password" "$email" "$coo"`);
|
||||
#TODO
|
||||
#system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_password' '$c_id' ''");
|
||||
}
|
||||
my $authref = {
|
||||
table => "contentadr",
|
||||
fetch => "one",
|
||||
template_id => "202",
|
||||
txt08 => "ilike::" . $q->escapeHTML($email),
|
||||
int05 => "1",
|
||||
};
|
||||
my $ctadr = { c_id => 0 };
|
||||
$ctadr = $dbt->fetch_record($dbh,$authref);
|
||||
my $c_id = $ctadr->{c_id};
|
||||
|
||||
my $update_primary = {
|
||||
table => "contentadr",
|
||||
mtime => "now()",
|
||||
owner => "$owner",
|
||||
txt04 => "$pwsha256",
|
||||
};
|
||||
$dbt->update_record($dbh,$update_primary,$ctadr) if($c_id > 0);
|
||||
system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_password' '$c_id' '' '$coo'");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#sigbike just like caching and not realy used by app
|
||||
|
|
|
@ -1,530 +0,0 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
||||
#
|
||||
#TODO, migrate to MailTransport.pm
|
||||
#
|
||||
#su www-data -c "./src/Mod/newsletter_tink.pl '/var/www/copri4/shareeapp-operator' 'https://shareeapp-operator.copri-bike.de' 'emailack' '1842'"
|
||||
|
||||
#on command
|
||||
#sudo su www-data -c "./src/Mod/newsletter_tink.pl '/var/www/copri3/konrad' 'https://konrad.tink-konstanz.de' 'send_password' 'ragu@gnu-systems.de' '59e5c7bce6'"
|
||||
|
||||
#su www-data -c "./src/Mod/newsletter_tink.pl '/var/www/copri3/tinkdms' 'https://tinkdms.copri.eu' 'send_invoice' '1842' '2866'"
|
||||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
use Encode;
|
||||
use CGI ':standard';
|
||||
use DBI;
|
||||
use POSIX;
|
||||
use Email::MIME;
|
||||
use IO::All;
|
||||
use Email::MIME::CreateHTML;
|
||||
use Email::Sender::Simple qw(sendmail);
|
||||
#use Email::Sender::Transport::SMTPS;
|
||||
use Net::SMTP;
|
||||
use Try::Tiny;
|
||||
use Config::General;
|
||||
use URI::Encode;
|
||||
my $uri_encode = URI::Encode->new( { encode_reserved => 1 } );
|
||||
use Data::Dumper;
|
||||
|
||||
use Sys::Hostname;
|
||||
my $hostname = hostname;
|
||||
|
||||
my $q = new CGI;
|
||||
my $basedir = $ARGV[0];
|
||||
my $wwwhost = $ARGV[1];
|
||||
my $todo = $ARGV[2];
|
||||
my $c_id="";
|
||||
my $ct_name="";
|
||||
my $emailpw="";
|
||||
my $coopw="";
|
||||
if($todo =~ /emailack|send_invoice|send_capture_fail/){
|
||||
$c_id = $ARGV[3] || "";#contentadr.c_id
|
||||
$ct_name = $ARGV[4] || "";#contenttrans.c_id
|
||||
}elsif($todo eq "send_password"){
|
||||
$emailpw = $ARGV[3] || "";
|
||||
$emailpw =~ s/\s//g;
|
||||
$coopw = $ARGV[4] || "";
|
||||
}
|
||||
|
||||
my $today = strftime("%d.%m.%Y %H:%M:%S",localtime(time));
|
||||
|
||||
my $globalconf_file = "/var/www/copri4/shareeconf/global.cfg";
|
||||
my $gconf = Config::General->new($globalconf_file);
|
||||
my %globalconf = $gconf->getall;
|
||||
|
||||
my $mailx_file = "/var/www/copri4/shareeconf/mailx.cfg";
|
||||
my $mconf = Config::General->new($mailx_file);
|
||||
my %mailxconf = $mconf->getall;
|
||||
|
||||
require "$basedir/src/Lib/Config.pm";
|
||||
my %varenv = &Config::envonline("","$wwwhost");
|
||||
#print Dumper(%varenv);
|
||||
|
||||
open(EMA, ">> $varenv{logdir}/newsletter_tink.log");
|
||||
print EMA "\n$today, start mailing\n";
|
||||
print EMA "'$today' '$basedir' '$wwwhost' '$todo' 'c_id:$c_id' 'invoice ct_name:$ct_name' 'emailpw:$emailpw' 'coopw:$coopw'\n";
|
||||
close EMA;
|
||||
|
||||
|
||||
my $dbh = &dbconnect();
|
||||
sub dbconnect {
|
||||
my $options ="";
|
||||
my $dbh = DBI->connect("dbi:Pg:dbname=$varenv{dbname};host=$varenv{dbhost};port=5432;options='$options'", "$varenv{dbuser}", "$varenv{dbpassw}",{ RaiseError => 1, AutoCommit => 1 }) or die "Can't connect to $varenv{dbname}: $DBI::errstr";
|
||||
return $dbh;
|
||||
}
|
||||
|
||||
sub get_contentadr(){
|
||||
my ($c_id,$emailpw) = @_;
|
||||
my $where="where ct.c_id=rel.content_id";
|
||||
$where .= " and ct.c_id=$c_id" if($c_id =~ /^\d+$/);
|
||||
$where .= " and ct.txt08 ilike '$emailpw'" if($emailpw =~ /\w+/);
|
||||
$where .= " and rel.template_id = 202";#tpl_id Adressen
|
||||
my $sth = $dbh->prepare("SELECT * FROM contentadr ct, relation rel $where");
|
||||
my $rc = $sth->execute();
|
||||
my $ct = $sth->fetchrow_hashref();
|
||||
return $ct;
|
||||
}
|
||||
|
||||
sub get_content(){
|
||||
my ($table,$c_id,$tpl_id) = @_;
|
||||
my $where="where ct.c_id=rel.content_id";
|
||||
$where .= " and ct.c_id=$c_id" if($c_id =~ /^\d+$/);
|
||||
$where .= " and rel.template_id = $tpl_id" if($tpl_id =~ /^\d+$/);
|
||||
my $sth = $dbh->prepare("SELECT * FROM $table ct, relation rel $where");
|
||||
my $rc = $sth->execute();
|
||||
my $ct = $sth->fetchrow_hashref();
|
||||
return $ct;
|
||||
}
|
||||
|
||||
#update trivial, matchs anything
|
||||
sub updater(){
|
||||
my ($table,$w_col,$w_val,$column,$content,$owner,$w_col2,$w_op2,$w_val2,$set_time) = @_;
|
||||
my $ct_set = "mtime='now()'";
|
||||
if($set_time eq "no_time"){
|
||||
$ct_set = "";
|
||||
}elsif($table !~ /content/){
|
||||
$ct_set = "change='now()'";
|
||||
}
|
||||
|
||||
if("$content" eq "null" || (!$content && $content !~ /^0$/)){
|
||||
$ct_set .= ",$column=null";
|
||||
}elsif($content || $content == 0){
|
||||
$ct_set .= ",$column='$content'";
|
||||
}
|
||||
$ct_set .= ",owner='$owner'" if($owner);
|
||||
$ct_set =~ s/^,/ /;
|
||||
my $where = "$w_col='$w_val'";
|
||||
$where .= " and $w_col2 $w_op2 ($w_val2)" if("$w_col2" && "$w_op2" && "$w_val2");
|
||||
my $sth = $dbh->prepare("UPDATE $table SET $ct_set where $where");
|
||||
my $rows = $sth->execute();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
||||
my $ctadr = &get_contentadr($c_id,$emailpw) if($c_id =~ /^\d+$/ || $emailpw =~ /\w+\@\w+/);
|
||||
|
||||
my $smtp = Net::SMTP->new($mailxconf{mailx_default}->{mail_gateway},
|
||||
Port => 465,
|
||||
Hello => 'sharee.bike',
|
||||
Timeout => 30,
|
||||
Debug => 0,
|
||||
SSL => 1,
|
||||
);
|
||||
|
||||
|
||||
#$varenv{sasl_password} = Encode::encode('iso-8859-1', Encode::decode('utf-8', $varenv{sasl_password}));
|
||||
$smtp->auth($mailxconf{mailx_default}->{sasl_username},$mailxconf{mailx_default}->{sasl_password});
|
||||
$smtp->mail($mailxconf{mailx_default}->{mail_from});
|
||||
|
||||
my $smtp_return = "";
|
||||
if($todo eq "emailack"){
|
||||
$smtp_return = &esender_success($smtp,$ctadr,$wwwhost);
|
||||
}elsif($todo eq "send_password" && $ctadr->{txt08} =~ /\w+\@\w+/){
|
||||
$smtp_return = &esender_password($smtp,$ctadr,$coopw,$wwwhost);
|
||||
}elsif($todo eq "send_invoice"){
|
||||
my $send_invoice;
|
||||
$smtp_return = &esender_invoice($smtp,$todo,$ctadr,$ct_name,$wwwhost);
|
||||
# if sendmail true then null. For us we need text
|
||||
#if(!$smtp_return && $ct_name =~ /\d+/){
|
||||
if($ct_name =~ /\d+/){
|
||||
$today =~ s/:\d+$//;
|
||||
$send_invoice = "$today, Rechnungsinfo per eMail versandt (debug: $smtp_return)";
|
||||
&updater("contenttrans","ct_name","$ct_name","txt30","$send_invoice","","","","","no_time");
|
||||
}
|
||||
}elsif($todo eq "send_capture_fail"){
|
||||
$smtp_return = &esender_invoice($smtp,$todo,$ctadr,$ct_name,$wwwhost);
|
||||
}
|
||||
open(EMA, ">> $varenv{logdir}/newsletter_tink.log");
|
||||
print EMA "smtp_return: $smtp_return\n";
|
||||
close EMA;
|
||||
|
||||
|
||||
|
||||
#Registration acknowledgement
|
||||
sub esender_success {
|
||||
my $smtp = shift;
|
||||
my $ctadr = shift;
|
||||
my $wwwhost = shift;
|
||||
my %varenv = &Config::envonline("","$wwwhost");
|
||||
|
||||
my $ct = &get_content("contentuser",$globalconf{shareedms_conf}->{parent_node},"201");
|
||||
|
||||
|
||||
my $email = $q->unescapeHTML($ctadr->{txt08});
|
||||
my $anrede = $q->unescapeHTML($ctadr->{txt02});
|
||||
my $name = $q->unescapeHTML($ctadr->{txt01});
|
||||
$name = Encode::encode('iso-8859-1', Encode::decode('utf-8', $name));
|
||||
|
||||
my $strasse = $q->unescapeHTML($ctadr->{txt03});
|
||||
$strasse = Encode::encode('iso-8859-1', Encode::decode('utf-8', $strasse));
|
||||
|
||||
my $ort = $q->unescapeHTML($ctadr->{txt06});
|
||||
my $telefon = $q->unescapeHTML($ctadr->{txt07});
|
||||
|
||||
#Ack digest
|
||||
my $ack_digest = $q->unescapeHTML($ctadr->{txt34}) || "";
|
||||
my $email_ack_digest = $1 if($ack_digest =~ /^(.{5})/);
|
||||
my $sms_ack_digest = $1 if($ack_digest =~ /(.{5})$/);
|
||||
|
||||
#disabled because of payone payment
|
||||
#my $iban = $q->unescapeHTML($ctadr->{txt22});
|
||||
#$iban =~ s/.{3}$/XXX/;
|
||||
#IBAN: $iban (letzte drei Ziffern maskiert)
|
||||
|
||||
|
||||
#email html body---------------------------------------------------
|
||||
my $body = "";
|
||||
my $encoded_email = $uri_encode->encode($ctadr->{txt08});
|
||||
$body = <<EOF
|
||||
Vielen Dank für Ihre Registrierung im Mietradsystem.
|
||||
|
||||
Damit Sie Ihr Nutzerkonto in der App freischalten können, verwenden Sie folgenden e-Mail Bestätigungscode bei Ihrer Registrierung.
|
||||
Der e-Mail Bestätigungscode lautet: <b>$email_ack_digest</b>
|
||||
|
||||
Viel Spaß beim Radeln.
|
||||
<div>
|
||||
$ct->{txt09}
|
||||
$ct->{txt04}
|
||||
$ct->{txt05}
|
||||
|
||||
$ct->{txt08}
|
||||
$ct->{txt11}
|
||||
|
||||
Bei Fragen zum e-Mail Bestätigungscode können sie uns unter hotline\@sharee.bike erreichen.
|
||||
</div>
|
||||
|
||||
|
||||
EOF
|
||||
;
|
||||
|
||||
$body =~ s/\n/<br \/>/g;
|
||||
my $html = "<html><head><title>$varenv{title}</title></head><body style='text-align:left;border:0px solid silver;padding:15px;margin:2%;width:90%;'>\n";
|
||||
$html .= "<div>$body</div>";
|
||||
$html .= "</body></html>";
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
my $subject = "Mietrad Anmeldebestätigung";
|
||||
if($hostname ne "ginger"){
|
||||
$email = $mailxconf{mailx_default}->{mail_to};
|
||||
$subject .= "* offline Test *";
|
||||
}
|
||||
|
||||
if ($smtp->to($email)) {
|
||||
$smtp->data();
|
||||
$smtp->datasend("To: $email\n");
|
||||
$smtp->datasend("Subject: $subject\nMIME-Version: 1.0\nContent-Type: text/html; charset=UTF-8 \n\n");
|
||||
$smtp->datasend($html);
|
||||
$smtp->dataend();
|
||||
} else {
|
||||
print "Error: ", $smtp->message();
|
||||
}
|
||||
|
||||
return "1. okay";
|
||||
}
|
||||
|
||||
#Password forgotten
|
||||
sub esender_password {
|
||||
my ($smtp,$ctadr,$coopw,$wwwhost) = @_;
|
||||
|
||||
my %varenv = &Config::envonline("","$wwwhost");
|
||||
|
||||
my $ct = {};
|
||||
if($varenv{syshost} =~ /konrad|tink/i){
|
||||
$ct = &get_content("content","3435","1");
|
||||
$ct->{txt01} = $q->unescapeHTML($ct->{txt01});
|
||||
$ct->{txt01} =~ s/\r\n/<br \/>/g;
|
||||
$ct->{txt01} = Encode::encode('iso-8859-1', Encode::decode('utf-8', $ct->{txt01}));
|
||||
}else{
|
||||
$ct = &get_content("contentuser",$globalconf{shareedms_conf}->{parent_node},"201");
|
||||
}
|
||||
|
||||
|
||||
my $email = $q->unescapeHTML($ctadr->{txt08});
|
||||
my $anrede = $q->unescapeHTML($ctadr->{txt02});
|
||||
my $name = $q->unescapeHTML($ctadr->{txt01});
|
||||
$name = Encode::encode('iso-8859-1', Encode::decode('utf-8', $name));
|
||||
|
||||
|
||||
#email html body---------------------------------------------------
|
||||
my $body;
|
||||
if($varenv{syshost} =~ /konrad|tink/i){
|
||||
$body = <<EOF
|
||||
Hallo $name,
|
||||
|
||||
Sie haben ein neues Passwort beantragt. Das neue Passwort lautet: <b>$coopw</b>
|
||||
|
||||
Nach Ihrem Login <a href='http://www.konrad-konstanz.de'>www.konrad-konstanz.de</a> können Sie das Passwort in Ihrem Profil unter Kundendaten auch gerne wieder ändern.
|
||||
|
||||
Viel Spaß beim Radeln.
|
||||
|
||||
EOF
|
||||
;
|
||||
|
||||
}else{#sharee
|
||||
|
||||
$body = <<EOF
|
||||
Hallo $name,
|
||||
|
||||
Sie haben ein neues Passwort beantragt. Das neue Passwort lautet: <b>$coopw</b>
|
||||
|
||||
Nach Ihrem Login können Sie das Passwort in Ihrem NutzerInnen Konto unter 1.Kundendaten auch gerne wieder ändern.
|
||||
|
||||
<div>
|
||||
Freundliche Grüße,
|
||||
--
|
||||
$ct->{txt09}
|
||||
$ct->{txt04}
|
||||
$ct->{txt05}
|
||||
|
||||
$ct->{txt08}
|
||||
$ct->{txt11}
|
||||
</div>
|
||||
|
||||
sharee.bike ist ein Angebot der TeilRad GmbH
|
||||
|
||||
EOF
|
||||
;
|
||||
}
|
||||
|
||||
$body =~ s/\n/<br \/>/g;
|
||||
my $html = "<html><head><title>$varenv{title}</title></head><body style='text-align:left;border:0px solid silver;padding:15px;margin:2%;width:90%;'>\n";
|
||||
$html .= "<div>$body</div>";
|
||||
#if($mandant eq "TINK"){
|
||||
# $html .= "<div><img src=\"https://www2.tink-konstanz.de/img/TINK_Signatur.jpg\" \/></div>";
|
||||
#}
|
||||
if($varenv{syshost} =~ /konrad|tink/i){
|
||||
$html .= "<div>$ct->{txt01}</div>\n";
|
||||
}
|
||||
$html .= "</body></html>";
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
my $subject = "$varenv{title} Passwort vergessen";
|
||||
if($hostname ne "ginger"){
|
||||
$email = $mailxconf{mailx_default}->{mail_to};
|
||||
$subject .= "* offline Test *";
|
||||
}
|
||||
|
||||
if ($smtp->to($email)) {
|
||||
$smtp->data();
|
||||
$smtp->datasend("To: $email\n");
|
||||
$smtp->datasend("Subject: $subject\nMIME-Version: 1.0\nContent-Type: text/html; charset=UTF-8 \n\n");
|
||||
$smtp->datasend($html);
|
||||
$smtp->dataend();
|
||||
} else {
|
||||
print "Error: ", $smtp->message();
|
||||
}
|
||||
|
||||
return "2. okay";
|
||||
}
|
||||
|
||||
#Send Invoice and capture_fails
|
||||
sub esender_invoice {
|
||||
my ($smtp,$todo,$ctadr,$ct_name,$wwwhost) = @_;
|
||||
|
||||
my %varenv = &Config::envonline("","$wwwhost");
|
||||
my $ct = {};
|
||||
$ct = &get_content("contentuser",$globalconf{shareedms_conf}->{parent_node},"201");
|
||||
|
||||
#generate html for email-body
|
||||
my $email = $q->unescapeHTML($ctadr->{txt08});
|
||||
my $anrede = $q->unescapeHTML($ctadr->{txt02});
|
||||
my $name = $q->unescapeHTML($ctadr->{txt01});
|
||||
$name = Encode::encode('iso-8859-1', Encode::decode('utf-8', $name));
|
||||
|
||||
|
||||
#email html body---------------------------------------------------
|
||||
my $subject;
|
||||
my $body;
|
||||
my $signature;
|
||||
|
||||
if($varenv{syshost} =~ /konrad|tink/i){
|
||||
$signature = <<EOF
|
||||
Mit freundlichen Grüßen,
|
||||
--
|
||||
fahrradspezialitaeten.com
|
||||
Heinrich-von-Stephan-Str. 12
|
||||
79100 Freiburg
|
||||
|
||||
|
||||
<small>Für Hinweise auf herumstehende Räder (gerne mit Radnummer, genauer Position und Fotos) aber auch Personen, die unsere Räder unrechtmäßig fahren oder beschädigen sind wir sehr dankbar. Sie erreichen uns über E-Mail (konrad\@fahrradspezialitaeten.com) und telefonisch über unsere Hotline: +49 761 45370099 (7 Tage/ 24 Stunden erreichbar).
|
||||
Wenn Sie beobachten, wie jemand eines unserer Räder beschädigt, rufen Sie bitte unmittelbar die Polizei (Tel.:07531 995 2222) hinzu!
|
||||
|
||||
Vielen Dank für Ihre Unterstützung!</small>
|
||||
|
||||
EOF
|
||||
;
|
||||
$signature =~ s/\n/<br \/>/g;
|
||||
}
|
||||
|
||||
if($todo eq "send_invoice"){
|
||||
|
||||
#$subject = "TINK Rechnung";
|
||||
$subject = "Fahrradmietsystem Rechnung";
|
||||
|
||||
if($varenv{syshost} =~ /konrad|tink/i){
|
||||
|
||||
$body = <<EOF
|
||||
Guten Tag $name,
|
||||
|
||||
Ihre aktuelle Rechnung mit der Nummer $ct_name liegt ab sofort unter <a href='https://www.stadtwerke-konstanz.de/mobilitaet/rad-mietsystem?konrad_goto=Anmelden'>https://www.stadtwerke-konstanz.de/mobilitaet/rad-mietsystem</a> für Sie bereit.
|
||||
Nach dem Anmelden ist in Ihrem Nutzer Profil unter Verleihdaten die Rechnung als PDF hinterlegt.
|
||||
|
||||
EOF
|
||||
;
|
||||
$body =~ s/\n/<br \/>/g;
|
||||
|
||||
}else{#sharee
|
||||
|
||||
$body = <<EOF
|
||||
Guten Tag $name,
|
||||
|
||||
Ihre aktuelle Rechnung mit der Nummer $ct_name liegt ab sofort in Ihrem sharee.bike App Konto für Sie bereit.
|
||||
Nach dem Anmelden ist in Ihrem Nutzer Konto unter Verleihdaten die Rechnung als PDF hinterlegt.
|
||||
|
||||
<div>
|
||||
Freundliche Grüße,
|
||||
--
|
||||
$ct->{txt09}
|
||||
$ct->{txt04}
|
||||
$ct->{txt05}
|
||||
|
||||
$ct->{txt08}
|
||||
$ct->{txt11}
|
||||
</div>
|
||||
|
||||
sharee.bike ist ein Angebot der TeilRad GmbH
|
||||
|
||||
EOF
|
||||
;
|
||||
$body =~ s/\n/<br \/>/g;
|
||||
}
|
||||
|
||||
}elsif($todo eq "send_capture_fail"){
|
||||
|
||||
|
||||
$subject = "Fahrradmietsystem Account";
|
||||
|
||||
if($varenv{syshost} =~ /konrad|tink/i){
|
||||
|
||||
$body = <<EOF
|
||||
Guten Tag $name,
|
||||
|
||||
wir mussten Ihren Fahrradmietsystem Account sperren weil der letzte Mietbetrag nicht eingezogen werden konnte.
|
||||
Sie können Ihren Account selbst wieder freischalten, indem Sie die Zahlungsdaten erneuern. Dies kann aus Sicherheitsgründen von Seiten Ihrer Bank nötig sein oder es gab einen Fehler in Ihren Eingaben.
|
||||
|
||||
Nach der Anmeldung im Fahrradmietsystem Konstanz ( <a href='https://www.stadtwerke-konstanz.de/mobilitaet/rad-mietsystem?konrad_goto=Anmelden'>https://www.stadtwerke-konstanz.de/mobilitaet/rad-mietsystem</a> ) haben Sie die Möglichkeit Ihre Daten zu überprüfen und ggf. zu erneuern.
|
||||
Kontaktieren Sie uns bitte falls Ihr Account für den Verleih nicht automatisch freigeschaltet wurde.
|
||||
|
||||
Für weitere Fragen wenden Sie sich bitte an unsere Buchhaltung unter: buchhaltung\@fahrradspezialitaeten.com oder telefonisch 0761/5158912 (Mo, Mi, Fr 9-12 Uhr)
|
||||
|
||||
EOF
|
||||
;
|
||||
$body =~ s/\n/<br \/>/g;
|
||||
|
||||
}else{#sharee
|
||||
|
||||
$body = <<EOF
|
||||
Guten Tag $name,
|
||||
|
||||
wir mussten Ihren Fahrradmietsystem Account sperren weil der letzte Mietbetrag nicht eingezogen werden konnte.
|
||||
Sie können Ihren Account selbst wieder freischalten, indem Sie die Zahlungsdaten erneuern. Dies kann aus Sicherheitsgründen von Seiten Ihrer Bank nötig sein oder es gab einen Fehler in Ihren Eingaben.
|
||||
|
||||
Nach der Anmeldung in Ihrem Konto der sharee.bike App haben Sie die Möglichkeit Ihre Daten zu überprüfen und ggf. zu erneuern.
|
||||
Kontaktieren Sie uns bitte falls Ihr Account für den Verleih nicht automatisch freigeschaltet wurde.
|
||||
|
||||
Für weitere Fragen wenden Sie sich bitte an unsere Buchhaltung unter: post\@sharee.bike oder telefonisch 0761/5158912 (Mo, Mi, Fr 9-12 Uhr)
|
||||
|
||||
<div>
|
||||
Freundliche Grüße,
|
||||
--
|
||||
$ct->{txt09}
|
||||
$ct->{txt04}
|
||||
$ct->{txt05}
|
||||
|
||||
$ct->{txt08}
|
||||
$ct->{txt11}
|
||||
</div>
|
||||
|
||||
sharee.bike ist ein Angebot der TeilRad GmbH
|
||||
|
||||
EOF
|
||||
;
|
||||
$body =~ s/\n/<br \/>/g;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
my $html = "<html><head><title></title></head><body style='text-align:left;border:0px solid silver;padding:15px;margin:2%;width:90%;'>\n";
|
||||
$html .= "<div>$body</div>\n";
|
||||
#$html .= "<div><img src=\"https://www2.tink-konstanz.de/img/TINK_Signatur.jpg\" \/></div>";
|
||||
$html .= "<div>$signature</div>\n";
|
||||
$html .= "</body></html>";
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
|
||||
if($hostname ne "ginger"){
|
||||
$email = $mailxconf{mailx_default}->{mail_to};
|
||||
$subject .= "* offline Test *";
|
||||
}
|
||||
my $message;
|
||||
|
||||
|
||||
if ($smtp->to($email)) {
|
||||
$smtp->data();
|
||||
$smtp->datasend("To: $email\n");
|
||||
$smtp->datasend("Subject: $subject\nMIME-Version: 1.0\nContent-Type: text/html; charset=UTF-8 \n\n");
|
||||
$smtp->datasend($html);
|
||||
$smtp->dataend();
|
||||
} else {
|
||||
print "Error: ", $smtp->message();
|
||||
}
|
||||
|
||||
return "3. okay";
|
||||
}
|
||||
|
||||
|
||||
|
||||
open(EMA, ">> $varenv{logdir}/newsletter_tink.log");
|
||||
print EMA "\n$today, done mailing\n";
|
||||
print EMA "'$today' '$basedir' '$wwwhost' '$todo' '$ctadr->{txt08}'\n";
|
||||
print EMA "\n\n";
|
||||
close EMA;
|
||||
|
||||
$smtp->quit;
|
||||
|
||||
1;
|
Loading…
Add table
Add a link
Reference in a new issue