FSN#39697 Ook <cac:AdditionalDocumentReference> als bijlageformaat ondersteunen
svn path=/Website/trunk/; revision=33751
This commit is contained in:
@@ -367,6 +367,7 @@ function impProcessStream(import_key, params)
|
||||
}
|
||||
oRs.Close();
|
||||
|
||||
//flexcode = "MLD:995837:544:M";
|
||||
if (flexcode) // FIN:12345:18:F (12345=factuurkey, 18=kenmerkkey, F=factuur (versus R=regels)
|
||||
{
|
||||
if (!folder)
|
||||
@@ -470,7 +471,7 @@ function extractAttachments(safeSourceXML, filename, flexcode)
|
||||
if (arr.length > 2)
|
||||
var pKenmerkKey = parseInt(arr[2], 10);
|
||||
if (arr.length > 3)
|
||||
var pNiveau = parseInt(arr[3], 10);
|
||||
var pNiveau = arr[3];
|
||||
var params = flexProps(pModule, pKey, pKenmerkKey, pNiveau);
|
||||
|
||||
//fileStream.CharSet = charset; // Vroeg, anders krijgen we een BOM?
|
||||
@@ -526,5 +527,42 @@ function extractAttachments(safeSourceXML, filename, flexcode)
|
||||
__Log("Empty file skipped: " + safefilename);
|
||||
}
|
||||
}
|
||||
|
||||
// En ook:
|
||||
// <cac:AdditionalDocumentReference>
|
||||
// <cbc:ID>V1700746.pdf</cbc:ID>
|
||||
// <cbc:DocumentType>PrimaryImage</cbc:DocumentType>
|
||||
// <cac:Attachment>
|
||||
// <cbc:EmbeddedDocumentBinaryObject mimeCode="application/pdf">
|
||||
// ... base64 ...
|
||||
// </cbc:EmbeddedDocumentBinaryObject>
|
||||
// </cac:Attachment>
|
||||
// </cac:AdditionalDocumentReference>
|
||||
//
|
||||
|
||||
var Attachments = xmldoc.getElementsByTagName("cac:AdditionalDocumentReference");
|
||||
for (var i=0; i < Attachments.length; i++)
|
||||
{
|
||||
var safefilename = safe.filename(XMLval(Attachments[i], "cbc:ID"));
|
||||
if (!params.isAllowedName(safefilename))
|
||||
{
|
||||
// TODO: Misschien ook terugkoppelen in IMP_LOG?
|
||||
__Log("Onbekende extensie upload bijlage: {0}. Bestand is niet opgeslagen.".format(safefilename));
|
||||
}
|
||||
else
|
||||
{
|
||||
__Log('Bijlage {0} mag naar {1}'.format(safefilename, params.AttachPath));
|
||||
var AttachmentData = XMLval(Attachments[i], "cbc:EmbeddedDocumentBinaryObject");
|
||||
if (AttachmentData)
|
||||
{
|
||||
CreateFullPath(params.AttachPath);
|
||||
encodedString2File(params.AttachPath + safefilename, AttachmentData, "bin.base64");
|
||||
__Log("Done saving: " + params.AttachPath + safefilename);
|
||||
}
|
||||
else
|
||||
__Log("Empty file skipped: " + safefilename);
|
||||
}
|
||||
}
|
||||
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user