ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request][US] Codeunit 10094 "Export EFT (ACH)" function DownloadWebclientZip

Open xtiche opened this issue 4 years ago • 1 comments

Please add the event in the function DownloadWebclientZip Codeunit 10094 "Export EFT (ACH)"

procedure DownloadWebclientZip(var TempNameValueBuffer: Record "Name/Value Buffer" temporary; ZipFileName: Text; var DataCompression: Codeunit "Data Compression")
var
    TempBlob: Codeunit "Temp Blob";
    ZipTempBlob: Codeunit "Temp Blob";
    ServerTempFileInStream: InStream;
    ZipInStream: InStream;
    ZipOutStream: OutStream;
    ToFile: Text;
begin
    // new event +
    OnBeforeDownloadWebclientZip(TempNameValueBuffer,TempEraseFileNameValueBuffer,ZipFileName,DataCompression);
    // new event -
    // Download the .zip file containing the reports if one was generated (usually from being on the web client)
    if (ZipFileName <> '') and TempNameValueBuffer.FindSet() then
        // If there's a single file, download it directly instead of the zip file
        if TempNameValueBuffer.Count = 1 then
            FileManagement.DownloadHandler(TempNameValueBuffer.Value, '', '', '', TempNameValueBuffer.Name)
        else begin
            repeat
                FileManagement.BLOBImportFromServerFile(TempBlob, TempNameValueBuffer.Value);
                TempBlob.CreateInStream(ServerTempFileInStream);
                DataCompression.AddEntry(ServerTempFileInStream, TempNameValueBuffer.Name);
                TempEraseFileNameValueBuffer.AddNewEntry(TempNameValueBuffer.Value, '');
            until TempNameValueBuffer.Next() = 0;
            ZipTempBlob.CreateOutStream(ZipOutStream);
            DataCompression.SaveZipArchive(ZipOutStream);
            DataCompression.CloseZipArchive();
            ZipTempBlob.CreateInStream(ZipInStream);
            ToFile := ZipDownloadTxt;
            DownloadFromStream(ZipInStream, '', '', '', ToFile);
        end;

    CleanupTempFiles;
end;

...

// new event +
[IntegrationEvent(false, false)]
local procedure OnBeforeDownloadWebclientZip(var TempNameValueBuffer: Record "Name/Value Buffer" temporary;TempEraseFileNameValueBuffer: Record "Name/Value Buffer" temporary; ZipFileName: Text; var DataCompression: Codeunit "Data Compression")
begin
end;
// new event -

xtiche avatar Sep 05 '22 18:09 xtiche

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 48444.

JesperSchulz avatar Oct 27 '22 17:10 JesperSchulz