degdigital / magento2-customreports

degdigital/magento2-customreports

A Magento 2 module that allows an administrator to create reports in the admin panel. This is modeled after the Clean Reports module for Magento 1.

magento2-module Compatibility: Not compatible Code Quality: Fail Tests: N/A Security: Pass OSL-3.0, AFL-3.0

Are you the maintainer of degdigital?

Packagento pulls degdigital's Composer packages from the public registry so buyers can find them here.

Claim the namespace to take ownership, publish new releases directly, and start charging for premium versions.

Claim this namespace →

DEG Custom Reports

This module was inspired by the Magento 1 extension for custom reports (https://github.com/kalenjordan/custom-reports).
Thank you to Kalen Jordan and all who contributed to that project.

Description

Easily create reports with custom SQL queries and display them using the Magento admin grid.

Disclaimer

This module has the potential to make irreversible changes to your database if set up incorrectly. Use at your own risk.

Features

  • Report result table
  • Usage of a read-only database connection
  • Column filtering
  • Column sorting
  • CSV, TSV, TXT (pipe-delimited), and Excel XML exports
  • Automated exports

Custom Reports

From the admin panel > Reports > Custom Reports > Custom Reports interface, reports can be created with arbitrary queries.

Performance

Report queries can be very slow, even enough to trigger an unavoidable gateway timeout (depending on architecture) or browser timeout and thus be unusable. This is exacerbated by (often unnecessary) queries to retrieve columns and queries to retrieve the total record count.

The query to retrieve columns now reuses the same query used to get the full result set (when filters and sorting are not applied). When filters/sorting are applied, the columns query must use its own query for the reasons outlined in \DEG\CustomReports\Block\Adminhtml\Report\Grid::_prepareLayout.

A flag on the custom reports called 'Allow Count Query' can be set to 'No', which will prevent the typical 'select count(*) from (original query)' query used to determine the total number of records and the total number of pages, because this data may be unnecessary on report grids for the following reasons:

  • some reports may always return results far below the page size.
  • some reports might only render useful data on the first page, so the total record count and the total page count are unnecessary.
  • some report grids might only be used to gain access to the Export button, so all information on the grid is unnecessary.

In such cases, if the query is slow, this flag can be set to 'No' to improve the performance of the report query.

With no filters applied and 'Allow Count Query' set to 'No', the report query will only run once.

Automated Exports

From the admin panel > Reports > Custom Reports > Automated Exports interface, jobs can be created to export one or more custom reports. Currently, two types of exports are supported:

  1. Local file drops, in which a file is created on the server in which the Magento cron runs from in a configurable location, with var/export being the suggested location.
  2. Remote file drops, in which a file is created the same as a local file drop and then uploaded to an SFTP server with the provided credentials.
  3. Email, in which a file is sent as an attachment to the email recipient(s). If "Send as one combined email" is set to 'No' (the default), NM emails will be sent with one attachment each, where N is the number of custom reports and M is the number of file types. If it is set to 'Yes', then only one email will be sent with NM attachments.

If both types are selected, the system will run the query and generate the local file only once. This is useful for especially heavy queries.

A cron job will be created with the name "automated_export_<automated_export_id_here>". The configuration for the cron job resides in the core_config_data table with a path like crontab/default/jobs/automated_export_<automated_export_id_here>. E.g.:

crontab/default/jobs/automated_export_1/schedule/cron_expr = 0 0 0 0 0
crontab/default/jobs/automated_export_1/run/model = DEG\CustomReports\Model\AutomatedExport\Cron::execute
crontab/default/jobs/automated_export_1/name = automated_export_1

The popular third-party Magento tool, n98-magerun, can be used to run the automated exports manually from the command line using the above name, e.g. n98-magerun sys:cron:run automated_export_1.

No changelog yet

The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.

Versions
Version Stability QA Status Compatibility Released
3.1.4 stable Fail Not compatible Details 2023-04-27 18:49:06
3.1.3 stable Not tested Not yet tested Details 2023-03-03 21:51:02
3.1.2 stable Not tested Not yet tested Details 2023-03-03 04:12:10
3.1.1 stable Not tested Not yet tested Details 2023-03-03 03:47:02
3.1.0 stable Not tested Not yet tested Details 2023-03-03 02:59:53
3.0.0 stable Not tested Not yet tested Details 2023-02-13 16:23:49
2.0.6 stable Not tested Not yet tested Details 2022-10-04 19:14:13
2.0.5 stable Not tested Not yet tested Details 2022-09-15 18:47:33
2.0.4 stable Not tested Not yet tested Details 2022-08-11 20:02:49
2.0.3 stable Not tested Not yet tested Details 2022-02-09 19:51:14
2.0.2 stable Not tested Not yet tested Details 2022-02-08 21:49:53
2.0.1 stable Not tested Not yet tested Details 2022-02-08 19:12:18
2.0.0 stable Not tested Not yet tested Details 2022-02-07 20:15:02
1.2.0 stable Not tested Not yet tested Details 2022-01-04 18:40:43
1.1.5.1 stable Not tested Not yet tested Details 2017-04-26 15:25:51
1.1.5 stable Not tested Not yet tested Details 2017-04-25 14:34:31
1.1.3 stable Not tested Not yet tested Details 2017-04-17 15:47:07
1.1.2 stable Not tested Not yet tested Details 2017-04-17 14:07:41
1.1.1 stable Not tested Not yet tested Details 2017-04-14 00:53:52
1.1.0 stable Not tested Not yet tested Details 2017-04-14 00:53:18
1.0.0 stable Not tested Not yet tested Details 2017-04-13 23:52:04

No dependencies declared

This package's composer.json doesn't declare any required, suggested, replaced, or conflicting packages.

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 not tested Pass
2.4.8 Pass Fail di error
2.4.9 Fail di error Fail di error

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge. A phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Fail 138 7 errors, 131 warnings (ruleset: Magento2) — 50 auto-fixable with phpcbf
PHPMD Warning 10 10 rule violations (IfStatementAssignment:7, MissingImport:1, CyclomaticComplexity:1, NPathComplexity:1)
Cpd Warning 12 12 duplicated chunks spanning 767 total lines (min-lines=5, min-tokens=70)
Composer validate Pass 0

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 59 59
2.4.8 62 69
2.4.9 65 65

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
OSL-3.0, AFL-3.0
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.