Page 1 of 1

Extension - Templates in docx format - corrupted file when & is saved in field type entity

Posted: 21 Feb 2022, 20:06
by swar
This is more less the same bug that was already reported in the past (viewtopic.php?f=20&t=3242&p=13048), however, now it affects only field type entity.


Where: ext/templates/export_templates - docx template (https://docs.rukovoditel.net/index.php?p=100)

What: In case there is a character & in name of record linked via field type entity and field type entity is used as information block in docx template, the exported docx is corrupted.

How replicate:
1. Create an entity Projects and Companies.
2. Add field Asignee (type entity) to Projects and chose Select Entity: Companies.
3. Create a docx template for entity Projects and insert block for field Asignee in the docx template (e.g. Asignee: ${78}).
4. Create a new record in entity Companies with field name "A&B" or any other name with &.
5. Create a new record in Projects and select Asignee: "A&B".
5. Try exporting newly saved record in Projects to docx template. The file is corrupted.
6. Delete character & from name of the record in Companies and try exporting Projects again. Now the file is ok.

Re: Extension - Templates in docx format - corrupted file when & is saved in field type entity

Posted: 22 Feb 2022, 20:37
by support
I think I have found issue. File from archive replace to plugins\ext\classes\templates\
Let me know if it works ok now.

Re: Extension - Templates in docx format - corrupted file when & is saved in field type entity

Posted: 23 Feb 2022, 17:38
by brave
it did not work for me, the word document cannot be opened. Do I change it back to & you can open the worddocment. it's about A&B for me I have to write A&B

Re: Extension - Templates in docx format - corrupted file when & is saved in field type entity

Posted: 24 Feb 2022, 09:02
by support
Patrick, you have applied this patch?
If so then please reproduce issue on personal demo https://www.rukovoditel.net/account_dem ... quest=demo
and give me the link to the demo. I will look where issue is.

Re: Extension - Templates in docx format - corrupted file when & is saved in field type entity

Posted: 24 Feb 2022, 16:28
by swar
The patch above solved the problem in our use case. Thanks, Sergey!

Re: Extension - Templates in docx format - corrupted file when & is saved in field type entity

Posted: 24 Feb 2022, 20:37
by support
Patrick, I have found your issue. File from attached archive replace to plugins\ext\classes\templates\
Let me know if it's fixed.

Re: Extension - Templates in docx format - corrupted file when & is saved in field type entity

Posted: 24 Feb 2022, 21:14
by brave
it works!! Sergey you are a genius! Thank you very much