SVRZ#62191 Core-wens: mailen rapportage

svn path=/Website/trunk/; revision=60659
This commit is contained in:
Jos Groot Lipman
2023-06-07 12:49:47 +00:00
parent e89da1460d
commit 7000d52eaa

View File

@@ -222,7 +222,8 @@ function notificationMail(rec, p_notificationXSL, params)
ext = "json";
var jresult = JSON.parse(strResult);
if ("tmpcsv" in jresult)
{
{debugger;
jresult.tmpcsv = custabspath + "/../../temp/" + customerId + "/" + jresult.tmpcsv;
var tmpxlsx = jresult.tmpcsv.replace(/\.csv$/, ".xlsx");
var fso = fso = new ActiveXObject("Scripting.FileSystemObject")
var tmpbat = jresult.tmpcsv + ".bat";
@@ -240,7 +241,19 @@ function notificationMail(rec, p_notificationXSL, params)
fs.Write(csvcmd);
fs.Close();
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run(tmpbat, 0, true);
//WshShell.Run(tmpbat, 0, true);
var WshShellExec = WshShell.Exec(tmpbat);
var errTxt = WshShellExec.StdErr.ReadAll();
var stdTxt = WshShellExec.StdOut.ReadAll();
if (errTxt)
{
Log2File(2, "Error calling csv2xlsx: " + errTxt);
}
if (!fso.FileExists(tmpxlsx))
{
Log2File(2, "csv2xlsx output " + stdTxt);
throw { description: "Weird: csv2xlsx did not convert {0} to {1}\nPossible cause: putorders was not run from the server?".format(jresult.tmpcsv, tmpxlsx) };
}
mail_params.include_cust_file = tmpxlsx;
ext = "xlsx";
}