Aldevinas Katkus
5-7-21
Operating system: Windows
I would like to attach a report when I create an email from the sales invoice.
So I modified CreateMailFromIVD()
and added a code to generate a PDF report, but it works strange:
In single user mode it attaches only my report PDF to the mail (it should attach an invoice and my report pdfs), even though I can see both PDFs are created in the tmp directory.
In client server mode it crashes the server and does not attach anything.
What is the proper way to create and attach report (not document) to the record?
windows client, linux server
My code:
...
RecordClear(RepSpec);
RepSpec.repname = "MyRn";
ReportDefaults(RepSpec,"MyRClass");
...
SetDocumentFileName(fname);
RepSpec.Media = mtPdf;
SetMedia(mtPdf);
//RunReport(RepSpec,0);
MyRn(RepSpec);//tried to call report instead of RunReport, same result
SetDocumentFilename("");
if (FileExists(fname)) then begin
RecordLinkFile(fname,0,Mailr,CurrentCompany);
Delete_File(fname);
SetDocumentFilename("");
end;
hansa.log
2021-05-06 18:28:47 (1) AK Printing Faktūros 20210111
2021-05-06 18:28:47 (1) AK PDF Error: 4133
...
2021-05-06 18:28:47 (1) AK PDF Error: 4133
2021-05-06 18:28:47 (1) AK backtrace called due to: CopyDVP with some KeyMasterArrType touchedf!=false
2021-05-06 18:28:47 (1) AK -------------------- backtrace start -------------------------
2021-05-06 18:28:47 (1) AK 0: /home/stabilus/ss/StandardERPServer64() [0x6a4838]
...
2021-05-06 18:28:47 (1) AK 22: /home/stabilus/ss/StandardERPServer64() [0x40a942]
2021-05-06 18:28:47 (1) AK 23: /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f3eb669db35]
2021-05-06 18:28:47 (1) AK 24: /home/stabilus/ss/StandardERPServer64() [0x40a9e1]
2021-05-06 18:28:47 (1) AK --------------------- backtrace end --------------------------
2021-05-06 18:28:47 (1) AK
2021-05-06 18:28:47 (1) AK dump of call stack
2021-05-06 18:28:47 (1) AK Exiting to protect the database