Merge versie 5.4.1 Gold C patches
svn path=/Website/trunk/; revision=21333
This commit is contained in:
@@ -140,6 +140,7 @@ function ConnectorCls()
|
||||
this.connection.Port = URLParts.port || 21;
|
||||
this.connection.Proxyname = (S("puo_useproxy") ? S("puo_proxyserveripaddress") : "");
|
||||
this.Subfolder = URLParts.directory;
|
||||
this.connection.Flags = S("puo_connectionflag")||0;
|
||||
//
|
||||
Log2File(1, "protocol: ftp");
|
||||
Log2File(1, "FTPServer: " + this.connection.Hostname);
|
||||
@@ -148,6 +149,7 @@ function ConnectorCls()
|
||||
Log2File(1, "FTPPort: " + this.connection.Port);
|
||||
Log2File(1, "FTPProxy: " + this.connection.Proxyname);
|
||||
Log2File(1, "FTPDir: " + this.Subfolder);
|
||||
Log2File(1, "Flags: " + this.connection.Flags);
|
||||
//
|
||||
try
|
||||
{
|
||||
|
||||
@@ -74,10 +74,7 @@ function sendOrderCls()
|
||||
var filename = p_connect.CurrentAddress + p_filename;
|
||||
Log2File(1, "Sending as: " + filename + "...");
|
||||
|
||||
var objFso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var objOtf = objFso.OpenTextFile(filename, fsoForWriting, true);
|
||||
objOtf.Write(p_textstream);
|
||||
objOtf.Close();
|
||||
p_textstream.SaveToFile(filename, 2); // adSaveCreateOverWrite
|
||||
|
||||
var SendOrder = 0;
|
||||
var errText = "";
|
||||
@@ -101,7 +98,7 @@ function sendOrderCls()
|
||||
Log2File(2, "IsHTTP>");
|
||||
Log2File(1, "Sending as: " + p_filename + "...");
|
||||
|
||||
var SendOrder = 1;
|
||||
var SendOrder = -1;
|
||||
var errText = "";
|
||||
|
||||
if (p_order_mode == 0)
|
||||
@@ -172,11 +169,11 @@ function sendOrderCls()
|
||||
objFso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
|
||||
// De opdracht:
|
||||
Log2File(2, "Sending data as file: " + p_filename + " (" + p_textstream.length + " bytes)");
|
||||
Log2File(2, "Sending data as file: " + p_filename + " (" + p_textstream.Size + " bytes)");
|
||||
var FTPresult = sendFTP(p_connect, p_filename, p_textstream); // send text data
|
||||
//
|
||||
// Stuur alle flexfiles (type M(ap) en F(file)) ook mee
|
||||
if (p_attachfolder)
|
||||
if (FTPresult && p_attachfolder)
|
||||
{
|
||||
if (objFso.FolderExists(p_attachfolder))
|
||||
{
|
||||
@@ -198,7 +195,7 @@ function sendOrderCls()
|
||||
}
|
||||
}
|
||||
|
||||
var SendOrder = 0;
|
||||
var SendOrder = -1;
|
||||
var errText = "";
|
||||
if (FTPresult)
|
||||
{
|
||||
@@ -230,7 +227,7 @@ function sendOrderCls()
|
||||
Log2File(1, "*> connectMail");
|
||||
Log2File(2, "IsMail>");
|
||||
Log2File(1, "Sending as: " + p_filename + "...");
|
||||
var SendOrder = 0;
|
||||
var SendOrder = -1;
|
||||
var errText = "";
|
||||
|
||||
if ( S("puo_fromaddress") && S("puo_fromaddress") != "null" && S("puo_fromaddress") != "nodefault")
|
||||
@@ -285,7 +282,7 @@ function sendOrderCls()
|
||||
, S("puo_bcc")
|
||||
, S("puo_receiptto")
|
||||
, p_mailsubject
|
||||
, p_textstream
|
||||
, stream2text(p_textstream)
|
||||
, ""
|
||||
, params
|
||||
);
|
||||
@@ -382,6 +379,10 @@ function sendOrderCls()
|
||||
}
|
||||
if (extension != "")
|
||||
{
|
||||
var streamResult = new ActiveXObject("ADODB.Stream");
|
||||
streamResult.Type = 2; // adTypeText
|
||||
streamResult.Charset = 'utf-8';
|
||||
streamResult.Open();
|
||||
if (extension == "xml")
|
||||
{
|
||||
var XMLResult = new ActiveXObject("Msxml2.DOMDocument.4.0");
|
||||
@@ -391,14 +392,13 @@ function sendOrderCls()
|
||||
// Eventuele attachements inplakken
|
||||
//Log2File 2, "Order =" + XMLResult.xml
|
||||
XMLResult = mergeXMLAttachments(XMLResult);
|
||||
var streamResult = XMLResult.xml;
|
||||
XMLResult.save(streamResult);
|
||||
}
|
||||
else // Bijvoorbeeld csv
|
||||
{
|
||||
streamResult = xmlDoc.transformNode(xslDoc);
|
||||
xmlDoc.transformNodeToObject(xslDoc, streamResult);
|
||||
}
|
||||
|
||||
Log2File(4, "Order =" + streamResult);
|
||||
Log2File(4, "Order =" + stream2text(streamResult));
|
||||
|
||||
// file naam mag geen / bevatten
|
||||
var filename = p_ordernr + "." + extension;
|
||||
|
||||
@@ -8,30 +8,37 @@
|
||||
// ******************************************
|
||||
function sendFTP(p_connect, p_file, p_data, p_path)
|
||||
{
|
||||
var objFso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
|
||||
Log2File(1, "*> sendFTP");
|
||||
var FTPsend = false;
|
||||
|
||||
if (p_connect.Connected)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (p_path)
|
||||
{
|
||||
objFso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
objFile = objFso.GetFile(p_path);
|
||||
Log2File(1, "Transfer file: " + p_file + " (size: " + objFile.Size + ")");
|
||||
p_connect.connection.PutFile(p_file, p_path); // Hiermee kunnen ook binary bestanden gekopieerd worden.
|
||||
}
|
||||
else
|
||||
{
|
||||
Log2File(1, "Transfer file: " + p_file + " (size: " + p_data.length + ")");
|
||||
p_connect.connection.PutFileFromTextData(p_file, p_data); // Alleen een tekst-string schrijven.
|
||||
{ // Forceer p_data altijd naar utf-8
|
||||
var tempfile = "../../../temp/puo_" + objFso.GetTempName();
|
||||
p_data.SaveToFile(tempfile);
|
||||
Log2File(1, "Transfer data as file: " + p_file + " (size: " + p_data.Size + ")");
|
||||
p_connect.connection.PutFile(p_file, tempfile); // Hiermee kunnen ook binary bestanden gekopieerd worden.
|
||||
if (S("puo_loglevel") < 4)
|
||||
objFso.DeleteFile(tempfile);
|
||||
// schrijft geen utf-8
|
||||
// p_connect.connection.PutFileFromTextData(p_file, p_data.ReadText()); // Alleen een tekst-string schrijven.
|
||||
}
|
||||
FTPsend = true;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
Log2File(0, "Error sending " + p_file + ": " + e.description);
|
||||
FTPsend = false;
|
||||
}
|
||||
}
|
||||
Log2File(1, "*< sendFTP");
|
||||
|
||||
@@ -37,7 +37,7 @@ function sendMail( p_mailfrom
|
||||
var params = { attachFileName: p_params.attachFileName || ""
|
||||
, attachFolder: p_params.attachFolder || ""
|
||||
, attachPassword: p_params.attachPassword || ""
|
||||
, attachStream: p_params.attachStream || ""
|
||||
, attachStream: p_params.attachStream
|
||||
, CustId: p_params.CustId || ""
|
||||
};
|
||||
objConf = new ActiveXObject("CDO.Configuration");
|
||||
@@ -93,7 +93,6 @@ function sendMail( p_mailfrom
|
||||
cdoBodyPart.ContentMediaType = "text/html";
|
||||
cdoBodyPart.ContentTransferEncoding = "7bit";
|
||||
objStrm = cdoBodyPart.GetDecodedContentStream();
|
||||
objStrm.Charset = 'utf-8'; // In ieder geval beter dan de default iso-8859
|
||||
objStrm.WriteText(p_bodyhtml);
|
||||
objStrm.Flush();
|
||||
objStrm.Close();
|
||||
@@ -205,15 +204,15 @@ function sendMail( p_mailfrom
|
||||
//
|
||||
if (params.attachStream)
|
||||
{
|
||||
if (params.attachStream.length != 0)
|
||||
if (params.attachStream.Size != 0)
|
||||
{
|
||||
Log2File(2, "Before set addBodyPart");
|
||||
var cdoBodyPart = objMail.BodyPart.AddBodyPart(-1);
|
||||
cdoBodyPart.ContentMediaType = "text/html";
|
||||
cdoBodyPart.ContentMediaType = "application/octet-stream";
|
||||
cdoBodyPart.ContentTransferEncoding = "7bit";
|
||||
objStrm = cdoBodyPart.GetDecodedContentStream();
|
||||
objStrm.Charset = 'utf-8'; // In ieder geval beter dan de default iso-8859
|
||||
objStrm.WriteText(params.attachStream);
|
||||
params.attachStream.Position = 0;
|
||||
params.attachStream.copyTo(objStrm);
|
||||
objStrm.Flush();
|
||||
objStrm.Close();
|
||||
var objFlds = objMail.Configuration.Fields;
|
||||
|
||||
@@ -14,6 +14,12 @@ function sendSMS( p_telnr
|
||||
, p_msg
|
||||
)
|
||||
{
|
||||
if (!S("puo_uid") || !S("puo_pwd"))
|
||||
{
|
||||
Log2File(1, "SMS bericht: '" + p_msg + "' *niet* verzonden naar " + p_telnr + " want SMS niet geconfigureerd.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Log2File(1, "*> sendSMS");
|
||||
|
||||
var SXH_PROXY_SET_PROXY = 2; // contante in msxml2
|
||||
|
||||
@@ -36,18 +36,18 @@ function submitDOMXSLSOAP( p_connect
|
||||
{
|
||||
if (p_order_mode & 8)
|
||||
{
|
||||
XMLpayloadDoc.loadXML(p_textstream);
|
||||
XMLpayloadDoc.load(p_textstream);
|
||||
Log2File(3, "XMLpayloadDoc.documentElement = " + XMLpayloadDoc.documentElement.xml);
|
||||
XMLpayloadNode.appendChild(XMLpayloadDoc.documentElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
XMLpayloadNode.text = p_textstream;
|
||||
XMLpayloadNode.text = stream2text(p_textstream);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XMLpayloadNode.text = Base64.encode(Base64.encode(p_textstream));
|
||||
XMLpayloadNode.text = Base64.encode(Base64.encode(stream2text(p_textstream)));
|
||||
}
|
||||
|
||||
XMLenvelope.appendChild(XMLpayloadNode);
|
||||
|
||||
@@ -92,3 +92,11 @@ function LogResult(p_path, p_data)
|
||||
fpt.Close();
|
||||
}
|
||||
}
|
||||
|
||||
function stream2text(stream)
|
||||
{
|
||||
stream.Position = 0;
|
||||
var txt = stream.ReadText();
|
||||
stream.Position = 0;
|
||||
return txt;
|
||||
}
|
||||
@@ -40,8 +40,8 @@
|
||||
var customerId = oRs(0).Value;
|
||||
oRs.Close();
|
||||
|
||||
|
||||
convertIni();
|
||||
|
||||
app_key = getAppKey(export_app_id);
|
||||
if (app_key == -1)
|
||||
WScript.Quit();
|
||||
@@ -52,43 +52,50 @@
|
||||
ini.applrun = new Date;
|
||||
ini.custid = customerId.toUpperCase();
|
||||
|
||||
__Log("Start gen_import.wsf");
|
||||
__Log("Start gen_export.wsf");
|
||||
|
||||
//
|
||||
var streamParams = {streamwrite: 2};
|
||||
var exportFile = getFileName(ini.prefix, ini.postfix, ini.applrun, ini.timestamp);
|
||||
var expPath = checkDestination(ini.folder, exportFile, streamParams);
|
||||
if (expPath.success)
|
||||
if (taskScheduled(ini))
|
||||
{
|
||||
preExport(ini);
|
||||
var streamData = exportToStream(ini, exportFile);
|
||||
if (streamData)
|
||||
{
|
||||
//
|
||||
var streamParams = {streamwrite: 2};
|
||||
var exportFile = getFileName(ini.prefix, ini.postfix, ini.applrun, ini.timestamp);
|
||||
var expPath = checkDestination(ini.folder, exportFile, streamParams);
|
||||
if (expPath.success)
|
||||
{
|
||||
preExport(ini);
|
||||
var streamData = exportToStream(ini, exportFile);
|
||||
if (streamData)
|
||||
{
|
||||
if (ini.compress)
|
||||
expPath.destination += '.zip';
|
||||
__Log("Writing: " + expPath.destination + " (" + streamData.Size + " bytes)");
|
||||
|
||||
streamData.SaveToFile(expPath.destination, streamParams.streamwrite);
|
||||
streamData.Close();
|
||||
}
|
||||
postExport(ini);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
postExport(ini);
|
||||
}
|
||||
else
|
||||
{
|
||||
__Log(expPath.message);
|
||||
}
|
||||
|
||||
// Nu de logfile schrijven
|
||||
//
|
||||
var logFile = getFileName(ini.prefix, ini.logpostfix, ini.applrun, ini.timestamp);
|
||||
var logPath = checkDestination(ini.folder, logFile, streamParams);
|
||||
if (logPath.success)
|
||||
{
|
||||
}
|
||||
//
|
||||
// Nu de logfile schrijven
|
||||
//
|
||||
var logFile = getFileName(ini.prefix, ini.logpostfix, ini.applrun, ini.timestamp);
|
||||
var logPath = checkDestination(ini.folder, logFile, streamParams);
|
||||
if (logPath.success)
|
||||
{
|
||||
logErrors(logPath.destination, ini, {streamwrite: 2});
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
__Log(logPath.message);
|
||||
}
|
||||
//
|
||||
// Datum in imp_schedule zetten
|
||||
//
|
||||
scheduledDone(ini);
|
||||
}
|
||||
__Log("End gen_export.wsf");
|
||||
|
||||
@@ -110,6 +117,7 @@
|
||||
{
|
||||
// Als er nog geen instellingen in de database zijn, kopieer dan de instellingen naar de database.
|
||||
//
|
||||
|
||||
var sql = "SELECT * FROM fac_export_app";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.Eof)
|
||||
@@ -117,6 +125,13 @@
|
||||
oRs.Close();
|
||||
return; // al klaar
|
||||
}
|
||||
|
||||
// Tijdelijke oplossing om de kolom fac_export_app_prefix 60 tekens lang te maken.
|
||||
var sql = "ALTER TABLE fac_export_app MODIFY fac_export_app_prefix VARCHAR2(60)";
|
||||
__Log("SQL: " + sql);
|
||||
Oracle.Execute(sql);
|
||||
//
|
||||
|
||||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var genini = "gen_export.ini";
|
||||
if (fso.FileExists(genini))
|
||||
@@ -141,6 +156,7 @@
|
||||
var ExportStyleSheet = "";
|
||||
var LogPostfix = "";
|
||||
var BackupTimestamp = "";
|
||||
var Manual = 0;
|
||||
|
||||
for (var l in lines)
|
||||
{
|
||||
@@ -174,7 +190,10 @@
|
||||
LogPostfix = vl;
|
||||
break;
|
||||
case "backupfiletimestamp":
|
||||
BackupTimestamp = vl;
|
||||
BackupTimestamp = vl.replace("hhmm", "HHMM");
|
||||
break;
|
||||
case "manual":
|
||||
Manual = ((parseInt(vl) > 0) ? 2 : 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -194,6 +213,8 @@
|
||||
if (!oRs.Eof)
|
||||
{
|
||||
__Log("Reuse key " + oRs("fac_export_app_key").Value);
|
||||
var flags_old = oRs("fac_export_app_flags").Value;
|
||||
var Zip = ((flags_old & 1) === 1 ? 1 : 0);
|
||||
sql = "UPDATE fac_export_app"
|
||||
+ " SET fac_export_app_charset = " + safe.quoted_sql(ExportCharset)
|
||||
+ " , fac_export_app_folder = " + safe.quoted_sql(ExportFolder)
|
||||
@@ -202,6 +223,7 @@
|
||||
+ " , fac_export_app_xsl = " + safe.quoted_sql(ExportStyleSheet)
|
||||
+ " , fac_export_app_log_postfix = " + safe.quoted_sql(LogPostfix)
|
||||
+ " , fac_export_app_timestamp = " + safe.quoted_sql(BackupTimestamp)
|
||||
+ " , fac_export_app_flags = " + (Manual | Zip)
|
||||
+ " WHERE fac_export_app_key = " + oRs("fac_export_app_key").Value
|
||||
//__Log(sql);
|
||||
Oracle.Execute(sql);
|
||||
@@ -220,6 +242,7 @@
|
||||
+ ", fac_functie_key"
|
||||
+ ", fac_export_app_log_postfix"
|
||||
+ ", fac_export_app_timestamp"
|
||||
+ ", fac_export_app_flags"
|
||||
+ ") "
|
||||
+ "SELECT " + safe.quoted_sql(sectienaam)
|
||||
+ " , 'From gen_export.ini '||" + safe.quoted_sql(sectienaam)
|
||||
@@ -231,6 +254,7 @@
|
||||
+ " , fac_functie_key"
|
||||
+ " , " + safe.quoted_sql(LogPostfix)
|
||||
+ " , " + safe.quoted_sql(BackupTimestamp)
|
||||
+ " , " + Manual
|
||||
+ " FROM fac_functie"
|
||||
+ " WHERE fac_functie_code = 'WEB_PRSSYS'"; // veilig
|
||||
//__Log(sql);
|
||||
@@ -347,5 +371,41 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
function taskScheduled(params)
|
||||
{
|
||||
// Look if there is a task in the table IMP_SCHEDULE if Manual = 1
|
||||
var result = true;
|
||||
|
||||
if (params.manual)
|
||||
{
|
||||
var sql = "SELECT imp_schedule_key FROM imp_schedule"
|
||||
+ " WHERE imp_schedule_done IS NULL"
|
||||
+ " AND imp_schedule_name = " + safe.quoted_sql(params.code);
|
||||
__Log("SQL: " + sql);
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (oRs.eof)
|
||||
{
|
||||
__Log("Not scheduled. Skipping.");
|
||||
result = false;
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function scheduledDone(params)
|
||||
{
|
||||
if (params.manual)
|
||||
{
|
||||
var sql = "UPDATE imp_schedule"
|
||||
+ " SET imp_schedule_done = SYSDATE"
|
||||
+ " WHERE imp_schedule_done IS NULL"
|
||||
+ " AND imp_schedule_name = " + safe.quoted_sql(params.code);
|
||||
__Log("SQL: " + sql);
|
||||
Oracle.Execute(sql);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</job>
|
||||
|
||||
Reference in New Issue
Block a user