AAIT#39341 .ics file in de uitnodiging plakken

svn path=/Website/branches/v2017.1/; revision=34300
This commit is contained in:
Jos Groot Lipman
2017-06-15 14:49:07 +00:00
parent 2bb2b76bbf
commit 05ccad883d
3 changed files with 43 additions and 4 deletions

View File

@@ -1121,7 +1121,7 @@ END:VCALENDAR
<xsl:when test="$mode='summary'"></xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$srtnotificatiecode = 'OUTLOOK'">
<xsl:when test="$srtnotificatiecode = 'OUTLOOK' or $mode='ics'">
<xsl:apply-templates select="." mode="outlook"/>
</xsl:when>
<xsl:otherwise>

View File

@@ -225,6 +225,16 @@ function notificationMail(rec, p_notificationXSL, params)
, rec("fac_srtnotificatie_code").value
, "email"
);
var icsResult = ""; // default geen ics
if (strResult.indexOf("<!--ADDICS-->") > -1) // <xsl:comment>ADDICS</xsl:comment>
{
icsResult = XML2HTML( xml_content
, p_notificationXSL
, rec("fac_srtnotificatie_code").value
, "ics"
);
}
SubjectText = rec("fac_notificatie_oms").value;
if (rec("fac_notificatie_status").value & params.STATUS_SUMMARY_XSL)
{
@@ -258,6 +268,7 @@ function notificationMail(rec, p_notificationXSL, params)
, attachFolder: attach_folder
, attachSubFolder: attach_kenmerk_folder
, attachments: attach_obj
, attachics: icsResult
}
);
}

View File

@@ -21,6 +21,7 @@
// * cc: The cc address
// * bcc: The bcc address
// * receiptto: The address where the receipt is sent to
// * attachics: deze tekst moet als ics toegevoegd worden
// *
// ******************************************
function sendMail( p_mailfrom
@@ -233,6 +234,33 @@ function sendMail( p_mailfrom
var eindPos = p_bodyhtml.indexOf(quote, startPos + 2);
}
// Eventueel een ics er aan toevoegen
if (params.attachics)
{
Log2File(2, "Adding calendar ICS");
var oStream = new ActiveXObject("ADODB.Stream");
oStream.Open;
oStream.Type = 2; // tekst
oStream.Charset = 'Windows-1252'; // Anders is de ics 'not supported'
oStream.WriteText(params.attachics);
var oCrypto = new ActiveXObject("SLNKDWF.Crypto"); // Maak random naam
// var sha1 = oCrypto.hex_sha1(params.attachics); werkt niet goed als RESMAI twee keer wordt gestuurd, dan heb je overlap
var sha1 = oCrypto.hex_random(16);
var tempfile = custabspath + "/../../temp/puo_ics_" + sha1 + ".ics";
oStream.SaveToFile(tempfile, 2); // overwrite
var objAttachment = objMail.AddAttachment(tempfile);
objAttachment.ContentTransferEncoding = "base64";
objAttachment.ContentMediaType = 'text/calendar; charset="utf-8"; method=REQUEST';
objAttachment.ContentClass = 'urn:content-classes:calendarmessage';
var Flds = objAttachment.Fields;
Flds("urn:schemas:mailheader:content-disposition") = "";
Flds.Update();
if (S("puo_loglevel") < 4)
objFso.DeleteFile(tempfile);
}
Log2File(2, "Before bodyHTML");
objMail.HtmlBody = p_bodyhtml.replace(/\<br/g, "\x0D\x0A<br"); // FSN#36318 Geen afsluitende '>'
objMail.HTMLBodyPart.Charset = S("puo_mailbodycharset");
@@ -266,7 +294,7 @@ function sendMail( p_mailfrom
if (objFso.FileExists(S("bdradrfiles_path") + "/" + safename))
{
Log2File(2, "Including fixed attachment " + S("bdradrfiles_path") + "/" + safename);
var objAttachment = objMail.AddAttachment(S("bdradrfiles_path") + "/" + safename, safename);
var objAttachment = objMail.AddAttachment(S("bdradrfiles_path") + "/" + safename);
objAttachment.ContentTransferEncoding = "base64";
}
else
@@ -336,7 +364,7 @@ function sendMail( p_mailfrom
if (!params.attachPassword)
{ // doe maar gewoon
var objAttachment = objMail.AddAttachment(attFile.Path, attFile.Name);
var objAttachment = objMail.AddAttachment(attFile.Path);
objAttachment.ContentTransferEncoding = "base64";
}
else
@@ -366,7 +394,7 @@ function sendMail( p_mailfrom
ZipObjOut.ZipFromStream(orgName, attStrm, params.attachPassword);
attStrm.Close();
ZipObjOut.Close();
var objAttachment = objMail.AddAttachment(tempfile, orgName + ".zip");
var objAttachment = objMail.AddAttachment(tempfile);
objAttachment.ContentTransferEncoding = "base64";
objFso.DeleteFile(tempfile); // objMail houdt hem nog even gelocked maar straks is hij wel weg
}