Correct export of Delivery Unit EON_XSJSFRAMEWORK (36 files, replaces incomplete initial export)

This commit is contained in:
Thorsten Schmitz
2026-07-09 02:02:07 +02:00
parent 997ad1c8f6
commit e5d9482cf1
35 changed files with 3067 additions and 918 deletions
+71 -69
View File
@@ -20,6 +20,7 @@ var service_version = '1.4';
function copyBP(ParDebug,mCardCode) {
var SESSIONID = "";
@@ -40,13 +41,13 @@ function copyBP(ParDebug,mCardCode) {
//searchparam.key = "U_EON_ID_CRM_INTERNAL";
searchparamV.key = "CardCode";
searchparamV.value = mCardCode + "-L";
output.searchparamC = searchparamC;
output.searchparamV = searchparamV;
var slError;
// SL LOGIN
// SL LOGIN
var response = slib.SLLogin(JSON.stringify(loginInfo), null, null);
// B1SESSION and ROUTEID cookies returned by Login
@@ -97,77 +98,78 @@ function copyBP(ParDebug,mCardCode) {
var customerObject = slfwlib.getfullBPbysearchParam(searchparamC, SESSIONID, NODEID,ParDebug);
var vendorObject = slfwlib.getfullBPbysearchParam(searchparamV, SESSIONID, NODEID,ParDebug);
var consBPObject="";
// outMessages.push(customerObject.Messages);
// outMessages.push(vendorObject.Messages);
myDebug.customerObject = customerObject;
myDebug.vendorObject = vendorObject;
//consBPObject = bpmaplib.buildBPObj(customerObject.BP,vendorObject.BP);
//consBPObject = bpmaplib.buildBPObj(customerObject.BP,vendorObject.BP);
//myDebug.mappedUPDBPObj = consBPObject;
if (customerObject.Status == "exists" && vendorObject.Status == "exists") {
consBPObject = bpmaplib.buildBPObj(customerObject.BP,vendorObject.BP);
myDebug.mappedUPDBPObj = consBPObject;
output.method = "updateVendor";
var responseUpdate = slib.updateBusinessPartner(vendorObject.BP.CardCode, JSON.stringify(consBPObject), SESSIONID, NODEID);
outMsg = {};
outMsg.method = "update";
myDebug.statusUpdate = responseUpdate.status;
outMsg.statuscode = responseUpdate.status;
if (responseUpdate.status >= 200 && responseUpdate.status < 300) {
myDebug.Updatemessage = "Update sucessfull";
outMsg.status = "success";
} else {
myDebug.message = "Update error occured";
outMsg.status = "error";
if (responseUpdate.body) {
myDebug.responseUpdate = JSON.parse(responseUpdate.body.asString());
//outMsg.message = myDebug.responseUpdate;
slError = myDebug.responseUpdate.error;
if (slError && slError.hasOwnProperty("code") && slError.message && slError.message.value ) {
outMsg.message = slError.message.value + " (Code: " + slError.code.toString() + ")";
} else {
outMsg.message = JSON.stringify(myDebug.responseUpdate);
}
outMsg.response = myDebug.responseUpdate;
}
outStatus = "error";
}
outMessages.push(outMsg);
}
if (customerObject.Status == "exists" && vendorObject.Status == "not exists") {
consBPObject = bpmaplib.buildBPObj(customerObject.BP);
myDebug.mappedCreateBPObj = consBPObject;
output.method = "createVendor";
outMsg = {};
outMsg.method = "create";
var responseCreate = slib.createBusinessPartner(JSON.stringify(consBPObject), SESSIONID, NODEID);
myDebug.statusCreate = responseCreate.status;
outMsg.statuscode = responseCreate.status;
myDebug.responseCreate = JSON.parse(responseCreate.body.asString());
if (responseCreate.status >= 200 && responseCreate.status < 300) {
myDebug.Createmessage = "Create sucessfull";
outMsg.status = "success";
} else {
myDebug.Createmessage = "Create error occured";
output.errorCreatestatus = myDebug.Createmessage;
outMsg.status = "error";
//outMsg.message = myDebug.responseCreate;
outStatus = "error";
slError = myDebug.responseCreate.error;
if (slError && slError.hasOwnProperty("code") && slError.message && slError.message.value ) {
outMsg.message = slError.message.value + " (Code: " + slError.code.toString() + ")";
if (customerObject.Status == "exists" && vendorObject.Status == "exists") {
consBPObject = bpmaplib.buildBPObj(customerObject.BP,vendorObject.BP);
myDebug.mappedUPDBPObj = consBPObject;
output.method = "updateVendor";
var responseUpdate = slib.updateBusinessPartner(vendorObject.BP.CardCode, JSON.stringify(consBPObject), SESSIONID, NODEID);
outMsg = {};
outMsg.method = "update";
myDebug.statusUpdate = responseUpdate.status;
outMsg.statuscode = responseUpdate.status;
if (responseUpdate.status >= 200 && responseUpdate.status < 300) {
myDebug.Updatemessage = "Update sucessfull";
outMsg.status = "success";
} else {
outMsg.message = JSON.stringify(myDebug.responseCreate);
myDebug.message = "Update error occured";
outMsg.status = "error";
if (responseUpdate.body) {
myDebug.responseUpdate = JSON.parse(responseUpdate.body.asString());
//outMsg.message = myDebug.responseUpdate;
slError = myDebug.responseUpdate.error;
if (slError && slError.hasOwnProperty("code") && slError.message && slError.message.value ) {
outMsg.message = slError.message.value + " (Code: " + slError.code.toString() + ")";
} else {
outMsg.message = JSON.stringify(myDebug.responseUpdate);
}
outMsg.response = myDebug.responseUpdate;
}
outStatus = "error";
}
outMsg.response = myDebug.responseCreate;
outMessages.push(outMsg);
}
if (customerObject.Status == "exists" && vendorObject.Status == "not exists") {
consBPObject = bpmaplib.buildBPObj(customerObject.BP);
myDebug.mappedCreateBPObj = consBPObject;
output.method = "createVendor";
outMsg = {};
outMsg.method = "create";
var responseCreate = slib.createBusinessPartner(JSON.stringify(consBPObject), SESSIONID, NODEID);
myDebug.statusCreate = responseCreate.status;
outMsg.statuscode = responseCreate.status;
myDebug.responseCreate = JSON.parse(responseCreate.body.asString());
if (responseCreate.status >= 200 && responseCreate.status < 300) {
myDebug.Createmessage = "Create sucessfull";
outMsg.status = "success";
} else {
myDebug.Createmessage = "Create error occured";
output.errorCreatestatus = myDebug.Createmessage;
outMsg.status = "error";
//outMsg.message = myDebug.responseCreate;
outStatus = "error";
slError = myDebug.responseCreate.error;
if (slError && slError.hasOwnProperty("code") && slError.message && slError.message.value ) {
outMsg.message = slError.message.value + " (Code: " + slError.code.toString() + ")";
} else {
outMsg.message = JSON.stringify(myDebug.responseCreate);
}
outMsg.response = myDebug.responseCreate;
}
outMessages.push(outMsg);
}
outMessages.push(outMsg);
}
//output.CardCode = CardCode;
@@ -182,9 +184,9 @@ function copyBP(ParDebug,mCardCode) {
{
output.debug = myDebug;
}
return output;
}
}