Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document generation only supports PDF files #3700

Open
sschwei1 opened this issue May 7, 2024 · 2 comments
Open

Document generation only supports PDF files #3700

sschwei1 opened this issue May 7, 2024 · 2 comments
Labels

Comments

@sschwei1
Copy link
Contributor

sschwei1 commented May 7, 2024

PHP Version

8.2

Shopware Version

6.6.1.2

Expected behaviour

When creating a new document type, there should be a way to handle other file extensions than .pdf when creating a new document for an order.

Actual behaviour

When creating a new document type, there is no way to specify another file extension than .pdf when creating a new document for an order.

How to reproduce

  1. Create a new documet-type following the documentation.
  2. Add a vue component named sw-order-document-settings-[my-new-document-type]-modal (extending sw-order-document-settings-modal) to handle creation of new documents (this should be added to the documentation)
  3. There is no way to enrich the data passed to /api/_action/order/document/[my-new-document-type]/create with additional information like the fileType using the documentApiService.

Technically you could also use orderDocumentApiService to handle the creation of documents which would allow to add the fileType, however there is some handling of the response data in the documentApiService and adding a 2nd service and override the onCreateDocument of sw-order-document-settings-modal would kind of end up in messy code.

The DocumentGeneratorController also seems to validate the data passed to it and should invalidate any document where the fileType is not equal to pdf (->add('fileType', new Choice([FileTypes::PDF])) Line 53). However when validation, the validator tries to access the documents property of the passed documents (found here), but both services (documentApiService and orderDocumentApiService) pass their data as indexed array so the data will never actually be validated.

The DocumentGenerator is also just using a pdfResolver to resolve the rendered document returned by your custom-type renderer.

It seems like the system is built to support multiple file types, however it is not fully implemented yet. Are there any plans on when this happen?

Technically this is more like not yet implemented, than an actual bug.

@sschwei1 sschwei1 added the Bug label May 7, 2024
@schiefertom
Copy link

I also would need that implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants