CSUN#37615 Bijlages [mee kunnen sturen met notificatie]
svn path=/Website/trunk/; revision=31033
This commit is contained in:
@@ -83,6 +83,7 @@ function sendNotification(ref_key, pcode)
|
||||
+ " WHERE ( BITAND (fac_notificatie_status, " + (puo_const.STATUS_EMAIL | puo_const.STATUS_SMS) + ") > 0"
|
||||
+ " OR fac_notificatie_systeemadres IS NOT NULL)"
|
||||
+ strFilter
|
||||
+ " and fac_notificatie_lang = 'NL'"
|
||||
+ " ORDER BY fac_notificatie_datum"
|
||||
+ " , fac_notificatie_key";
|
||||
Log2File(3, sql);
|
||||
@@ -141,6 +142,10 @@ function notificationMail(rec, p_notificationXSL, params)
|
||||
{
|
||||
var receiver_email = rec("fac_notificatie_receiver_email").value || "";
|
||||
var sender_email = rec("fac_notificatie_sender_email").value || "";
|
||||
var attach_refkey = rec("fac_notificatie_refkey").value;
|
||||
var attach_kenmerk = [rec("fac_srtnotificatie_kenmerk_key").value];
|
||||
var srtcode = rec("fac_srtnotificatie_code").value || "";
|
||||
var xmlnode = rec("fac_srtnotificatie_xmlnode").value || "";
|
||||
|
||||
if (rec("fac_notificatie_status").value & params.STATUS_EMAIL) // bitwise AND
|
||||
{
|
||||
@@ -153,7 +158,7 @@ function notificationMail(rec, p_notificationXSL, params)
|
||||
, rec("fac_notificatie_oms").Value
|
||||
, ""
|
||||
, { attachFileName: ""
|
||||
, attachFolder: rec("fac_srtnotificatie_kenmerk_key").Value
|
||||
, attachFolder: ""
|
||||
, attachments: []
|
||||
}
|
||||
);
|
||||
@@ -172,6 +177,16 @@ function notificationMail(rec, p_notificationXSL, params)
|
||||
|
||||
if (xml_content)
|
||||
{
|
||||
var AttachRootPath = S("flexfilespath");
|
||||
var attach_folder = "";
|
||||
if ((attach_kenmerk.length > 0) && (xmlnode == "melding" || xmlnode == "opdracht"))
|
||||
{
|
||||
attach_folder = AttachRootPath
|
||||
+ "\\MLD\\"
|
||||
+ subfolderKey(srtcode.slice(0,1), attach_refkey);
|
||||
}
|
||||
Log2File(2, "*>attach_folder: "+attach_folder);
|
||||
|
||||
var SubjectText = "";
|
||||
var SubjectTextXSL = "";
|
||||
//
|
||||
@@ -211,7 +226,8 @@ function notificationMail(rec, p_notificationXSL, params)
|
||||
, ""
|
||||
, strResult
|
||||
, { attachFileName: ""
|
||||
, attachFolder: rec("fac_srtnotificatie_kenmerk_key").Value
|
||||
, attachFolder: attach_folder
|
||||
, attachSubFolder: attach_kenmerk
|
||||
, attachments: attach_obj
|
||||
}
|
||||
);
|
||||
@@ -245,7 +261,8 @@ function notificationMail(rec, p_notificationXSL, params)
|
||||
, "Zie HTML attachment"
|
||||
, strResult
|
||||
, { attachFileName: "Facilitor.html"
|
||||
, attachFolder: rec("fac_srtnotificatie_kenmerk_key").Value
|
||||
, attachFolder: attach_folder
|
||||
, attachSubFolder: attach_kenmerk
|
||||
, attachments: []
|
||||
}
|
||||
);
|
||||
|
||||
@@ -254,6 +254,7 @@ function sendMail( p_mailfrom
|
||||
|
||||
if (params.attachments) // Geselecteerde bestanden uit flexfiles meesturen.
|
||||
{
|
||||
//Log2File(2, "geselecteerde attachments");
|
||||
for (i=0; i<params.attachments.length; i++)
|
||||
{
|
||||
var att = params.attachments[i];
|
||||
@@ -276,6 +277,7 @@ function sendMail( p_mailfrom
|
||||
}
|
||||
else
|
||||
{ // Het is maar 1 attachment
|
||||
//Log2File(2, " 1 attachment");
|
||||
var att_f = S("flexfilespath") + "/" + params.attachments[i];
|
||||
if (objFso.FileExists(att_f))
|
||||
{
|
||||
@@ -292,54 +294,59 @@ function sendMail( p_mailfrom
|
||||
//
|
||||
if (params.attachFolder)
|
||||
{
|
||||
var all_sub = (params.attachSubFolder.length > 0 ? false : true);
|
||||
//
|
||||
if (objFso.FolderExists(params.attachFolder))
|
||||
{
|
||||
var objFolders = objFso.GetFolder(params.attachFolder);
|
||||
var subFolders = new Enumerator(objFolders.SubFolders);
|
||||
for (; !subFolders.atEnd(); subFolders.moveNext())
|
||||
{
|
||||
var objFiles = objFso.GetFolder(subFolders.item());
|
||||
var allFiles = new Enumerator(objFiles.files);
|
||||
for (; !allFiles.atEnd(); allFiles.moveNext())
|
||||
if (all_sub || (subFolders.item().name == params.attachSubFolder[0])) // allemaal of die ene submap.
|
||||
{
|
||||
var attFile = allFiles.item();
|
||||
Log2File(1, "Adding attachment: " + attFile.Path + " (" + attFile.Size + " bytes)");
|
||||
|
||||
if (params.attachPassword == "")
|
||||
{ // doe maar gewoon
|
||||
var objAttachment = objMail.AddAttachment(attFile.Path, attFile.Name);
|
||||
objAttachment.ContentTransferEncoding = "base64";
|
||||
}
|
||||
else
|
||||
var objFiles = objFso.GetFolder(subFolders.item());
|
||||
var allFiles = new Enumerator(objFiles.files);
|
||||
for (; !allFiles.atEnd(); allFiles.moveNext())
|
||||
{
|
||||
var ZipObjIn = new ActiveXObject("SLNKDWF.Zip");
|
||||
var attStrm = new ActiveXObject("ADODB.Stream");
|
||||
attStrm.Type = 1; // adTypeBinary
|
||||
attStrm.Open();
|
||||
var attFile = allFiles.item();
|
||||
Log2File(1, "Adding attachment: " + attFile.Path + " (" + attFile.Size + " bytes)");
|
||||
|
||||
var orgName = attFile.Name; // .encrypted er afhalen
|
||||
var lastIndex = orgName.lastIndexOf(".encrypted");
|
||||
var isEncrypted = (lastIndex != -1 ? (orgName.substring(lastIndex).toLowerCase() == ".encrypted") : false);
|
||||
if (isEncrypted)
|
||||
{ // decrypt
|
||||
orgName = orgName.substring(0, lastIndex);
|
||||
ZipObjIn.Open(attFile.Path);
|
||||
ZipObjIn.DecryptToStream(attStrm, orgName);
|
||||
if (params.attachPassword == "")
|
||||
{ // doe maar gewoon
|
||||
var objAttachment = objMail.AddAttachment(attFile.Path, attFile.Name);
|
||||
objAttachment.ContentTransferEncoding = "base64";
|
||||
}
|
||||
else
|
||||
{ // Gewoon lezen
|
||||
attStrm.LoadFromFile(attFile.Path);
|
||||
{
|
||||
var ZipObjIn = new ActiveXObject("SLNKDWF.Zip");
|
||||
var attStrm = new ActiveXObject("ADODB.Stream");
|
||||
attStrm.Type = 1; // adTypeBinary
|
||||
attStrm.Open();
|
||||
|
||||
var orgName = attFile.Name; // .encrypted er afhalen
|
||||
var lastIndex = orgName.lastIndexOf(".encrypted");
|
||||
var isEncrypted = (lastIndex != -1 ? (orgName.substring(lastIndex).toLowerCase() == ".encrypted") : false);
|
||||
if (isEncrypted)
|
||||
{ // decrypt
|
||||
orgName = orgName.substring(0, lastIndex);
|
||||
ZipObjIn.Open(attFile.Path);
|
||||
ZipObjIn.DecryptToStream(attStrm, orgName);
|
||||
}
|
||||
else
|
||||
{ // Gewoon lezen
|
||||
attStrm.LoadFromFile(attFile.Path);
|
||||
}
|
||||
attStrm.Position = 0; // We gaan nu over in uitvoermode
|
||||
var ZipObjOut = new ActiveXObject("SLNKDWF.Zip");
|
||||
var tempfile = subFolders.item() + "\\" + orgName + ".zip";
|
||||
ZipObjOut.New(tempfile); // Helaas niet *naar* stream
|
||||
ZipObjOut.ZipFromStream(orgName, attStrm, params.attachPassword);
|
||||
attStrm.Close();
|
||||
ZipObjOut.Close();
|
||||
var objAttachment = objMail.AddAttachment(tempfile, orgName + ".zip");
|
||||
objAttachment.ContentTransferEncoding = "base64";
|
||||
objFso.DeleteFile(tempfile); // objMail houdt hem nog even gelocked maar straks is hij wel weg
|
||||
}
|
||||
attStrm.Position = 0; // We gaan nu over in uitvoermode
|
||||
var ZipObjOut = new ActiveXObject("SLNKDWF.Zip");
|
||||
var tempfile = subFolders.item() + "\\" + orgName + ".zip";
|
||||
ZipObjOut.New(tempfile); // Helaas niet *naar* stream
|
||||
ZipObjOut.ZipFromStream(orgName, attStrm, params.attachPassword);
|
||||
attStrm.Close();
|
||||
ZipObjOut.Close();
|
||||
var objAttachment = objMail.AddAttachment(tempfile, orgName + ".zip");
|
||||
objAttachment.ContentTransferEncoding = "base64";
|
||||
objFso.DeleteFile(tempfile); // objMail houdt hem nog even gelocked maar straks is hij wel weg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user