FSN#41819 MLD2BO notificatie efficiënter

svn path=/Website/trunk/; revision=35276
This commit is contained in:
Jos Groot Lipman
2017-09-12 11:37:09 +00:00
parent 3c6322d917
commit d3e317ff07
4 changed files with 42 additions and 15 deletions

View File

@@ -36,6 +36,12 @@ function sendAllOrders()
Log2File(3, sql);
var oRs = Oracle.Execute(sql);
if (!oRs.Eof && S("puo_loglevel") > 1)
{
var oRs2 = Oracle.Execute("SELECT COUNT(*) FROM (" + sql + ")");
__Log("About to send {0} orders".format(oRs2(0).Value)); // Handige waarschuwing bij interactief testen
oRs2.Close()
}
var RecTotal = 0;
var MLDRecSaved = 0;
@@ -270,7 +276,6 @@ function send1Order(Bedrijf_key, prs_loc_key, XMLnode, OpdrKey, ordernr, Sender,
if (AttachPath)
Log2File(1, "Searching attachments under: " + AttachPath);
Log2File(3, "In SendAllOrders sender=" + Sender);
LogString2File(4, "xml_content", xml_content, "xml")
Log2File(4, "xsl=" + bedrijfadres.XSLbedr + "==>" + XSLfile);
Log2File(4, "ordernr=" + ordernr);
Log2File(4, "key=" + OpdrKey);

View File

@@ -91,6 +91,12 @@ function sendNotification(ref_key, pcode)
+ " , fac_notificatie_key";
Log2File(3, sql);
var oRs = Oracle.Execute(sql);
if (!oRs.Eof && S("puo_loglevel") > 1)
{
var oRs2 = Oracle.Execute("SELECT COUNT(*) FROM (" + sql + ")");
__Log("About to send {0} notifications".format(oRs2(0).Value)); // Handige waarschuwing bij interactief testen
oRs2.Close()
}
var notiMAILed = 0;
var notiSMSed = 0;
@@ -546,7 +552,6 @@ function notificationSYS(rec, params)
var System2SystemXSL = S("puo_system2systemxsl");
Log2File(3, "In Notifications sender=" + sender_email);
Log2File(4, "xml_content=" + xml_content);
Log2File(4, "xsl=" + S("puo_system2systemxsl"));
Log2File(4, "xsl2=" + System2SystemXSL);
Log2File(4, "ordernr=" + ordernr);

View File

@@ -208,7 +208,7 @@ function connectFTP( p_connect
function connectMail( p_connect
, p_textstream
, p_xmlData
, p_xmlDoc
, p_bedrijfadres
, p_xslPath
, p_ordernr
@@ -255,7 +255,7 @@ function connectMail( p_connect
{
// Use the mailer translation function in case the html is added to the body
// to be able to add the logo and to include the email parameter
var content = XML2HTML( p_xmlData
var content = XML2HTML( p_xmlDoc
, p_xslPath
, ""
, "email"
@@ -315,7 +315,7 @@ function connectMail( p_connect
// Public functies
function SendOrder( p_connect
, p_xmlData
, p_xmlDoc
, p_bedrijfadres
, p_xslPath
, p_ordernr
@@ -354,11 +354,10 @@ function SendOrder( p_connect
Log2File(1, "Load company style: " + p_xslPath);
var xslDoc = SafeLoadFileXSL(p_xslPath);
xslDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); // verderop nodig
var xmlDoc = SafeLoadTextXML(p_xmlData);
if (!p_bedrijfadres.extension)
{
p_bedrijfadres.extension = GetExtension(xmlDoc, xslDoc) // Old style via XSL
p_bedrijfadres.extension = GetExtension(p_xmlDoc, xslDoc) // Old style via XSL
}
if (p_bedrijfadres.extension)
{
@@ -382,7 +381,7 @@ function SendOrder( p_connect
streamResult.Open();
if (p_bedrijfadres.extension == "xml" || p_bedrijfadres.extension == "cxml")
{
result = XML2HTML( p_xmlData
result = XML2HTML( p_xmlDoc
, p_xslPath
, p_code
, ""
@@ -402,7 +401,7 @@ function SendOrder( p_connect
}
else // Bijvoorbeeld csv
{
xmlDoc.transformNodeToObject(xslDoc, streamResult);
p_xmlDoc.transformNodeToObject(xslDoc, streamResult);
}
LogStream2File(2, "transformed", streamResult, p_bedrijfadres.extension);
streamResult.Position = 0;
@@ -446,7 +445,7 @@ function SendOrder( p_connect
filename = "Opdr_" + filename;
connectResult = connectMail( p_connect
, streamResult
, p_xmlData
, p_xmlDoc
, p_bedrijfadres
, p_xslPath
, p_ordernr

View File

@@ -62,7 +62,7 @@ function SafeLoadFileXSL(xslPath)
}
function XML2HTML( body
function XML2HTML( xmlDoc
, xslPath
, srtnotificatie
, mode
@@ -76,7 +76,6 @@ function XML2HTML( body
var xslDoc = SafeLoadFileXSL(xslPath);
var result = "";
var xmlDoc = SafeLoadTextXML(body);
xslDoc.resolveExternals = true; // anders op de volgende regel al:
// A reference to variable or parameter 'srtnotificatiecode' cannot be resolved
@@ -142,8 +141,9 @@ function XML2HTML( body
}
// Resultaat is een xmlDoc object of null bij errors
// <20><>n niveau van caching, is efficienter als 13 keer dezelfde MLD2BO
var prev_XMLContent = {};
function fetchXMLContent( node
, refkey
, xrefkey
@@ -151,6 +151,15 @@ function fetchXMLContent( node
, userlang
)
{
if (prev_XMLContent.node == node &&
prev_XMLContent.refkey == refkey &&
prev_XMLContent.xrefkey == xrefkey &&
prev_XMLContent.where == where &&
prev_XMLContent.userlang == userlang)
{
Log2File(2, "Re-using cached xmlDoc");
return prev_XMLContent.xmlDoc;
}
var xml_content = "";
try
@@ -187,7 +196,16 @@ function fetchXMLContent( node
{
LogString2File(3, "make_xml", xml_content, "xml");
}
return xml_content;
var xmlDoc = SafeLoadTextXML(xml_content);
prev_XMLContent.node = node;
prev_XMLContent.refkey = refkey;
prev_XMLContent.xrefkey = xrefkey;
prev_XMLContent.where = where;
prev_XMLContent.userlang = userlang;
prev_XMLContent.xmlDoc = xmlDoc;
return xmlDoc;
}