Masive export of attachments

Put your suggestions here.
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Masive export of attachments

Post by support »

You don't have to wait for 3.1. I will send source to you once feature will be ready. I think it will be done at the end of this month.
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Masive export of attachments

Post by support »

I'm ready to start this feature. I'm going to do next:
1) Template configuration form will have extra option "Download as Archive"
2) If it's enabled you can select attachment fields ("Attachment", "File field", "Image") and files from these fields will be included in archive.
As I understand you need attachments form comments too, right?
3) in Template form there will be button "Download Archive" allows you download ZIP archive that will include Template file (doc/pdf)+ all attachments.

Everything is correct?
User avatar
rennecke
Sponsor
Sponsor
Posts: 214
Joined: 14 Jan 2018, 12:55
Name: Eberhard Rennecke
Location: Switzerland Zurich

Re: Masive export of attachments

Post by rennecke »

Dear Sergey.
Looks good.
Attachments from comments are also needed.
Regards Eberhard
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Masive export of attachments

Post by support »

Ready to test!

INSTRUCTION
1) Unpack archive to folder where app is installed
2) Run next sql query in phpmyadmin

Code: Select all

ALTER TABLE `app_ext_export_templates` ADD `save_attachments` VARCHAR(255) NOT NULL AFTER `save_as`;
3) Open \plugins\ext\languages\english.php and add next line at the end:

Code: Select all

define('TEXT_SAVE_ATTACHMENTS_ZIP_TIP','Select attachments to be included in the archive');
4) Click CTRL+F5 to reset browser js cache

In result, in template configuration, in settings "Save as" you can select option "ZIP" and if it's selected you can select fields with attachments that will be include in archive (including comments).
configuration.png
Once you click Export button you can see ZIP icon to download archive.
export.png
Let me know if everything works ok.
Attachments
export_with_attachments.zip
(24.79 KiB) Downloaded 57 times
User avatar
rennecke
Sponsor
Sponsor
Posts: 214
Joined: 14 Jan 2018, 12:55
Name: Eberhard Rennecke
Location: Switzerland Zurich

Re: Masive export of attachments

Post by rennecke »

Dear Sergey.
Many thanks. I started testing. I tested with verion 3.0
I started with an export configured for the application I have.
I configured the export for ZIP and PDF. When I open the export dialog for a record with some pictures and many comments with one file attached I get:
Export_with_ZIP.png
There is a failure message on top which also appears when I only configure ODF export.
Export_withoutZIP.png
When I press PDF or ZIP for export, this appears:
Export_failure_result.png
Interesting is, that the number of failur messages on top is equal to the number of files attachen in the comments. Here is an example with 6 files in teh comments.
Export_6files_in_comments.png
To test, if this happens with a more simple entity I tried it on another entity:
The export dialog looks as this (I did not configure the html part):
Export_simple.png
The result is OK:
Export_failure_result.png
What shall I test further to help identify the issue. Maybe this has something to do with my bug report viewtopic.php?f=21&t=3411?
Attachments
Export_simple_result.png
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Masive export of attachments

Post by support »

Please do test on version 3.0.1
User avatar
rennecke
Sponsor
Sponsor
Posts: 214
Joined: 14 Jan 2018, 12:55
Name: Eberhard Rennecke
Location: Switzerland Zurich

Re: Masive export of attachments

Post by rennecke »

I made a fresh install of version 3.0.1.
I get the same error.
Then I tries to setup the same export template from scatch.
When I did not enter html code and it worked. Then I copied over the html code from the other export template and it did not work. I step by step removed components from the html template and discovered, that when the {#comments:Comments} is included the errror happens if it is not the export works.
User avatar
rennecke
Sponsor
Sponsor
Posts: 214
Joined: 14 Jan 2018, 12:55
Name: Eberhard Rennecke
Location: Switzerland Zurich

Re: Masive export of attachments

Post by rennecke »

I have a further question.
Could it be possible, that ther is a further option on the "print multiple records" setting which prints each record into a separte file using the file name with a unique field or the [id] in the name. Than it would be possible to use the ZIP export also for multiple records.
TemplateInfo.png
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Masive export of attachments

Post by support »

Files from archive unpack in folder where app is installed.
Now issue with {#comments:Comments} should be fixed.
Also added ZIP for multiple export.
Let me know if everything works ok.
Attachments
screenshot-localhost-2022.01.23-17_09_34.png
screenshot-localhost-2022.01.23-17_09_18.png
export_with_attachments_part2.zip
(26.23 KiB) Downloaded 58 times
User avatar
rennecke
Sponsor
Sponsor
Posts: 214
Joined: 14 Jan 2018, 12:55
Name: Eberhard Rennecke
Location: Switzerland Zurich

Re: Masive export of attachments

Post by rennecke »

Dear Sergey.
Many thanks it works fine.
I also tested it with a large number of records the export gave me a ZIP file with 2.6 GB containing more than 1300 files. Thats great.
You made it that way, that the files are named by Header and ID. Thats so fare fine but it gave me some files, wher the ID was missing because the header contained characters which are not allowed in file names.
So a better approache could be to use the naming given in the template configuration:
TemplateInfo.png
For me it's fine as it is. Many thanks again.
Post Reply