mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-07-17 02:07:26 +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
|
@ -285,10 +285,10 @@ sub get_events {
|
|||
print FILE "statusCode: $resp->{attributes}->{statusCode}\n";
|
||||
print FILE "serverTime: $resp->{serverTime}\n\n";
|
||||
|
||||
my $int10 = 0;
|
||||
my $int05 = 0;
|
||||
my $txt10 = $resp->{attributes}->{statusCode};
|
||||
if($resp->{attributes}->{statusCode} eq "alarm"){
|
||||
$int10 = 7;
|
||||
$int05 = 7;
|
||||
}
|
||||
#insert theft alarm if no theft alarm with theft id
|
||||
if(!$theft_record->{c_id}){
|
||||
|
@ -303,9 +303,10 @@ sub get_events {
|
|||
txt18 => "$record_cc->{$id}->{txt18}",
|
||||
owner => $owner,
|
||||
mtime => "now()",
|
||||
int10 => "$int10",#theft alarm
|
||||
int05 => "$int05",#theft alarm
|
||||
int01 => "$resp->{id}",#keeps id for event_type
|
||||
int13 => "$resp->{deviceId}",
|
||||
int10 => "$record_cc->{$id}->{int10}",
|
||||
int20 => "$record_cc->{$id}->{int20}",
|
||||
start_time => "$serverTime",
|
||||
end_time => "$serverTime",
|
||||
|
@ -363,7 +364,7 @@ sub get_positions {
|
|||
$pref_th = {
|
||||
table => "contenttheftpos",
|
||||
fetch => "one",
|
||||
int10 => 7,
|
||||
int05 => 7,
|
||||
int13 => $record_cc->{$id}->{int13},
|
||||
end_time => ">=::(now() - interval '$interval min')",
|
||||
};
|
||||
|
@ -412,8 +413,9 @@ sub get_positions {
|
|||
int07 => "$resp->{speed}",
|
||||
int08 => "$resp->{attributes}->{distance}",
|
||||
int09 => "$resp->{attributes}->{totalDistance}",
|
||||
int10 => "8",#gps position marker
|
||||
int05 => "8",#gps position marker
|
||||
int13 => "$resp->{deviceId}",
|
||||
int10 => "$record_cc->{$id}->{int10}",
|
||||
int20 => "$record_cc->{$id}->{int20}",
|
||||
start_time => "$serverTime",
|
||||
end_time => "$serverTime",
|
||||
|
@ -431,7 +433,8 @@ sub get_positions {
|
|||
if($theftmove_count < 10){
|
||||
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";
|
||||
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'");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,9 +151,7 @@ sub get_tripsum {
|
|||
my $end_time = $ctpos->{end_time};
|
||||
$end_time =~ s/\s/T/;
|
||||
#add 5 minutes, 300sec for latency
|
||||
#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");
|
||||
my $utc_end_time = utctime($end_time,"+300");
|
||||
$utc_end_time .= "Z";
|
||||
|
||||
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
|
||||
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
||||
#
|
||||
#2023-01-02
|
||||
#adapted from mailTransport.pl without bulkmail
|
||||
#NEW
|
||||
#managed text by operator cms
|
||||
#
|
||||
#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 $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
|
||||
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 $attachment = $ARGV[4] || "";
|
||||
my $temppw = $ARGV[4] || "";
|
||||
|
||||
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!
|
||||
#hash data to send
|
||||
my $sendref = {
|
||||
mailxcfg => "mailx_default",
|
||||
#mailxcfg => "mailx_admin",
|
||||
#mailxcfg => "mailx_admin",#just for tests
|
||||
syshost => "$syshost",
|
||||
mail_to => "",
|
||||
c_id => 0,
|
||||
|
@ -62,27 +59,44 @@ my $sendref = {
|
|||
attachment => "",
|
||||
};
|
||||
|
||||
#my $project = $dbt->{operator}->{$varenv{dbname}}->{project} || die "project not defined";
|
||||
my $oprefix = $dbt->{operator}->{$varenv{dbname}}->{oprefix} || "";
|
||||
my $sendmail = {};
|
||||
|
||||
#send_emailack
|
||||
if($todo eq "send_emailack" && looks_like_number($adr_id)){
|
||||
$sendmail = send_emailack($todo,$sendref,$adr_id);
|
||||
}
|
||||
#user-account must be exist to send user message
|
||||
my $ctadr = { c_id => 0 };
|
||||
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
|
||||
if($todo eq "send_password" && looks_like_number($adr_id)){
|
||||
$sendmail = send_password($todo,$sendref,$adr_id);
|
||||
}
|
||||
#send_emailack
|
||||
if($todo eq "send_invoice" && looks_like_number($ct_id)){
|
||||
$sendref->{mailxcfg} = "mailx_rechnung";
|
||||
$sendmail = send_invoice($todo,$sendref,$ctadr,$ct_id);
|
||||
}
|
||||
|
||||
#send_cpdate_message, done by cronjob cpdate_check.pl
|
||||
if(($todo eq "send_cpupdate_message" || $todo eq "send_proactive_cpupdate_message") && looks_like_number($adr_id)){
|
||||
$sendmail = send_cpupdate_message($todo,$sendref,$adr_id);
|
||||
}
|
||||
#send_emailack
|
||||
if($todo eq "send_emailack"){
|
||||
$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
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -92,132 +106,143 @@ if($sendmail->{c_id}){
|
|||
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
|
||||
sub send_emailack {
|
||||
my $todo = shift;
|
||||
my $sendref = shift;
|
||||
my $adr_id = shift || "";
|
||||
my $ctadr = shift;
|
||||
|
||||
#TODO
|
||||
return;
|
||||
}
|
||||
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-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
|
||||
sub send_password {
|
||||
my $todo = shift;
|
||||
my $sendref = shift;
|
||||
my $adr_id = shift || "";
|
||||
my $ctadr = shift;
|
||||
my $temppw = shift;
|
||||
|
||||
#TODO
|
||||
return;
|
||||
}
|
||||
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-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
|
||||
sub send_cpupdate_message {
|
||||
my $todo = 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},$client_encoding);
|
||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname},"iso-8859-1");
|
||||
|
||||
#TeilRad Kontakt
|
||||
my $pref_ctu = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
c_id => "1",#Kontakt-hotline
|
||||
c_id => "1",#primary hotline
|
||||
};
|
||||
my $uadr = { c_id => 0 };
|
||||
$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";
|
||||
$cms_message_key = "email-proactive-cpupdate-message" if($todo eq "send_proactive_cpupdate_message");
|
||||
my $pref_cms = {
|
||||
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);
|
||||
$sendref = prepare_content($sendref,$ctadr,$uadr,"",$varenv{cms}->{$cms_message_key}->{txt});
|
||||
|
||||
return $sendref;
|
||||
}#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
|
||||
sub send_alarm2hotline {
|
||||
my $sendref = shift;
|
||||
my $ct_id = shift || "";
|
||||
|
||||
my $client_encoding = "iso-8859-1";
|
||||
my $dbh = $dbt->dbconnect_extern($dbt->{operator}->{$varenv{dbname}}->{database}->{dbname},$client_encoding);
|
||||
|
||||
my $dbh = $dbt->dbconnect_extern($dbt->{operator}->{$varenv{dbname}}->{database}->{dbname},"iso-8859-1");
|
||||
my $pref_ctu = {
|
||||
table => "contentuser",
|
||||
fetch => "one",
|
||||
c_id => "1",#Kontakt-hotline
|
||||
c_id => "1",#primary hotline
|
||||
};
|
||||
my $uadr = { c_id => 0 };
|
||||
$uadr = $dbt->fetch_tablerecord($dbh,$pref_ctu);
|
||||
|
@ -263,11 +288,71 @@ EOF
|
|||
|
||||
$sendref->{message} =~ s/\n/\<br \/\>/g;
|
||||
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
|
||||
sub sendmailjob {
|
||||
my $sendref = shift || "";
|
||||
my $dbh = "";
|
||||
|
||||
#at first connect mailxchanger by mailx.cfg config
|
||||
my ($smtp,$mailxconf) = $mailtrans->mail_connect($sendref);
|
||||
|
@ -278,8 +363,9 @@ sub sendmailjob {
|
|||
$ret = $mailtrans->mail_transport($smtp,$mailxconf,$sendref);
|
||||
|
||||
print EMA "done mailing with state to $sendref->{mail_to}: $ret\n";
|
||||
print EMA Dumper($sendref);
|
||||
}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 };
|
||||
$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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue