ECA - Print file document from a chosen entity and saves it as a file entity

Created on 11 September 2023, about 1 year ago
Updated 25 April 2024, 7 months ago

Problem/Motivation

Need to store the entity print in a file within Drupal.

Proposed resolution

Add a new ECA rule to Print file document from a chosen entity and saves it as a file entity.

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom lexsoft London

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @lexsoft
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    54 pass
  • @lexsoft opened merge request.
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    54 pass
  • Status changed to Needs review about 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom lexsoft London
  • I want to send a invoice attached to a mail.
    I use commerce module, commerce invoice, eca and easy mail.
    1. On checkout event eca have to print the invoice and save it to private folder
    2. Eca attachs the pdf file and send the mail.

    Tests :

    1. Eca event : view content any. Action : print entity node. Node is printed and downloaded in the browser but not saved in private folder
    2. Eca event : view content invoice. Action : print entity commerce_invoice. Nothing is printed and new page give a error id() null.

    Thanks for help

  • πŸ‡¬πŸ‡§United Kingdom lexsoft London

    @alexandrepoinas this ECA action only saves it as a file and should be visibile if you visit /admin/content/files but also the file it's available as a token you set in the ECA action. You could then use the file object token in other ECA actions and maybe attach this to an email if an ECA action is build for that.

  • Tried this solution but obtained : "Le site Web a rencontrΓ© une erreur inattendue." unexpected error.
    It works fine when I try with a node.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    @lexsoft I've looked into your MR and that looks really good. Unfortunately, this way it introduces a dependency on the ECA module, which is probably not what the maintainers of entity_print want.

    May I suggest that we create a separate module eca_entity_print which integrates ECA with entity_print and only comes with those action plugins? We could then move them over and publish the code there idependently.

  • πŸ‡¬πŸ‡§United Kingdom lexsoft London

    Hi @jurgenhaas, sounds good.
    I can create one, can I add you as a maintainer as well?

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    @lexsoft yes please, I'd be happy to contribute the next couple of days as I have a project where I need that action plugin.

    Please name the project "ECA Entity Print" with the machine name eca_entity_print so that it is consistent with the other integration modules.

  • πŸ‡¬πŸ‡§United Kingdom lexsoft London

    @jurgenhaas I've created a new module https://www.drupal.org/project/eca_entity_print β†’ and added you as a maintainer. I've pushed the first initial code that includes the actions. Feel free to make any changes needed for a stable release and let me know how I can help.

  • Status changed to Fixed 7 months ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    @lexsoft That's great, thank you so much. I've created the 2.0.x branch there to build and optimize against the 2.0 release of ECA. Once that's completed, we can backport to 1.0.x from there.

    Also, I've subclassed the views action plugin from the entity action plugin, which removes a lot of redundant code.

    And last but not least, I've removed the file name sanitisation since Drupal core has that now built in and the file name for file entities will be sanitized automatically.

    For further tasks, let's open issues in the other project.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024