MARX#76342 Mareon Bijlagen aanpassing AX2012: base64 stuk voor stuk ophalen
svn path=/Mareon/trunk/; revision=59180
This commit is contained in:
@@ -129,16 +129,33 @@ return v_resp;
|
||||
|
||||
function A2012_GetBijlagen_bij_opdrachten_van_Aannemer(v_supplier_id, v_status_code, v_datum_vanaf, v_datum_tm)
|
||||
{
|
||||
|
||||
var v_API = "SupplierPortalGetDocuRefRequest ";
|
||||
var v_req = ' <SupplierPortalGetDocuRefRequest xmlns="http://tempuri.org"> '+
|
||||
// MARX#76342: Mareon Bijlagen aanpassing AX2012 via nieuwe webservices die base64 stuk voor stuk ophaalt tbv performance
|
||||
// Toepassen van nieuwe API SupplierPortalGetDocuReferenceRequest, de oude SupplierPortalGetDocuRefRequest bestaat nog wel maar gaan we niet meer gebruiken
|
||||
// Reden: performance, zodat AX niet alle bijlagen tot base64 hoeft te verwerken, want die blijft in deze nieuwe API leeg, en het ophalen van de base64 doen we via een nog andere nieuwe API, stuk voor stuk.
|
||||
var v_API = "SupplierPortalGetDocuReferenceRequest";
|
||||
var v_req = ' <SupplierPortalGetDocuReferenceRequest xmlns="http://tempuri.org"> '+
|
||||
'<_vendAccount>'+v_supplier_id+'</_vendAccount>' +
|
||||
'<_bonStatus>'+v_status_code+'</_bonStatus>'+
|
||||
'<_startRange>'+v_datum_vanaf+'</_startRange>' +
|
||||
'<_endRange>'+v_datum_tm+'</_endRange>' +
|
||||
'</SupplierPortalGetDocuRefRequest>';
|
||||
'</SupplierPortalGetDocuReferenceRequest>';
|
||||
var v_type = 0;
|
||||
var v_soapAction = "SupplierPortal/getDocuRef";
|
||||
var v_soapAction = "SupplierPortal/getDocuReference";
|
||||
|
||||
var v_resp = apiAX(v_API, v_req, v_type, v_soapAction, 0);
|
||||
|
||||
return v_resp;
|
||||
}
|
||||
|
||||
function A2012_GetBijlage_via_ReferenceId(v_docu_ref_id)
|
||||
{
|
||||
// MARX#76342: Mareon Bijlagen aanpassing AX2012, Nieuwe API die obv 1 unieke reference-ID de base64 bijlage ophaalt
|
||||
var v_API = "SupplierPortalGetDocuRefBase64Request";
|
||||
var v_req = ' <SupplierPortalGetDocuRefBase64Request xmlns="http://tempuri.org"> '+
|
||||
'<_docuReference>'+v_docu_ref_id+'</_docuReference>' +
|
||||
'</SupplierPortalGetDocuRefBase64Request>';
|
||||
var v_type = 0;
|
||||
var v_soapAction = "SupplierPortal/getDocuRefBase64";
|
||||
|
||||
var v_resp = apiAX(v_API, v_req, v_type, v_soapAction, 0);
|
||||
|
||||
|
||||
@@ -732,8 +732,9 @@ function FACILITOR_2_Xtractor()
|
||||
// 1.64 -- MARX#69028: Uitvalfacturen toch naar het prefacturen register.
|
||||
// 1.65 -- MARX#74749: Mareon Sync heel traag na MARX23.
|
||||
// 1.70 -- MARX#76415: Mareon koppeling met 3rd Party Viewpoint + MARX#74444: Het '&' teken in de naam van een bijlage wordt niet ondersteund in de sync.
|
||||
// 1.71 -- MARX#76342: Mareon Bijlagen aanpassing AX2012 via nieuwe webservices die base64 stuk voor stuk ophaalt tbv performance
|
||||
|
||||
var G_Mareon_Adapter = "1.70";
|
||||
var G_Mareon_Adapter = "1.71";
|
||||
//MARX#56643: Test Haagwonen inkoopordernummer ontbreekt in Mareon ION001753
|
||||
var G_new_date = new Date();
|
||||
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -116,7 +116,7 @@ function api_AX_2_F_Bijlagen(v_xml_bijlagen_string)
|
||||
|
||||
// Loop 2. Daarna de loop met alle bestanden/documenten op opdracht-kop nivo
|
||||
l_docs_xml = l_xml_opdrachten[i].getElementsByTagName("b:Documents");
|
||||
l_aantal_uploads = api_AX_2_F_Verwerk_Documenten (l_mld_opdr_key, l_docs_xml , 0, "b:FileName", "b:Extension", "b:Base64");
|
||||
l_aantal_uploads = api_AX_2_F_Verwerk_Documenten (l_mld_opdr_key, l_docs_xml, 0, "b:FileName", "b:Extension", "b:Base64", "b:Reference");
|
||||
|
||||
// Loop 3. Nu nog de loop met alle opdracht-regels binnen de opdracht
|
||||
var l_xml_opdrachtregels = l_xml_opdrachten[i].getElementsByTagName("b:SupplierPurchLine");
|
||||
@@ -124,7 +124,7 @@ function api_AX_2_F_Bijlagen(v_xml_bijlagen_string)
|
||||
{
|
||||
// Loop 4. Tenslotte de loop met alle bestanden/documenten op betreffende opdracht-regel nivo
|
||||
l_docs_xml = l_xml_opdrachtregels[j].getElementsByTagName("b:Documents");
|
||||
l_aantal_uploads = api_AX_2_F_Verwerk_Documenten (l_mld_opdr_key, l_docs_xml, l_aantal_uploads, "b:FileName", "b:Extension", "b:Base64");
|
||||
l_aantal_uploads = api_AX_2_F_Verwerk_Documenten (l_mld_opdr_key, l_docs_xml, l_aantal_uploads, "b:FileName", "b:Extension", "b:Base64", "b:Reference");
|
||||
}
|
||||
l_opdr_str = l_opdr_str + "<action><action_code>" + l_import_action + "</action_code>" + "<ref_key>" + l_mld_opdr_key + "</ref_key></action>";
|
||||
}
|
||||
@@ -141,6 +141,21 @@ function api_AX_2_F_Bijlagen(v_xml_bijlagen_string)
|
||||
}
|
||||
}
|
||||
|
||||
// MARX#76342: Mareon Bijlagen aanpassing AX2012 via nieuwe webservices die base64 stuk voor stuk ophaalt tbv performance
|
||||
function api_AX_GetBase64_Bijlage(v_xml_bijlagen_string, v_file_content_base64)
|
||||
{
|
||||
__Log("START api_AX_GetBase64_Bijlage",2);
|
||||
var l_bijlage_base64 = null;
|
||||
var l_xml_document = STR_2_XML(v_xml_bijlagen_string);
|
||||
|
||||
var node_documentinhoud64 = l_xml_document[0].getElementsByTagName(v_file_content_base64);
|
||||
if (node_documentinhoud64.length !=0){
|
||||
l_bijlage_base64 = node_documentinhoud64[0].childNodes[0].nodeValue;
|
||||
}
|
||||
__Log("EINDE api_AX_GetBase64_Bijlage",2);
|
||||
return l_bijlage_base64;
|
||||
}
|
||||
|
||||
//MARX#57420: Documenten van Tobias AX naar Mareon
|
||||
// Inputparamters:
|
||||
// v_mld_opdr_key = Mareon opdracht key (mld_opdr_key)
|
||||
@@ -153,7 +168,45 @@ function api_AX_2_F_Bijlagen(v_xml_bijlagen_string)
|
||||
// Outputparameter (dwz result) vandeze functie:
|
||||
// l_result: Aantal bestanden dat erbij is geupload.
|
||||
|
||||
function api_AX_2_F_Verwerk_Documenten(v_mld_opdr_key, v_xml_documenten, v_aantal_uploads, v_filename, v_file_extension, v_file_content_base64){
|
||||
|
||||
// MARX#76342: Mareon Bijlagen aanpassing AX2012 via nieuwe webservices die base64 stuk voor stuk ophaalt tbv performance
|
||||
//<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
// <s:Body>
|
||||
// <SupplierPortalGetDocuReferenceResponse xmlns="http://tempuri.org">
|
||||
// <response xmlns:b="http://schemas.datacontract.org/2004/07/Dynamics.Ax.Application" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
||||
// <b:PurchOrders>
|
||||
// <b:PurchOrder>
|
||||
// <b:CompanyId>kic</b:CompanyId>
|
||||
// <b:Documents></b:Documents>
|
||||
// <b:PurchId>INK017221</b:PurchId>
|
||||
// <b:PurchLines>
|
||||
// <b:SupplierPurchLine>
|
||||
// <b:Documents>
|
||||
// <b:Document>
|
||||
// AANGEPAST in AX2012: is leeg <b:Base64></b:Base64> !! Let op: in AX2009 is deze nog wel gevuld
|
||||
// <b:Extension>pdf</b:Extension>
|
||||
// <b:FileName>base64 test mareon sync</b:FileName>
|
||||
// NIEUW: ref-id om base64 op te halen <b:Reference>5637409338</b:Reference> !! Let op: in AX2009 bestaat deze niet
|
||||
// </b:Document>
|
||||
// <b:Document>
|
||||
// <b:Base64></b:Base64>
|
||||
// <b:Extension>pdf</b:Extension>
|
||||
// <b:FileName>base64 test 2 mareon sync</b:FileName>
|
||||
// <b:Reference>5637409339</b:Reference>
|
||||
// </b:Document>
|
||||
// </b:Documents>
|
||||
// <b:PurchLineId>5637881083</b:PurchLineId>
|
||||
// <b:actionCodeDescription></b:actionCodeDescription>
|
||||
// ..
|
||||
//
|
||||
// <b:taxItemGroup></b:taxItemGroup>
|
||||
// </b:SupplierPurchLine>
|
||||
// </b:PurchLines>
|
||||
// </b:PurchOrder>
|
||||
// ..
|
||||
|
||||
|
||||
function api_AX_2_F_Verwerk_Documenten(v_mld_opdr_key, v_xml_documenten, v_aantal_uploads, v_filename, v_file_extension, v_file_content_base64, v_file_reference_id){
|
||||
var l_result = 0;
|
||||
var l_xml_document = v_xml_documenten[0].getElementsByTagName("b:Document");
|
||||
for (var i=0; i < l_xml_document.length; i++)
|
||||
@@ -164,6 +217,8 @@ function api_AX_2_F_Verwerk_Documenten(v_mld_opdr_key, v_xml_documenten, v_aanta
|
||||
var l_bijlage_naam = null;
|
||||
var l_bijlage_ext = null;
|
||||
var l_bijlage_base64 = null;
|
||||
var l_bijlage_refid = null;
|
||||
var l_xml_base64bijlage = null;
|
||||
|
||||
var node_media_id = l_xml_document[i].getElementsByTagName(v_filename);
|
||||
if (node_media_id.length !=0)
|
||||
@@ -179,6 +234,17 @@ function api_AX_2_F_Verwerk_Documenten(v_mld_opdr_key, v_xml_documenten, v_aanta
|
||||
if (node_documentinhoud64.length !=0){
|
||||
l_bijlage_base64 = node_documentinhoud64[0].childNodes[0].nodeValue;
|
||||
}
|
||||
|
||||
if (! l_bijlage_base64)
|
||||
{
|
||||
//MARX#76342: Mareon Bijlagen aanpassing AX2012, base64 is leeg, dan gaan we die alsnog ophalen via opsturen van nieuwe reference-veld naar nieuwe webservice
|
||||
var node_refid = l_xml_document[i].getElementsByTagName(v_file_reference_id);
|
||||
if (node_refid.length !=0){
|
||||
l_bijlage_refid = node_refid[0].childNodes[0].nodeValue;
|
||||
l_xml_base64bijlage = A2012_GetBijlage_via_ReferenceId(l_bijlage_refid);
|
||||
l_bijlage_base64 = api_AX_GetBase64_Bijlage(l_xml_base64bijlage, v_file_content_base64);
|
||||
}
|
||||
}
|
||||
__Log("DocumentInhoud[" + i + "] : " + l_bijlage_base64, 4);
|
||||
|
||||
// Maximaal 10 bijlages staan we per opdracht toe.
|
||||
|
||||
Reference in New Issue
Block a user