CMS-Text for App infos and units. mailx with bcc

This commit is contained in:
ragu 2023-07-20 07:14:28 +02:00
parent de824a241a
commit 3c52345c5e
10 changed files with 135 additions and 41 deletions

View file

@ -53,7 +53,9 @@ my $sendref = {
mailxcfg => "mailx_default",
#mailxcfg => "mailx_admin",#just for tests
syshost => "$syshost",
mail_from => "",
mail_to => "",
mail_bcc => "",
c_id => 0,
subject => "",
message => "",
@ -77,10 +79,16 @@ if(looks_like_number($adr_id)){
#send_invoice
if($todo eq "send_invoice" && looks_like_number($ct_id)){
$sendref->{mailxcfg} = "mailx_rechnung";
$sendref->{mailxcfg} = "mailx_invoice";
$sendmail = send_invoice($todo,$sendref,$ctadr,$ct_id);
}
#send_warninginvoice
if($todo eq "send_warninginvoice" && looks_like_number($ct_id)){
$sendref->{mailxcfg} = "mailx_invoice_bcc";
$sendmail = send_warninginvoice($todo,$sendref,$ctadr,$ct_id);
}
#send_emailack
if($todo eq "send_emailack"){
$sendmail = send_emailack($todo,$sendref,$ctadr);
@ -175,6 +183,47 @@ sub send_invoice {
return $sendref;
}#end send_invoice
#TODO with CMS-Text selection
#send_warninginvoice
sub send_warninginvoice {
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");
$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 $pref_ctu = {
table => "contentuser",
fetch => "one",
c_id => "100002",
};
my $uadr = { c_id => 0 };
$uadr = $dbt->fetch_tablerecord($dbh,$pref_ctu);
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_warninginvoice
#send_emailack
sub send_emailack {
@ -400,7 +449,7 @@ sub send_invoice_onwork {
table => "contenttrans",
fetch => "all",
keyfield => "c_id",
txt22 => "in Arbeit",
txt22 => "IN::('in Arbeit','eMail gesendet')",
state => "is::null",
};
@ -422,7 +471,7 @@ sub send_invoice_onwork {
$sendref->{message} = <<EOF
Hallo,
folgende ungebuchte Rechnungen sind "in Arbeit":
folgende ungebuchte Rechnungen haben den Status "in Arbeit" oder "eMail gesendet":
$ct_onwork
Nicht aus dem Blick verlieren.