mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 19:56:29 +01: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
|
@ -110,12 +110,7 @@ div#Container_cms {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
.content2_cms {
|
|
||||||
padding:4px 3px;
|
|
||||||
min-width:100px;
|
|
||||||
vertical-align: top;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
img {border:0px solid black;}
|
img {border:0px solid black;}
|
||||||
|
@ -369,6 +364,8 @@ div#Oline {
|
||||||
}
|
}
|
||||||
.etxt2 {
|
.etxt2 {
|
||||||
font-size:100%;
|
font-size:100%;
|
||||||
|
border: 1px solid #FF5F1F;
|
||||||
|
padding:1px;
|
||||||
margin:1px;
|
margin:1px;
|
||||||
}
|
}
|
||||||
.stxt {
|
.stxt {
|
||||||
|
@ -420,6 +417,11 @@ div#Oline {
|
||||||
border: 1px solid silver;
|
border: 1px solid silver;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
.eselect2 {
|
||||||
|
font-size:1em;
|
||||||
|
border: 1px solid #FF5F1F;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
.eselect_multiple {
|
.eselect_multiple {
|
||||||
font-size:1em;
|
font-size:1em;
|
||||||
border: 1px solid silver;
|
border: 1px solid silver;
|
||||||
|
|
|
@ -907,7 +907,7 @@ sub booking_request(){
|
||||||
my $response_text = "";
|
my $response_text = "";
|
||||||
|
|
||||||
#state and lock_state is only defined if requestes incl. occupied
|
#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 = {
|
my $update_adr = {
|
||||||
table => "contentadr",
|
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});
|
$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 = "";
|
my $Ilockit_GUID = "";
|
||||||
$Ilockit_GUID = $q->escapeHTML($q->param('Ilockit_GUID')) if($q->param('Ilockit_GUID') && $q->param('Ilockit_GUID') =~ /\w+-\w+-\w+-\w+$/);
|
$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
|
#set rent state if lock_system 2=Ilockit || 3=sigo
|
||||||
if($record_pos->{int11} && ($record_pos->{int11} == 2 || $record_pos->{int11} == 3)){
|
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
|
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'));
|
$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);
|
my $booking = $dbt->fetch_tablerecord($dbh,$booking_pos);
|
||||||
|
|
||||||
if(ref($booking) eq "HASH" && $booking->{ct_name}){
|
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->{bike} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}$booking->{barcode}";
|
||||||
$booking_values->{state} = "$dbt->{copri_conf}->{bike_state}->{$booking->{int10}}";
|
$booking_values->{state} = "$dbt->{copri_conf}->{bike_state}->{$booking->{int10}}";
|
||||||
$booking_values->{lock_state} = "$dbt->{copri_conf}->{lock_state}->{$booking->{int20}}";
|
$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
|
#user_miniquest_count on operator
|
||||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||||
|
@ -2001,8 +2012,8 @@ sub bikes_all(){
|
||||||
my $pref = {
|
my $pref = {
|
||||||
table => "content",
|
table => "content",
|
||||||
fetch => "all",
|
fetch => "all",
|
||||||
keyfield => "barcode",#2018-02-21 changed to bike id
|
keyfield => "barcode",
|
||||||
template_id => "205",#Leihrad_liste
|
template_id => "205",
|
||||||
};
|
};
|
||||||
|
|
||||||
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie'));
|
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));
|
$pref->{int04} = "=::$station_id" if(looks_like_number($station_id));
|
||||||
if(looks_like_number($bike_id)){
|
if(looks_like_number($bike_id)){
|
||||||
$pref->{ barcode} = "=::$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 = {};
|
my $record = {};
|
||||||
|
@ -2201,7 +2216,7 @@ sub stations_available(){
|
||||||
}elsif($station_group && $type_id =~ /(\d+)/){
|
}elsif($station_group && $type_id =~ /(\d+)/){
|
||||||
my $group_id = $1;
|
my $group_id = $1;
|
||||||
if($group_id == $station_group){
|
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",
|
apiserver => "$apiserver",
|
||||||
response => "$respreq",
|
response => "$respreq",
|
||||||
uri_primary => "$dbt->{primary}->{sharee_primary}->{primaryApp}",
|
uri_primary => "$dbt->{primary}->{sharee_primary}->{primaryApp}",
|
||||||
copri_version => "4.1.23.03",
|
copri_version => "4.1.23.10",
|
||||||
user_id => "",
|
user_id => "",
|
||||||
authcookie => "",
|
authcookie => "",
|
||||||
new_authcoo => "0",
|
new_authcoo => "0",
|
||||||
|
@ -161,7 +161,9 @@ if($q->param('request') eq "auth_verify"){
|
||||||
$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->auth_verify($q);
|
my $auth = {};
|
||||||
|
my $authraw = {};
|
||||||
|
($auth,$authraw) = $apif->auth_verify($q);
|
||||||
$response = { %$response, %$auth };
|
$response = { %$response, %$auth };
|
||||||
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
||||||
$response = { %$response, %$auth };
|
$response = { %$response, %$auth };
|
||||||
|
@ -211,7 +213,9 @@ elsif($q->param('request') eq "booking_request"){
|
||||||
my $rows = 0;
|
my $rows = 0;
|
||||||
$response = { %$response, %$return_merchant };
|
$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 = { %$response, %$auth };
|
||||||
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
||||||
my $bike = $q->escapeHTML($q->param('bike')) || "";
|
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};
|
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||||
$response = { %$response, %$return_merchant };
|
$response = { %$response, %$return_merchant };
|
||||||
|
|
||||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
my $auth = {};
|
||||||
|
my $authraw = {};
|
||||||
|
($auth,$authraw) = $apif->auth_verify($q);
|
||||||
my $rows = 0;
|
my $rows = 0;
|
||||||
$response = { %$response, %$auth };
|
$response = { %$response, %$auth };
|
||||||
|
|
||||||
|
@ -436,7 +442,9 @@ elsif($q->param('request') eq "user_bikes_occupied"){
|
||||||
$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->auth_verify($q);
|
my $auth = {};
|
||||||
|
my $authraw = {};
|
||||||
|
($auth,$authraw) = $apif->auth_verify($q);
|
||||||
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
||||||
$response = { %$response, %$auth };
|
$response = { %$response, %$auth };
|
||||||
($response->{bikes_occupied},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant,"");
|
($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{
|
}else{
|
||||||
|
my $auth = {};
|
||||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
my $authraw = {};
|
||||||
|
($auth,$authraw) = $apif->auth_verify($q);
|
||||||
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
if(ref($auth) eq "HASH" && $auth->{authcookie}){
|
||||||
$response = { %$response, %$auth };
|
$response = { %$response, %$auth };
|
||||||
my $record = $apif->user_bikes_occupied($dbh,$authraw,"show_dialog");
|
my $record = $apif->user_bikes_occupied($dbh,$authraw,"show_dialog");
|
||||||
|
@ -509,7 +518,9 @@ elsif($q->param('request') eq "bikes_all"){
|
||||||
$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->auth_verify($q);
|
my $auth = {};
|
||||||
|
my $authraw = {};
|
||||||
|
($auth,$authraw) = $apif->auth_verify($q);
|
||||||
$response = { %$response, %$auth };
|
$response = { %$response, %$auth };
|
||||||
($response->{bikes},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant,"");
|
($response->{bikes},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant,"");
|
||||||
}else{
|
}else{
|
||||||
|
@ -650,7 +661,9 @@ elsif($q->param('request') eq "stations_all"){
|
||||||
$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->auth_verify($q);
|
my $auth = {};
|
||||||
|
my $authraw = {};
|
||||||
|
($auth,$authraw) = $apif->auth_verify($q);
|
||||||
$response = { %$response, %$auth };
|
$response = { %$response, %$auth };
|
||||||
($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant,"");
|
($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant,"");
|
||||||
}else{
|
}else{
|
||||||
|
@ -673,7 +686,9 @@ elsif($q->param('request') eq "stations_available"){
|
||||||
$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->auth_verify($q);
|
my $auth = {};
|
||||||
|
my $authraw = {};
|
||||||
|
($auth,$authraw) = $apif->auth_verify($q);
|
||||||
|
|
||||||
my $user_agent_subversion = 1000;
|
my $user_agent_subversion = 1000;
|
||||||
#$user_agent = "Meinkonrad/3.0.363";#test
|
#$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 $localtime = Time::Piece->strptime($lnow, "%Y-%m-%d %H:%M:%S");
|
||||||
my $epoch_now = $localtime->epoch;
|
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_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_start = $merchant_message_start->epoch;
|
||||||
my $epoch_end = $merchant_message_end->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};
|
$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 = { %$response, %$auth };
|
||||||
($response->{stations},$response->{uri_operator_array},$response->{user_group},$response->{user_tour}) = $jsc->loop_sharees($q,$auth,$authraw,$return_merchant,"");
|
($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");
|
$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);
|
($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{
|
}else{
|
||||||
($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
|
($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};
|
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||||
$response = { %$response, %$return_merchant };
|
$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 = { %$response, %$auth };
|
||||||
$response->{uri_operator} = "$varenv{wwwhost}";
|
$response->{uri_operator} = "$varenv{wwwhost}";
|
||||||
|
|
||||||
|
@ -783,7 +810,9 @@ elsif($q->param('request') eq "service_done"){
|
||||||
$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->auth_verify($q);
|
my $auth = {};
|
||||||
|
my $authraw = {};
|
||||||
|
($auth,$authraw) = $apif->auth_verify($q);
|
||||||
my $station_id = $1 if($q->param('station') =~ /(\d+)/);
|
my $station_id = $1 if($q->param('station') =~ /(\d+)/);
|
||||||
#my $bike_id = $1 if($q->param('bike') =~ /(\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};
|
$varenv{merchant_id} = $return_merchant->{merchant_id};
|
||||||
$response = { %$response, %$return_merchant };
|
$response = { %$response, %$return_merchant };
|
||||||
|
|
||||||
my ($auth,$authraw) = $apif->auth_verify($q);
|
my $auth = {};
|
||||||
|
my $authraw = {};
|
||||||
|
($auth,$authraw) = $apif->auth_verify($q);
|
||||||
my $station_id = "";
|
my $station_id = "";
|
||||||
$station_id = $1 if($q->param('station') =~ /(\d+)/);
|
$station_id = $1 if($q->param('station') =~ /(\d+)/);
|
||||||
#$bike_id = $1 if($q->param('bike') =~ /(\d+)/);
|
#$bike_id = $1 if($q->param('bike') =~ /(\d+)/);
|
||||||
|
|
|
@ -125,7 +125,6 @@ sub sig_available {
|
||||||
$response_out->{$station}->{description} = "";
|
$response_out->{$station}->{description} = "";
|
||||||
#$response_out->{$station}->{description} = "$resp->{site}->{address}" || "";
|
#$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}->{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}->{latitude} = "$resp->{site}->{lat}" || "";
|
||||||
$response_out->{$station}->{gps}->{longitude} = "$resp->{site}->{lon}" || "";
|
$response_out->{$station}->{gps}->{longitude} = "$resp->{site}->{lon}" || "";
|
||||||
$response_out->{$station}->{gps_radius} = "75";
|
$response_out->{$station}->{gps_radius} = "75";
|
||||||
|
@ -138,6 +137,13 @@ sub sig_available {
|
||||||
$response_out->{$station}->{state} = "maintenance";
|
$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} = {
|
$response_out->{$station}->{operator_data} = {
|
||||||
"operator_name" => "",
|
"operator_name" => "",
|
||||||
"operator_hours" => "",
|
"operator_hours" => "",
|
||||||
|
@ -402,12 +408,13 @@ sub sig_booking {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $varenv = shift || {};
|
my $varenv = shift || {};
|
||||||
my $todo = shift || "";
|
my $todo = shift || "";
|
||||||
my $ctadr = shift || {};
|
my $authraw = shift || {};
|
||||||
my $ct_bike = shift || {};
|
my $ct_bike = shift || {};
|
||||||
my $ctpos = shift || {};
|
my $ctpos = shift || {};
|
||||||
|
|
||||||
my $dbh = "";
|
my $dbh = "";
|
||||||
my $owner = 169;
|
my $owner = 169;
|
||||||
|
my $ctadr = $authraw;
|
||||||
my $sig_book = {};
|
my $sig_book = {};
|
||||||
|
|
||||||
open(FILE,">>$varenv->{logdir}/APIsigclient.log");
|
open(FILE,">>$varenv->{logdir}/APIsigclient.log");
|
||||||
|
|
|
@ -689,12 +689,14 @@ sub collect_post(){
|
||||||
sub fetch_cms {
|
sub fetch_cms {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $dbh = shift || $dbh_intern;
|
my $dbh = shift || $dbh_intern;
|
||||||
my $fetch = shift;
|
my $fetch = shift || {};
|
||||||
|
|
||||||
my $langfield = "txt02";#default to en
|
my $langfield = "txt02";#default to en
|
||||||
$langfield = "txt01" if($fetch->{lang} eq "de");
|
my $lang = "";
|
||||||
$langfield = "txt03" if($fetch->{lang} eq "fr");
|
$lang = lc($fetch->{lang}) if($fetch->{lang});
|
||||||
my $sql = "SELECT ct_name, coalesce($langfield, txt02) AS txt FROM contentuser, relation where template_id=194 and c_id=content_id";
|
$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 $sth = $dbh->prepare($sql);
|
||||||
my $rc = $sth->execute();
|
my $rc = $sth->execute();
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ sub mobox3(){
|
||||||
my $bg_color = "white";
|
my $bg_color = "white";
|
||||||
my $bg_color2 = $node_meta->{bg_color} || "grey";
|
my $bg_color2 = $node_meta->{bg_color} || "grey";
|
||||||
my $title = "Content Editor \"$node_meta->{tpl_name}\"";
|
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 = "Kunden Editor" if($node_meta->{ct_table} eq "contentadr");
|
||||||
$title = "DMS-Account Zugriffsberechtigung" if($node_meta->{ct_table} eq "users");
|
$title = "DMS-Account Zugriffsberechtigung" if($node_meta->{ct_table} eq "users");
|
||||||
$title = "Service Editor" if($node_meta->{ct_table} eq "contentpos");
|
$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";
|
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
|
#send_invoice infomail, only if eMail never sent
|
||||||
if(-f "$varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf" && !$ctt->{txt30}){
|
if(-f "$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/pdfinvoice/$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'");
|
system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_invoice' '$ctt->{int10}' '$ctt->{c_id}' ''");
|
||||||
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";
|
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;
|
close EMA;
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,7 @@ sub save_content {
|
||||||
$valxx = $q->escapeHTML("$val");
|
$valxx = $q->escapeHTML("$val");
|
||||||
$valxx =~ s/,/./;
|
$valxx =~ s/,/./;
|
||||||
$valxx =~ s/\s//g;
|
$valxx =~ s/\s//g;
|
||||||
if($valxx && looks_like_number($valxx)){
|
if(looks_like_number($valxx) || $valxx == 0){
|
||||||
$update_ct->{$_} = "$valxx";
|
$update_ct->{$_} = "$valxx";
|
||||||
}elsif(!$valxx || $valxx eq "null"){
|
}elsif(!$valxx || $valxx eq "null"){
|
||||||
$update_ct->{$_} = "null";
|
$update_ct->{$_} = "null";
|
||||||
|
|
|
@ -671,6 +671,9 @@ sub preinit(){
|
||||||
my $c_id4print = $R::c_id4trans;
|
my $c_id4print = $R::c_id4trans;
|
||||||
$c_id4print= $R::c_id if($R::printer_id =~ /Adresse|Kunde/);
|
$c_id4print= $R::c_id if($R::printer_id =~ /Adresse|Kunde/);
|
||||||
if($c_id4print){
|
if($c_id4print){
|
||||||
|
open(EMA, ">> $varenv{logdir}/copri-print.log");
|
||||||
|
print EMA "$today4db\n";
|
||||||
|
|
||||||
my $print_return = "";
|
my $print_return = "";
|
||||||
my $exit_code = 1;
|
my $exit_code = 1;
|
||||||
my $table = "contenttrans";
|
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`;
|
$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 = $?;
|
$exit_code = $?;
|
||||||
|
|
||||||
if(1==1){#debugging
|
|
||||||
my $filesize = -s "$varenv{pdf}/$praefix-$ctt->{ct_name}.pdf";
|
my $filesize = -s "$varenv{pdf}/$praefix-$ctt->{ct_name}.pdf";
|
||||||
open(EMA, ">> $varenv{logdir}/copri-print.log");
|
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";
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($R::set_state ne "buchen"){#no redirect if buchen incl. print_pdf
|
if($R::set_state ne "buchen"){#no redirect if buchen incl. print_pdf
|
||||||
if( -f "$varenv{basedir}/pdf/$praefix-$ctt->{ct_name}.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"))){
|
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("$varenv{basedir}/src/scripts/mailTransport.pl '$varenv{syshost}' 'send_invoice' '$ctt->{c_id}' '$praefix-$ctt->{ct_name}.pdf'");
|
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
|
}#end c_id4print
|
||||||
|
|
||||||
#SET Tagesabschluss
|
#SET Tagesabschluss
|
||||||
|
|
|
@ -145,7 +145,7 @@ sub sms_message {
|
||||||
#todo send_alarm2hotline
|
#todo send_alarm2hotline
|
||||||
if($todo eq "send_alarm2hotline"){
|
if($todo eq "send_alarm2hotline"){
|
||||||
$sms_from = "RadAlarm";
|
$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
|
#todo fraud_rental
|
||||||
|
|
|
@ -757,31 +757,30 @@ sub save_transact(){
|
||||||
|
|
||||||
|
|
||||||
#Send sms after payable check and !int13
|
#Send sms after payable check and !int13
|
||||||
sub smsack(){
|
sub smsack {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $ctadr = shift;
|
my $ctadr = shift;
|
||||||
$smstrans->sms_ack_digest($ctadr);
|
$smstrans->sms_ack_digest($ctadr);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#Send email after payable check and !int04
|
#Send email after payable check and !int04
|
||||||
sub emailack(){
|
sub emailack {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $varenv = shift;
|
my $varenv = shift;
|
||||||
my $adr_id = shift || "";
|
my $adr_id = shift || "";
|
||||||
|
system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_emailack' '$adr_id' ''");
|
||||||
system(`$varenv->{basedir}/src/Mod/newsletter_tink.pl "$varenv->{basedir}" "$varenv->{wwwhost}" "emailack" "$adr_id" ""`);
|
return;
|
||||||
#TODO
|
|
||||||
#system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_emailack' '$adr_id' ''");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Password forgotten send email
|
#Password forgotten send email
|
||||||
sub send_password(){
|
sub send_password {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $varenv = shift;
|
my $varenv = shift;
|
||||||
my $email = shift || "";
|
my $email = shift || "";
|
||||||
my $coo = shift || "";
|
my $coo = shift || "";
|
||||||
my $owner = shift || "";
|
my $owner = shift || "";
|
||||||
|
my $dbh = "";
|
||||||
$email = $q->escapeHTML($email);
|
$email = $q->escapeHTML($email);
|
||||||
$email =~ s/\s//g;
|
$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){
|
if($email && $email =~ /\w\@\w/ && $pwmd5 && length($pwmd5) > 20 && $email !~ /$dbt->{copri_conf}->{test_accounts}/i){
|
||||||
my $pwsha256=sha256_base64($pwmd5) || "";
|
my $pwsha256=sha256_base64($pwmd5) || "";
|
||||||
$db->updater("contentadr","1","1","txt04","$pwsha256","$owner","txt08","ilike","$email");
|
my $authref = {
|
||||||
system(`$varenv->{basedir}/src/Mod/newsletter_tink.pl "$varenv->{basedir}" "$varenv->{wwwhost}" "send_password" "$email" "$coo"`);
|
table => "contentadr",
|
||||||
#TODO
|
fetch => "one",
|
||||||
#system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_password' '$c_id' ''");
|
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
|
#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;
|
|
|
@ -386,7 +386,9 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<td class='content1_cms' style='$occupied_style;'\n>";
|
print "<td class='content1_cms' style='$occupied_style;'\n>";
|
||||||
print $q->textarea(-class=>'etxt',-style=>"border: 1px solid silver;",-name=>"$key",-default=>"$cttpos->{$key}", -override=>'1',-rows=>"5",-cols=>50),"\n";
|
my $class = "etxt";
|
||||||
|
$class = "etxt2" if($key eq "txt23");
|
||||||
|
print $q->textarea(-class=>"$class",-name=>"$key",-default=>"$cttpos->{$key}", -override=>'1',-rows=>"5",-cols=>50),"\n";
|
||||||
|
|
||||||
|
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
@ -401,7 +403,7 @@ EOF
|
||||||
}elsif($key eq "int04"){
|
}elsif($key eq "int04"){
|
||||||
print $q->Tr(),"\n";
|
print $q->Tr(),"\n";
|
||||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||||
print $q->td({-class=>'content1_cms'}, "$prefix", $q->textfield(-class=>'etxt',-name=>"int04",-default=>"$cttpos->{int04}",-size=>"15",-maxlength=>40)),"\n";
|
print $q->td({-class=>'content1_cms'}, "$prefix", $q->textfield(-class=>'etxt2',-name=>"int04",-default=>"$cttpos->{int04}",-size=>"15",-maxlength=>40)),"\n";
|
||||||
#End GPS
|
#End GPS
|
||||||
}elsif($key eq "txt06"){
|
}elsif($key eq "txt06"){
|
||||||
print $q->Tr(),"\n";
|
print $q->Tr(),"\n";
|
||||||
|
@ -417,27 +419,27 @@ EOF
|
||||||
$q->textfield(-id=>'datepicker3',-class=>'etxt',-name=>"start_date",-default=>"$s_dd.$s_mo.$s_yy",-size=>"10",-maxlength=>10),
|
$q->textfield(-id=>'datepicker3',-class=>'etxt',-name=>"start_date",-default=>"$s_dd.$s_mo.$s_yy",-size=>"10",-maxlength=>10),
|
||||||
$q->textfield(-class=>'etxt',-name=>"s_hh",-default=>"$s_hh",-size=>"2",-maxlength=>2),":",
|
$q->textfield(-class=>'etxt',-name=>"s_hh",-default=>"$s_hh",-size=>"2",-maxlength=>2),":",
|
||||||
$q->textfield(-class=>'etxt',-name=>"s_mi",-default=>"$s_mi",-size=>"2",-maxlength=>2)," → ",
|
$q->textfield(-class=>'etxt',-name=>"s_mi",-default=>"$s_mi",-size=>"2",-maxlength=>2)," → ",
|
||||||
$q->textfield(-id=>'datepicker4',-class=>'etxt',-name=>"end_date",-default=>"$e_dd.$e_mo.$e_yy",-size=>"10",-maxlength=>10),
|
$q->textfield(-id=>'datepicker4',-class=>'etxt2',-name=>"end_date",-default=>"$e_dd.$e_mo.$e_yy",-size=>"10",-maxlength=>10),
|
||||||
$q->textfield(-class=>'etxt',-name=>"e_hh",-default=>"$e_hh",-size=>"2",-maxlength=>2),":",
|
$q->textfield(-class=>'etxt2',-name=>"e_hh",-default=>"$e_hh",-size=>"2",-maxlength=>2),":",
|
||||||
$q->textfield(-class=>'etxt',-name=>"e_mi",-default=>"$e_mi",-size=>"2",-maxlength=>2)),"\n";
|
$q->textfield(-class=>'etxt2',-name=>"e_mi",-default=>"$e_mi",-size=>"2",-maxlength=>2)),"\n";
|
||||||
|
|
||||||
}elsif($key =~ /int10/ && "$size" eq "select"){#bike_state
|
}elsif($key =~ /int10/ && "$size" eq "select"){#bike_state
|
||||||
my @_lock_valxx = ();
|
my @_lock_valxx = ();
|
||||||
foreach my $s_key (sort keys (%{ $dbt->{copri_conf}->{bike_state} })) {
|
foreach my $s_key (sort keys (%{ $dbt->{copri_conf}->{bike_state} })) {
|
||||||
push @_lock_valxx, "$s_key:$dbt->{copri_conf}->{bike_state}->{$s_key}";
|
push @_lock_valxx, "$s_key:$dbt->{copri_conf}->{bike_state}->{$s_key}" if($s_key =~ /1|2|3/);
|
||||||
}
|
}
|
||||||
print $q->Tr();
|
print $q->Tr();
|
||||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||||
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector_class("$key","eselect","",$cttpos->{$key},@_lock_valxx));
|
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector_class("$key","eselect2","",$cttpos->{$key},@_lock_valxx));
|
||||||
|
|
||||||
}elsif($key =~ /int20/ && "$size" eq "select"){#lock_state locked/unlocked
|
}elsif($key =~ /int20/ && "$size" eq "select"){#lock_state locked/unlocked
|
||||||
my @_lock_valxx = ();
|
my @_lock_valxx = ();
|
||||||
foreach my $s_key (sort keys (%{ $dbt->{copri_conf}->{lock_state} })) {
|
foreach my $s_key (sort keys (%{ $dbt->{copri_conf}->{lock_state} })) {
|
||||||
push @_lock_valxx, "$s_key:$dbt->{copri_conf}->{lock_state}->{$s_key}";
|
push @_lock_valxx, "$s_key:$dbt->{copri_conf}->{lock_state}->{$s_key}" if($s_key =~ /1|2/);
|
||||||
}
|
}
|
||||||
print $q->Tr();
|
print $q->Tr();
|
||||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||||
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector_class("$key","eselect","",$cttpos->{$key},@_lock_valxx),"$postdes");
|
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector_class("$key","eselect2","",$cttpos->{$key},@_lock_valxx),"$postdes");
|
||||||
|
|
||||||
}elsif($key eq "int26"){
|
}elsif($key eq "int26"){
|
||||||
if($cttpos->{int26}){
|
if($cttpos->{int26}){
|
||||||
|
@ -867,7 +869,7 @@ EOF
|
||||||
}elsif($ctrel->{txt15} && $bonus_record->{ct_name} eq $ctrel->{txt15}){
|
}elsif($ctrel->{txt15} && $bonus_record->{ct_name} eq $ctrel->{txt15}){
|
||||||
my $sharing_type = "public-bonus";
|
my $sharing_type = "public-bonus";
|
||||||
$sharing_type = $dbt->{copri_conf}->{sharing_type}->{$tariff_all->{$bonus_record->{int22}}->{int18}} if($bonus_record->{int22});
|
$sharing_type = $dbt->{copri_conf}->{sharing_type}->{$tariff_all->{$bonus_record->{int22}}->{int18}} if($bonus_record->{int22});
|
||||||
$postdes .= "Ok, $sharing_type *code vorhanden. Trotzdem Tarif Einstellung prüfen.";
|
$postdes .= "Ok, $sharing_type *code vorhanden.";
|
||||||
}
|
}
|
||||||
print $q->Tr();
|
print $q->Tr();
|
||||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||||
|
@ -927,7 +929,7 @@ EOF
|
||||||
print $q->end_table;
|
print $q->end_table;
|
||||||
#2.table ende
|
#2.table ende
|
||||||
|
|
||||||
print $q->div($but->singlesubmit7("$edit","$save_key","$ib{$save_key}","margin:10px 5px;")),"\n";
|
print $q->div($but->singlesubmit7("$edit","$save_key","$ib{$save_key}","margin:10px 5px;"), $q->span({-style=>'color:#FF5F1F;'},"•"),"Orange markierte Angaben bitte prüfen und ggf. korrigieren."),"\n";
|
||||||
my $debug = "";
|
my $debug = "";
|
||||||
$debug = "(ct_table: $node_meta->{ct_table} | main_id: $node_meta->{main_id} | c_id: $ctrel->{c_id} | tpl_id: $tpl->{tpl_id} | rel_id: $ctrel->{rel_id})";
|
$debug = "(ct_table: $node_meta->{ct_table} | main_id: $node_meta->{main_id} | c_id: $ctrel->{c_id} | tpl_id: $tpl->{tpl_id} | rel_id: $ctrel->{rel_id})";
|
||||||
print $q->div({-style=>'z-index:10;font-size:13px;'},"$debug"),"\n" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id});
|
print $q->div({-style=>'z-index:10;font-size:13px;'},"$debug"),"\n" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id});
|
||||||
|
|
|
@ -221,7 +221,7 @@ sub tpl(){
|
||||||
#7=get_event alarm
|
#7=get_event alarm
|
||||||
#8=get_position after validate
|
#8=get_position after validate
|
||||||
if(!$R::theft_details){
|
if(!$R::theft_details){
|
||||||
$search->{int10} = "IN::(7,8)";
|
$search->{int05} = "IN::(7,8)";
|
||||||
$search->{int03} = ">::$dbt->{copri_conf}->{theftalarm}->{move_count}";#move count
|
$search->{int03} = ">::$dbt->{copri_conf}->{theftalarm}->{move_count}";#move count
|
||||||
$search->{int07} = ">::$dbt->{copri_conf}->{theftalarm}->{speed}";#speed
|
$search->{int07} = ">::$dbt->{copri_conf}->{theftalarm}->{speed}";#speed
|
||||||
$search->{int08} = ">::$dbt->{copri_conf}->{theftalarm}->{meter}";#meter
|
$search->{int08} = ">::$dbt->{copri_conf}->{theftalarm}->{meter}";#meter
|
||||||
|
@ -496,7 +496,7 @@ sub tpl(){
|
||||||
my $event_type = "";
|
my $event_type = "";
|
||||||
my $meter = $cttpos->{$pid}->{int08};
|
my $meter = $cttpos->{$pid}->{int08};
|
||||||
$meter =~ s/\./\,/;
|
$meter =~ s/\./\,/;
|
||||||
if($cttpos->{$pid}->{int01} && $cttpos->{$pid}->{int10} == 7){
|
if($cttpos->{$pid}->{int01} && $cttpos->{$pid}->{int05} == 7){
|
||||||
$event_type = "Alarm detected";
|
$event_type = "Alarm detected";
|
||||||
}elsif($cttpos->{$pid}->{int01} && $cttpos->{$pid}->{txt10}){
|
}elsif($cttpos->{$pid}->{int01} && $cttpos->{$pid}->{txt10}){
|
||||||
$event_type = "statusCode $cttpos->{$pid}->{txt10}";
|
$event_type = "statusCode $cttpos->{$pid}->{txt10}";
|
||||||
|
@ -504,10 +504,15 @@ sub tpl(){
|
||||||
my $gps2card = $q->a({-class=>"linknav3",-href=>"/DMS/Karte?man_gps=$cttpos->{$pid}->{txt06}\&owner=$users_dms->{owner}",-title=>"Karte öffnen"}, "$cttpos->{$pid}->{txt06}");
|
my $gps2card = $q->a({-class=>"linknav3",-href=>"/DMS/Karte?man_gps=$cttpos->{$pid}->{txt06}\&owner=$users_dms->{owner}",-title=>"Karte öffnen"}, "$cttpos->{$pid}->{txt06}");
|
||||||
$event_type = "Alarm movement → GPS $gps2card → speed $speed km/h → distance $meter m ";
|
$event_type = "Alarm movement → GPS $gps2card → speed $speed km/h → distance $meter m ";
|
||||||
}
|
}
|
||||||
|
my $bike_state = "";
|
||||||
|
if($cttpos->{$pid}->{int10}){
|
||||||
|
$bike_state = $dbt->{copri_conf}->{bike_state}->{$cttpos->{$pid}->{int10}};
|
||||||
|
}
|
||||||
if($cttpos->{$pid}->{int20}){
|
if($cttpos->{$pid}->{int20}){
|
||||||
$lock_state = $dbt->{copri_conf}->{lock_state}->{$cttpos->{$pid}->{int20}};
|
$lock_state = $dbt->{copri_conf}->{lock_state}->{$cttpos->{$pid}->{int20}};
|
||||||
}
|
}
|
||||||
print $q->div({-style=>"float:left;margin-left:$c_left"}, "$i) $pos_id → $end_time → Bike $bikenr $lock_state → $event_type → $u_name"),"\n";
|
|
||||||
|
print $q->div({-style=>"float:left;margin-left:$c_left"}, "$i) $pos_id → $end_time → Bike $bikenr $bike_state $lock_state → $event_type → $u_name"),"\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -626,8 +626,10 @@ EOF
|
||||||
print $q->div({-style=>"clear:both;height:0.1px;"},""),"\n";
|
print $q->div({-style=>"clear:both;height:0.1px;"},""),"\n";
|
||||||
if($ctt->{txt30}){
|
if($ctt->{txt30}){
|
||||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"}, "$ctt->{txt30}"),"\n";
|
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"}, "$ctt->{txt30}"),"\n";
|
||||||
}elsif( -f "$varenv{pdfinvoice}/$praefix-$ctt->{ct_name}.pdf" ){
|
}elsif( -f "$dbt->{copri_conf}->{basedir}/$varenv{syshost}/pdfinvoice/$praefix-$ctt->{ct_name}.pdf" ){
|
||||||
print $q->start_form(),"\n";
|
print $q->start_form(),"\n";
|
||||||
|
print $q->hidden(-name=>'c_id4trans', -override=>'1', -value=>"$ctt->{content_id}"),"\n";
|
||||||
|
print $q->hidden(-name=>'tpl_id4trans', -override=>'1', -value=>"$ctt->{template_id}"),"\n";
|
||||||
print $q->hidden(-name=>'offset', -override=>'1', -value=>"$R::offset"),"\n" if($R::offset);
|
print $q->hidden(-name=>'offset', -override=>'1', -value=>"$R::offset"),"\n" if($R::offset);
|
||||||
print $q->hidden(-name=>'limit', -override=>'1', -value=>"$R::limit"),"\n" if($R::limit);
|
print $q->hidden(-name=>'limit', -override=>'1', -value=>"$R::limit"),"\n" if($R::limit);
|
||||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"}, "eMail wurde nicht versandt! $ctt->{txt00} eMail ", $but->singlesubmit1("ct_trans","send_invoice_again","send_invoice_again")),"\n" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id});
|
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"}, "eMail wurde nicht versandt! $ctt->{txt00} eMail ", $but->singlesubmit1("ct_trans","send_invoice_again","send_invoice_again")),"\n" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id});
|
||||||
|
|
|
@ -285,10 +285,10 @@ sub get_events {
|
||||||
print FILE "statusCode: $resp->{attributes}->{statusCode}\n";
|
print FILE "statusCode: $resp->{attributes}->{statusCode}\n";
|
||||||
print FILE "serverTime: $resp->{serverTime}\n\n";
|
print FILE "serverTime: $resp->{serverTime}\n\n";
|
||||||
|
|
||||||
my $int10 = 0;
|
my $int05 = 0;
|
||||||
my $txt10 = $resp->{attributes}->{statusCode};
|
my $txt10 = $resp->{attributes}->{statusCode};
|
||||||
if($resp->{attributes}->{statusCode} eq "alarm"){
|
if($resp->{attributes}->{statusCode} eq "alarm"){
|
||||||
$int10 = 7;
|
$int05 = 7;
|
||||||
}
|
}
|
||||||
#insert theft alarm if no theft alarm with theft id
|
#insert theft alarm if no theft alarm with theft id
|
||||||
if(!$theft_record->{c_id}){
|
if(!$theft_record->{c_id}){
|
||||||
|
@ -303,9 +303,10 @@ sub get_events {
|
||||||
txt18 => "$record_cc->{$id}->{txt18}",
|
txt18 => "$record_cc->{$id}->{txt18}",
|
||||||
owner => $owner,
|
owner => $owner,
|
||||||
mtime => "now()",
|
mtime => "now()",
|
||||||
int10 => "$int10",#theft alarm
|
int05 => "$int05",#theft alarm
|
||||||
int01 => "$resp->{id}",#keeps id for event_type
|
int01 => "$resp->{id}",#keeps id for event_type
|
||||||
int13 => "$resp->{deviceId}",
|
int13 => "$resp->{deviceId}",
|
||||||
|
int10 => "$record_cc->{$id}->{int10}",
|
||||||
int20 => "$record_cc->{$id}->{int20}",
|
int20 => "$record_cc->{$id}->{int20}",
|
||||||
start_time => "$serverTime",
|
start_time => "$serverTime",
|
||||||
end_time => "$serverTime",
|
end_time => "$serverTime",
|
||||||
|
@ -363,7 +364,7 @@ sub get_positions {
|
||||||
$pref_th = {
|
$pref_th = {
|
||||||
table => "contenttheftpos",
|
table => "contenttheftpos",
|
||||||
fetch => "one",
|
fetch => "one",
|
||||||
int10 => 7,
|
int05 => 7,
|
||||||
int13 => $record_cc->{$id}->{int13},
|
int13 => $record_cc->{$id}->{int13},
|
||||||
end_time => ">=::(now() - interval '$interval min')",
|
end_time => ">=::(now() - interval '$interval min')",
|
||||||
};
|
};
|
||||||
|
@ -412,8 +413,9 @@ sub get_positions {
|
||||||
int07 => "$resp->{speed}",
|
int07 => "$resp->{speed}",
|
||||||
int08 => "$resp->{attributes}->{distance}",
|
int08 => "$resp->{attributes}->{distance}",
|
||||||
int09 => "$resp->{attributes}->{totalDistance}",
|
int09 => "$resp->{attributes}->{totalDistance}",
|
||||||
int10 => "8",#gps position marker
|
int05 => "8",#gps position marker
|
||||||
int13 => "$resp->{deviceId}",
|
int13 => "$resp->{deviceId}",
|
||||||
|
int10 => "$record_cc->{$id}->{int10}",
|
||||||
int20 => "$record_cc->{$id}->{int20}",
|
int20 => "$record_cc->{$id}->{int20}",
|
||||||
start_time => "$serverTime",
|
start_time => "$serverTime",
|
||||||
end_time => "$serverTime",
|
end_time => "$serverTime",
|
||||||
|
@ -431,7 +433,8 @@ sub get_positions {
|
||||||
if($theftmove_count < 10){
|
if($theftmove_count < 10){
|
||||||
system("$dbt->{copri_conf}->{basedir}/$op_name->{syshost}/src/scripts/mailTransportcms.pl '$op_name->{syshost}' 'send_alarm2hotline' '1' '$c_id' ''");
|
system("$dbt->{copri_conf}->{basedir}/$op_name->{syshost}/src/scripts/mailTransportcms.pl '$op_name->{syshost}' 'send_alarm2hotline' '1' '$c_id' ''");
|
||||||
print FILE "$dbt->{copri_conf}->{basedir}/$op_name->{syshost}/src/scripts/mailTransportcms.pl '$op_name->{syshost}' 'send_alarm2hotline' '1' '$c_id' ''\n\n";
|
print FILE "$dbt->{copri_conf}->{basedir}/$op_name->{syshost}/src/scripts/mailTransportcms.pl '$op_name->{syshost}' 'send_alarm2hotline' '1' '$c_id' ''\n\n";
|
||||||
if($op_name->{sms_alert}){
|
#only if not requested or occupied
|
||||||
|
if($op_name->{sms_alert} && $record_cc->{$id}->{int10} !~ /2|3/){
|
||||||
system("$dbt->{copri_conf}->{basedir}/$op_name->{syshost}/src/scripts/sms_message.pl '$op_name->{syshost}' 'send_alarm2hotline' '' '$c_id'");
|
system("$dbt->{copri_conf}->{basedir}/$op_name->{syshost}/src/scripts/sms_message.pl '$op_name->{syshost}' 'send_alarm2hotline' '' '$c_id'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,9 +151,7 @@ sub get_tripsum {
|
||||||
my $end_time = $ctpos->{end_time};
|
my $end_time = $ctpos->{end_time};
|
||||||
$end_time =~ s/\s/T/;
|
$end_time =~ s/\s/T/;
|
||||||
#add 5 minutes, 300sec for latency
|
#add 5 minutes, 300sec for latency
|
||||||
#my $utc_end_time = utctime($end_time,"+300");
|
my $utc_end_time = utctime($end_time,"+300");
|
||||||
#add 5 minutes + 2 hours end_time Ilockit workaround 2023-04-28
|
|
||||||
my $utc_end_time = utctime($end_time,"+7500");
|
|
||||||
$utc_end_time .= "Z";
|
$utc_end_time .= "Z";
|
||||||
|
|
||||||
my $rest = "deviceId=$ctpos->{int13}\&from=$utc_start_time\&to=$utc_end_time";
|
my $rest = "deviceId=$ctpos->{int13}\&from=$utc_start_time\&to=$utc_end_time";
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
../../../../../sharee.bike/copri-bike/main/src/scripts/mailTransport.pl
|
|
|
@ -3,13 +3,10 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
||||||
#
|
#
|
||||||
#2023-01-02
|
|
||||||
#adapted from mailTransport.pl without bulkmail
|
|
||||||
#NEW
|
|
||||||
#managed text by operator cms
|
#managed text by operator cms
|
||||||
#
|
#
|
||||||
#Example
|
#Example
|
||||||
#./src/scripts/mailTransportcms.pl 'shareedms-operator' 'send_alarm2hotline' '[contentuser.c_id]' '[contenttheftpos.c_id]'
|
#./src/scripts/mailTransportcms.pl 'shareedms-operator' 'send_alarm2hotline' '[user.c_id]' '[contenttxxxx.c_id]'
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -36,23 +33,23 @@ my %varenv = $cf->envonline();
|
||||||
|
|
||||||
my $dbt = new DBtank;
|
my $dbt = new DBtank;
|
||||||
my $mailtrans = new MailTransport;
|
my $mailtrans = new MailTransport;
|
||||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
my $now_dt = strftime "%Y.%m.%d %H:%M:%S", localtime;
|
||||||
|
|
||||||
#one contentadr.c_id OR email on command
|
#one contentadr.c_id OR email on command
|
||||||
my $todo = $ARGV[1] || "";
|
my $todo = $ARGV[1] || "";
|
||||||
my $adr_id = $ARGV[2] || "";#takes ctt.c_id or ctadr.email
|
my $adr_id = $ARGV[2] || "";
|
||||||
my $ct_id = $ARGV[3] || "";
|
my $ct_id = $ARGV[3] || "";
|
||||||
my $attachment = $ARGV[4] || "";
|
my $temppw = $ARGV[4] || "";
|
||||||
|
|
||||||
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, attachment:$attachment \n";
|
print EMA "\n$now_dt, start mailTransportcms.pl syshost: $syshost, todo:$todo, adr_id:$adr_id, ct_id:$ct_id, temppw:$temppw\n";
|
||||||
|
|
||||||
|
|
||||||
#mailxcfg is shareeconf/mailx.cfg <block> selection!
|
#mailxcfg is shareeconf/mailx.cfg <block> selection!
|
||||||
#hash data to send
|
#hash data to send
|
||||||
my $sendref = {
|
my $sendref = {
|
||||||
mailxcfg => "mailx_default",
|
mailxcfg => "mailx_default",
|
||||||
#mailxcfg => "mailx_admin",
|
#mailxcfg => "mailx_admin",#just for tests
|
||||||
syshost => "$syshost",
|
syshost => "$syshost",
|
||||||
mail_to => "",
|
mail_to => "",
|
||||||
c_id => 0,
|
c_id => 0,
|
||||||
|
@ -62,27 +59,44 @@ my $sendref = {
|
||||||
attachment => "",
|
attachment => "",
|
||||||
};
|
};
|
||||||
|
|
||||||
#my $project = $dbt->{operator}->{$varenv{dbname}}->{project} || die "project not defined";
|
|
||||||
my $oprefix = $dbt->{operator}->{$varenv{dbname}}->{oprefix} || "";
|
my $oprefix = $dbt->{operator}->{$varenv{dbname}}->{oprefix} || "";
|
||||||
my $sendmail = {};
|
my $sendmail = {};
|
||||||
|
|
||||||
#send_emailack
|
#user-account must be exist to send user message
|
||||||
if($todo eq "send_emailack" && looks_like_number($adr_id)){
|
my $ctadr = { c_id => 0 };
|
||||||
$sendmail = send_emailack($todo,$sendref,$adr_id);
|
if(looks_like_number($adr_id)){
|
||||||
}
|
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
||||||
|
my $pref_adr = {
|
||||||
|
table => "contentadr",
|
||||||
|
fetch => "one",
|
||||||
|
c_id => "$adr_id",
|
||||||
|
};
|
||||||
|
$ctadr = $dbt->fetch_tablerecord($dbh_primary,$pref_adr);
|
||||||
|
|
||||||
#send_password
|
#send_emailack
|
||||||
if($todo eq "send_password" && looks_like_number($adr_id)){
|
if($todo eq "send_invoice" && looks_like_number($ct_id)){
|
||||||
$sendmail = send_password($todo,$sendref,$adr_id);
|
$sendref->{mailxcfg} = "mailx_rechnung";
|
||||||
}
|
$sendmail = send_invoice($todo,$sendref,$ctadr,$ct_id);
|
||||||
|
}
|
||||||
|
|
||||||
#send_cpdate_message, done by cronjob cpdate_check.pl
|
#send_emailack
|
||||||
if(($todo eq "send_cpupdate_message" || $todo eq "send_proactive_cpupdate_message") && looks_like_number($adr_id)){
|
if($todo eq "send_emailack"){
|
||||||
$sendmail = send_cpupdate_message($todo,$sendref,$adr_id);
|
$sendmail = send_emailack($todo,$sendref,$ctadr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#send_password
|
||||||
|
if($todo eq "send_password"){
|
||||||
|
$sendmail = send_password($todo,$sendref,$ctadr,$temppw);
|
||||||
|
}
|
||||||
|
|
||||||
|
#send_cpdate_message, done by cronjob cpdate_check.pl
|
||||||
|
if(($todo eq "send_cpupdate_message" || $todo eq "send_proactive_cpupdate_message")){
|
||||||
|
$sendmail = send_cpupdate_message($todo,$sendref,$ctadr);
|
||||||
|
}
|
||||||
|
}#end user-account message
|
||||||
|
|
||||||
#send_alarm2hotline, done by Ilockit_cloud.pl
|
#send_alarm2hotline, done by Ilockit_cloud.pl
|
||||||
if($todo eq "send_alarm2hotline" && looks_like_number($adr_id) && looks_like_number($ct_id)){
|
if($todo eq "send_alarm2hotline" && looks_like_number($ct_id)){
|
||||||
$sendmail = send_alarm2hotline($sendref,$ct_id);
|
$sendmail = send_alarm2hotline($sendref,$ct_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,132 +106,143 @@ if($sendmail->{c_id}){
|
||||||
print EMA "Error, can not sendmailjob without c_id\n";
|
print EMA "Error, can not sendmailjob without c_id\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#send_invoice
|
||||||
|
sub send_invoice {
|
||||||
|
my $todo = shift;
|
||||||
|
my $sendref = shift;
|
||||||
|
my $ctadr = shift;
|
||||||
|
my $ct_id = shift;
|
||||||
|
|
||||||
|
my $project = $dbt->{operator}->{$varenv{dbname}}->{project} || "";
|
||||||
|
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
||||||
|
my $pref_ctu = {
|
||||||
|
table => "contentuser",
|
||||||
|
fetch => "one",
|
||||||
|
c_id => "1",#primary hotline
|
||||||
|
};
|
||||||
|
my $uadr = { c_id => 0 };
|
||||||
|
$uadr = $dbt->fetch_tablerecord($dbh_primary,$pref_ctu);
|
||||||
|
|
||||||
|
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $ctadr->{txt10} });
|
||||||
|
my $cms_message_key = "email-invoice";
|
||||||
|
|
||||||
|
my $dbh = $dbt->dbconnect_extern($dbt->{operator}->{$varenv{dbname}}->{database}->{dbname},"iso-8859-1");
|
||||||
|
my $fetchctt = {
|
||||||
|
table => "contenttrans",
|
||||||
|
fetch => "one",
|
||||||
|
c_id => "=::$ct_id",
|
||||||
|
};
|
||||||
|
my $ctt = { c_id => 0 };
|
||||||
|
$ctt = $dbt->fetch_tablerecord($dbh,$fetchctt);
|
||||||
|
|
||||||
|
$sendref = prepare_content($sendref,$ctadr,$uadr,$ctt,$varenv{cms}->{$cms_message_key}->{txt});
|
||||||
|
|
||||||
|
my $updatectt = {
|
||||||
|
table => "contenttrans",
|
||||||
|
c_id => "$ct_id",
|
||||||
|
};
|
||||||
|
$dbt->update_one($dbh,$updatectt,"txt30='$now_dt, $ctt->{txt00} per eMail versandt'");
|
||||||
|
|
||||||
|
return $sendref;
|
||||||
|
}#end send_invoice
|
||||||
|
|
||||||
|
|
||||||
#send_emailack
|
#send_emailack
|
||||||
sub send_emailack {
|
sub send_emailack {
|
||||||
my $todo = shift;
|
my $todo = shift;
|
||||||
my $sendref = shift;
|
my $sendref = shift;
|
||||||
my $adr_id = shift || "";
|
my $ctadr = shift;
|
||||||
|
|
||||||
#TODO
|
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
||||||
return;
|
my $pref_ctu = {
|
||||||
}
|
table => "contentuser",
|
||||||
|
fetch => "one",
|
||||||
|
c_id => "1",#primary hotline
|
||||||
|
};
|
||||||
|
my $uadr = { c_id => 0 };
|
||||||
|
$uadr = $dbt->fetch_tablerecord($dbh_primary,$pref_ctu);
|
||||||
|
|
||||||
|
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $ctadr->{txt10} });
|
||||||
|
my $cms_message_key = "email-emailack";
|
||||||
|
|
||||||
|
#Ack digest
|
||||||
|
if($ctadr->{txt34} =~ /^(.{5})/){
|
||||||
|
$ctadr->{txt34} = $1;
|
||||||
|
}else{
|
||||||
|
$ctadr->{txt34} = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sendref = prepare_content($sendref,$ctadr,$uadr,"",$varenv{cms}->{$cms_message_key}->{txt});
|
||||||
|
|
||||||
|
return $sendref;
|
||||||
|
}#end send_emailack
|
||||||
|
|
||||||
#send_password
|
#send_password
|
||||||
sub send_password {
|
sub send_password {
|
||||||
my $todo = shift;
|
my $todo = shift;
|
||||||
my $sendref = shift;
|
my $sendref = shift;
|
||||||
my $adr_id = shift || "";
|
my $ctadr = shift;
|
||||||
|
my $temppw = shift;
|
||||||
|
|
||||||
#TODO
|
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
||||||
return;
|
my $pref_ctu = {
|
||||||
}
|
table => "contentuser",
|
||||||
|
fetch => "one",
|
||||||
|
c_id => "1",#primary hotline
|
||||||
|
};
|
||||||
|
my $uadr = { c_id => 0 };
|
||||||
|
$uadr = $dbt->fetch_tablerecord($dbh_primary,$pref_ctu);
|
||||||
|
|
||||||
|
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $ctadr->{txt10} });
|
||||||
|
my $cms_message_key = "email-temppassword";
|
||||||
|
|
||||||
|
#temp pw
|
||||||
|
if($temppw){
|
||||||
|
$ctadr->{txt04} = $temppw;
|
||||||
|
}else{
|
||||||
|
$ctadr->{txt04} = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sendref = prepare_content($sendref,$ctadr,$uadr,"",$varenv{cms}->{$cms_message_key}->{txt});
|
||||||
|
|
||||||
|
return $sendref;
|
||||||
|
}#end send_password
|
||||||
|
|
||||||
#send_cpupdate_message
|
#send_cpupdate_message
|
||||||
sub send_cpupdate_message {
|
sub send_cpupdate_message {
|
||||||
my $todo = shift;
|
my $todo = shift;
|
||||||
my $sendref = shift;
|
my $sendref = shift;
|
||||||
my $adr_id = shift || "";
|
my $ctadr = shift || {};
|
||||||
|
|
||||||
my $client_encoding = "iso-8859-1";
|
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},$client_encoding);
|
|
||||||
|
|
||||||
#TeilRad Kontakt
|
|
||||||
my $pref_ctu = {
|
my $pref_ctu = {
|
||||||
table => "contentuser",
|
table => "contentuser",
|
||||||
fetch => "one",
|
fetch => "one",
|
||||||
c_id => "1",#Kontakt-hotline
|
c_id => "1",#primary hotline
|
||||||
};
|
};
|
||||||
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);
|
||||||
|
|
||||||
#CMS text
|
$varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $ctadr->{txt10} });
|
||||||
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");
|
||||||
my $pref_cms = {
|
$sendref = prepare_content($sendref,$ctadr,$uadr,"",$varenv{cms}->{$cms_message_key}->{txt});
|
||||||
table => "contentuser",
|
|
||||||
fetch => "one",
|
|
||||||
ct_name => "$cms_message_key",
|
|
||||||
};
|
|
||||||
my $cms_prim = { c_id => 0, txt01 => '' };
|
|
||||||
$cms_prim = $dbt->fetch_tablerecord($dbh_primary,$pref_cms);
|
|
||||||
|
|
||||||
#Kunde
|
|
||||||
my $pref_adr = {
|
|
||||||
table => "contentadr",
|
|
||||||
fetch => "one",
|
|
||||||
c_id => "$adr_id",
|
|
||||||
};
|
|
||||||
my $cta = { c_id => 0 };
|
|
||||||
$cta = $dbt->fetch_tablerecord($dbh_primary,$pref_adr);
|
|
||||||
|
|
||||||
$sendref = prepare_content($sendref,$cta,$cms_prim,$uadr);
|
|
||||||
|
|
||||||
return $sendref;
|
return $sendref;
|
||||||
}#end send_cpupdate_message
|
}#end send_cpupdate_message
|
||||||
|
|
||||||
#prepare email by cms markup
|
|
||||||
sub prepare_content {
|
|
||||||
my $sendref = shift;
|
|
||||||
my $cta = shift;
|
|
||||||
my $cms_prim = shift;
|
|
||||||
my $uadr = shift;
|
|
||||||
|
|
||||||
my $globalconf_file = "/var/www/copri4/shareeconf/global.cfg";
|
|
||||||
my $conf = Config::General->new($globalconf_file);
|
|
||||||
my %globalconf = $conf->getall;
|
|
||||||
|
|
||||||
my $app_name = "App";
|
|
||||||
while (my ($key, $merchant) = each %{ $globalconf{merchant_ids} }) {
|
|
||||||
$app_name =~ s/$app_name/$merchant->{app_name}/ if($merchant->{app_name} && $cta->{int15} && $cta->{int15} == $merchant->{id});
|
|
||||||
}
|
|
||||||
my $subject = "TeilRad Mietradsystem";#default
|
|
||||||
$subject = $1 if($cms_prim->{txt01} =~ /--subject--(.*)--subject--/);
|
|
||||||
$cms_prim->{txt01} =~ s/--subject--$subject--subject--//;
|
|
||||||
$cms_prim->{txt01} =~ s/\n//;
|
|
||||||
$cms_prim->{txt01} =~ s/\n//;
|
|
||||||
|
|
||||||
my $signature = <<EOF
|
|
||||||
--
|
|
||||||
$uadr->{txt01}
|
|
||||||
$uadr->{txt03}
|
|
||||||
$uadr->{txt06}
|
|
||||||
$uadr->{txt07}
|
|
||||||
$uadr->{txt08}
|
|
||||||
|
|
||||||
$uadr->{txt84}
|
|
||||||
|
|
||||||
EOF
|
|
||||||
;
|
|
||||||
|
|
||||||
$sendref->{mail_to} = $cta->{txt08};
|
|
||||||
$sendref->{c_id} = $cta->{c_id};
|
|
||||||
$sendref->{subject} = $subject;
|
|
||||||
$sendref->{subject} =~ s/::app_name::/$app_name/;
|
|
||||||
$sendref->{subject} =~ s/Mein // if($sendref->{subject} =~ /^Mein/);
|
|
||||||
|
|
||||||
$sendref->{message} = $cms_prim->{txt01};
|
|
||||||
$sendref->{message} =~ s/::user_name::/$cta->{txt01}/;
|
|
||||||
$sendref->{message} =~ s/::app_name::/$app_name/g;
|
|
||||||
$sendref->{message} =~ s/::signature::/$signature/;
|
|
||||||
$sendref->{message} =~ s/\n/\<br \/\>/g;
|
|
||||||
|
|
||||||
return $sendref;
|
|
||||||
}#end prepare_content
|
|
||||||
|
|
||||||
|
|
||||||
#send_alarm2hotline
|
#send_alarm2hotline
|
||||||
sub send_alarm2hotline {
|
sub send_alarm2hotline {
|
||||||
my $sendref = shift;
|
my $sendref = shift;
|
||||||
my $ct_id = shift || "";
|
my $ct_id = shift || "";
|
||||||
|
|
||||||
my $client_encoding = "iso-8859-1";
|
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},$client_encoding);
|
|
||||||
|
|
||||||
my $pref_ctu = {
|
my $pref_ctu = {
|
||||||
table => "contentuser",
|
table => "contentuser",
|
||||||
fetch => "one",
|
fetch => "one",
|
||||||
c_id => "1",#Kontakt-hotline
|
c_id => "1",#primary hotline
|
||||||
};
|
};
|
||||||
my $uadr = { c_id => 0 };
|
my $uadr = { c_id => 0 };
|
||||||
$uadr = $dbt->fetch_tablerecord($dbh,$pref_ctu);
|
$uadr = $dbt->fetch_tablerecord($dbh,$pref_ctu);
|
||||||
|
@ -263,11 +288,71 @@ EOF
|
||||||
|
|
||||||
$sendref->{message} =~ s/\n/\<br \/\>/g;
|
$sendref->{message} =~ s/\n/\<br \/\>/g;
|
||||||
return $sendref;
|
return $sendref;
|
||||||
}
|
}#end send_alarm2hotline
|
||||||
|
|
||||||
|
#prepare email by cms markup
|
||||||
|
sub prepare_content {
|
||||||
|
my $sendref = shift;
|
||||||
|
my $ctadr = shift;
|
||||||
|
my $uadr = shift;
|
||||||
|
my $ctt = shift || {};
|
||||||
|
my $cms_prim = shift;
|
||||||
|
|
||||||
|
my $globalconf_file = "/var/www/copri4/shareeconf/global.cfg";
|
||||||
|
my $conf = Config::General->new($globalconf_file);
|
||||||
|
my %globalconf = $conf->getall;
|
||||||
|
|
||||||
|
my $app_name = "Mietrad App";
|
||||||
|
#while (my ($key, $merchant) = each %{ $globalconf{merchant_ids} }) {
|
||||||
|
# $app_name =~ s/$app_name/$merchant->{app_name}/ if($merchant->{app_name} && $ctadr->{int15} && $ctadr->{int15} == $merchant->{id});
|
||||||
|
#}
|
||||||
|
$app_name = $dbt->{operator}->{$varenv{dbname}}->{app_name};
|
||||||
|
my $invoice_name = "$ctt->{txt00}-$varenv{dbname}-$ctt->{ct_name}.pdf";
|
||||||
|
$sendref->{attachment} = "$invoice_name";
|
||||||
|
|
||||||
|
my $subject = "TeilRad Mietradsystem";#default
|
||||||
|
$subject = $1 if($cms_prim =~ /--subject--(.*)--subject--/);
|
||||||
|
$cms_prim =~ s/--subject--$subject--subject--//;
|
||||||
|
$cms_prim =~ s/\n//;
|
||||||
|
$cms_prim =~ s/\n//;
|
||||||
|
|
||||||
|
my $signature = <<EOF
|
||||||
|
--
|
||||||
|
$uadr->{txt01}
|
||||||
|
$uadr->{txt03}
|
||||||
|
$uadr->{txt06}
|
||||||
|
$uadr->{txt07}
|
||||||
|
$uadr->{txt08}
|
||||||
|
|
||||||
|
$uadr->{txt84}
|
||||||
|
|
||||||
|
EOF
|
||||||
|
;
|
||||||
|
|
||||||
|
$sendref->{mail_to} = $ctadr->{txt08};
|
||||||
|
$sendref->{c_id} = $ctadr->{c_id};
|
||||||
|
$sendref->{subject} = $subject;
|
||||||
|
$sendref->{subject} =~ s/::app_name::/$app_name/;
|
||||||
|
$sendref->{subject} =~ s/Mein // if($sendref->{subject} =~ /^Mein/);
|
||||||
|
|
||||||
|
$sendref->{message} = $cms_prim;
|
||||||
|
$sendref->{message} =~ s/::user_name::/$ctadr->{txt01}/;
|
||||||
|
$sendref->{message} =~ s/::app_name::/$app_name/g;
|
||||||
|
$sendref->{message} =~ s/::invoice_name::/$invoice_name/;
|
||||||
|
$sendref->{message} =~ s/::txid::/$ctt->{txt16}/;
|
||||||
|
$sendref->{message} =~ s/::email_temppassword::/\<b\>$ctadr->{txt04}\<\/b\>/g;
|
||||||
|
$sendref->{message} =~ s/::email_ack_digest::/\<b\>$ctadr->{txt34}\<\/b\>/g;
|
||||||
|
$sendref->{message} =~ s/::signature::/$signature/;
|
||||||
|
$sendref->{message} =~ s/\n/\<br \/\>/g;
|
||||||
|
|
||||||
|
return $sendref;
|
||||||
|
}#end prepare_content
|
||||||
|
|
||||||
|
|
||||||
#sending mail job
|
#sending mail job
|
||||||
sub sendmailjob {
|
sub sendmailjob {
|
||||||
my $sendref = shift || "";
|
my $sendref = shift || "";
|
||||||
|
my $dbh = "";
|
||||||
|
|
||||||
#at first connect mailxchanger by mailx.cfg config
|
#at first connect mailxchanger by mailx.cfg config
|
||||||
my ($smtp,$mailxconf) = $mailtrans->mail_connect($sendref);
|
my ($smtp,$mailxconf) = $mailtrans->mail_connect($sendref);
|
||||||
|
@ -278,8 +363,9 @@ sub sendmailjob {
|
||||||
$ret = $mailtrans->mail_transport($smtp,$mailxconf,$sendref);
|
$ret = $mailtrans->mail_transport($smtp,$mailxconf,$sendref);
|
||||||
|
|
||||||
print EMA "done mailing with state to $sendref->{mail_to}: $ret\n";
|
print EMA "done mailing with state to $sendref->{mail_to}: $ret\n";
|
||||||
|
print EMA Dumper($sendref);
|
||||||
}else{
|
}else{
|
||||||
print EMA "Error, no or false email address $sendref->{mail_to}, exit\n";
|
print EMA "Error, no or false email:\n$sendref->{mail_to}\n$sendref->{subject}\n$sendref->{message}, exit\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,16 @@ if($todo eq "send_alarm2hotline" && $pos_id){
|
||||||
|
|
||||||
my $ct = { c_id => 0 };
|
my $ct = { c_id => 0 };
|
||||||
$ct = $dbt->fetch_tablerecord($dbh_operator,$pref_ct);
|
$ct = $dbt->fetch_tablerecord($dbh_operator,$pref_ct);
|
||||||
$smstrans->sms_message($todo,"",$phone,"$oprefix$ct->{barcode}");
|
|
||||||
|
if($dbt->{copri_conf}->{sms_to_alarm}){
|
||||||
|
my @alarm_phone = ("$dbt->{copri_conf}->{sms_to_alarm}");
|
||||||
|
@alarm_phone = split(/\|/,$dbt->{copri_conf}->{sms_to_alarm}) if($dbt->{copri_conf}->{sms_to_alarm} =~ /\|/);
|
||||||
|
foreach(@alarm_phone){
|
||||||
|
$smstrans->sms_message($todo,"",$_,"$oprefix$ct->{barcode}");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$smstrans->sms_message($todo,"",$phone,"$oprefix$ct->{barcode}");
|
||||||
|
}
|
||||||
|
|
||||||
}#end
|
}#end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue