degdigital / magento2-customreports

Magento 2 module that allows an admin panel user to create new reporting grids via SQL statements.
67 stars 40 forks source link

Compatibility with Magento 2.3 #19

Closed RalphVB closed 1 year ago

RalphVB commented 5 years ago

Hello.

I've been trying to make the changes required to makes this awesome module work on Magento 2.3. but I'm stucked in the error of setSortable that I putted as title.

First I added the the module requires php 7.2 in the composer.json of the module. "require": { "php": "~5.5.0|~5.6.0|~7.0.0|~7.1.0|~7.2.0" },

Then in DEG/CustomReports/Block/Adminhtml/Report/Grid.php in line 31 I changed this:

if (count($columnList) ){

To this:

if ( is_array($columnList) && count($columnList) == 1 ){

And there is where the error appears on the log of nginx. As far as I've researched the probem is in Grid.php on the line 51 because in the view/admin/layout there is no block refering to columnSet.

Any help will be appreciated and will help for other to makes the required changes for this module to work on Magento 2.3.

RalphVB commented 5 years ago

The only thing that I had to change to make in order to make this plugin work with Magento 2.3 is deleting the validation:

Then in DEG/CustomReports/Block/Adminhtml/Report/Grid.php in line 31 I changed this:

if (count($columnList) ){ $this->addColumnSet($columnList); $this->addGridExportBlock(); $this->setCollection($genericCollection); }

To this:

$this->addColumnSet($columnList); $this->addGridExportBlock(); $this->setCollection($genericCollection);

:)

MarcusWolschon commented 5 years ago

Thanks a lot!

peterjaap commented 3 years ago

I fixed it with a patch for vaimo/composer-patches;

@package degdigital/magento2-customreports
@level 0

diff --git Block/Adminhtml/Report/Grid.php Block/Adminhtml/Report/Grid.php
index 5431932..9fc7a28 100644
--- Block/Adminhtml/Report/Grid.php
+++ Block/Adminhtml/Report/Grid.php
@@ -28,7 +28,8 @@ class Grid extends \Magento\Backend\Block\Widget\Grid
         /** @var $genericCollection \DEG\CustomReports\Model\GenericReportCollection */
         $genericCollection = $customReport->getGenericReportCollection();
         $columnList = $this->getColumnListFromCollection($genericCollection);
-        if (is_array($columnList) && count($columnList)) {
+        /** @var $columnList \Magento\Framework\DataObject */
+        if (is_object($columnList) && $columnList->hasData()) {
             $this->addColumnSet($columnList);
             $this->addGridExportBlock();
             $this->setCollection($genericCollection);
peterjaap commented 1 year ago

This has been fixed, you can close the issue @jantzenw