Skip to content

12525 move web2print to bundle#14175

Merged
kingjia90 merged 43 commits into11.xfrom
12525-move-web2print-to-bundle
Feb 16, 2023
Merged

12525 move web2print to bundle#14175
kingjia90 merged 43 commits into11.xfrom
12525-move-web2print-to-bundle

Conversation

@mattamon
Copy link
Copy Markdown
Contributor

Changes in this pull request

Resolves #12525

Additional info

Moving web to print functionality into PimcoreWebToPrint
Able to install and uninstall via Installer. Permissions are in the Bundle
Moved translations into the bundle
Moved documents printabstract, printcontainer and printpage to bundle

Moving Migration into CoreBundle
Starting to add Document class loader
# Conflicts:
#	.github/ci/files/config/bundles.php
#	bundles/AdminBundle/templates/admin/index/index.html.twig
#	bundles/CoreBundle/config/pimcore/default.yaml
#	bundles/CoreBundle/src/DependencyInjection/PimcoreCoreExtension.php
#	bundles/Web2PrintBundle/public/js/web2print.js
#	composer.json
#	models/DataObject/ClassDefinition/Data/AdvancedManyToManyObjectRelation.php
#	models/DataObject/ClassDefinition/Data/AdvancedManyToManyRelation.php
#	models/DataObject/ClassDefinition/Data/Classificationstore.php
Reverting routing changes to document controllers
Changed fixed document routes
@mattamon mattamon added the Task label Jan 30, 2023
@mattamon mattamon added this to the 11.0.0 milestone Jan 30, 2023
@mattamon mattamon marked this pull request as draft January 30, 2023 10:01
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 30, 2023

Review Checklist

  • Target branch (10.5 for bug fixes, others 11.x)
  • Tests (if it's testable code, there should be a test for it - get help)
  • Docs (every functionality needs to be documented, see here)
  • Migration incl. install.sql (e.g. if the database schema changes, ...)
  • Upgrade notes (deprecations, important information, migration hints, ...)
  • Label
  • Milestone

$configs = $this->loadLegacyConfigs('web2print.php');
if (count($configs) > 0) {
$web2PrintConfigs = Config::getWeb2PrintConfig();
if (count($configs) > 0 && class_exists('Pimcore\Bundle\WebToPrintBundle\Config')) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not to sure about changing this migration

Copy link
Copy Markdown
Contributor

@kingjia90 kingjia90 Jan 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd wrap the entire function up() with a IF block that checks if it exists under the SettingStore and in case "skips" everything.
The down() is empty anyways.

Nevermind, i've misunderstood the issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how this check should look like. Do you have an example?

@mattamon mattamon marked this pull request as ready for review January 30, 2023 13:12
@mattamon mattamon requested a review from kingjia90 January 30, 2023 13:12
Copy link
Copy Markdown
Contributor

@kingjia90 kingjia90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some minor issues after a quick check, but overall seems working fine

$configs = $this->loadLegacyConfigs('web2print.php');
if (count($configs) > 0) {
$web2PrintConfigs = Config::getWeb2PrintConfig();
if (count($configs) > 0 && class_exists('Pimcore\Bundle\WebToPrintBundle\Config')) {
Copy link
Copy Markdown
Contributor

@kingjia90 kingjia90 Jan 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd wrap the entire function up() with a IF block that checks if it exists under the SettingStore and in case "skips" everything.
The down() is empty anyways.

Nevermind, i've misunderstood the issue.

@kingjia90
Copy link
Copy Markdown
Contributor

kingjia90 commented Jan 31, 2023

One input but unrelated to the changes in the PR is: how should it behave when you remove/deactivate the web2print bundle and you still have printpage and printcontainers? What about a cleanup tool or a "archived/invalid documents" tree node and/or filter to hide them? And the generated PDFs and job file? Just wondering if uninstaller should take care of this or is up to the devs

# Conflicts:
#	bundles/WebToPrintBundle/src/Controller/Document/PrintpageControllerBase.php
Adding missing translations
Adding category to permissions in migration
@mattamon
Copy link
Copy Markdown
Contributor Author

mattamon commented Feb 2, 2023

I was wondering about this too, how we should handle those files, because with this PR we do not even have a fallback for the printpage or printcontainer in the core.

@brusch wdyt? what should happen with printcontainer or printpage documents after the bundle gets uninstalled or disabled?

# Conflicts:
#	.github/ci/files/config/bundles.php
#	doc/Development_Documentation/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md
@mattamon mattamon requested a review from kingjia90 February 10, 2023 10:02
Copy link
Copy Markdown
Contributor

@kingjia90 kingjia90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing most of the stuff from the list in the last review.
I've found some other points, but overall looks and works fine to me.

Copy link
Copy Markdown
Contributor

@kingjia90 kingjia90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this checkbox and related translation/docs

fieldLabel: t('web2print_enable_in_default_view'),
xtype: "checkbox",
name: "enableInDefaultView",
checked: this.getValue("enableInDefaultView")
}, {
xtype: "displayfield",
hideLabel: true,
width: 600,
value: t('web2print_enable_in_default_view_txt'),
cls: "pimcore_extra_label_bottom"

which was used to define if the web2print should be activated or not
By default, web-to-print documents are disabled. To enable them, you need to activate them in the web-to-print settings:

Also in the migration needs to check wheter the checkbox was previously marked by that config

if(!SettingsStore::get('BUNDLE_INSTALLED__Pimcore\\Bundle\\WebToPrintBundle\\PimcoreWebToPrintBundle', 'pimcore')) {

kingjia90

This comment was marked as resolved.

# Conflicts:
#	bundles/AdminBundle/src/Controller/Admin/SettingsController.php
Adding cleanup command
Adjust migration to remove or add config
Adjust installer to only remove permissions
Updated documentation
@mattamon mattamon requested a review from kingjia90 February 14, 2023 11:11
Copy link
Copy Markdown
Contributor

@kingjia90 kingjia90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found some other minor tweak to do while scanning through the last commit

Adding deleting queries instead of doing it in the migration
Adding consoleoutput on uninstall
@mattamon mattamon requested a review from kingjia90 February 16, 2023 13:26
Copy link
Copy Markdown
Contributor

@kingjia90 kingjia90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will commit these final suggestions and looks good to be merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] Move Web-to-print to repository pimcore/web-to-print-bundle

2 participants