Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Vertical extends \Magento\Framework\App\Config\Value
public function beforeSave()
{
if (empty($this->getValue())) {
throw new LocalizedException(__('Please select a vertical.'));
throw new LocalizedException(__('Please select an industry.'));
}

return $this;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/Setup/InstallData.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
'scope' => 'default',
'scope_id' => 0,
'path' => 'analytics/subscription/enabled',
'value' => 1
'value' => 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest changing logic the validation, to better support the case with disabling validation, instead of disabling the feature on every new install. It was intended to be that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ishakhsuvarov I can do that, but then what industry should be set as a default? Otherwise, on fresh installs the reporting service will be enabled, but the Industry will be empty and "will cause distortion of the analytics reports", thus breaking the validation logic of Magento\Analytics\Model\Config\Backend\Vertical::beforeSave(). If the module is enabled by default and someone signs up for the service, will the Magento BI alert them that they need to select an Industry?

If that's handled, I can update the pull request so the module is enabled by default and update the disabling validation logic with:

// Magento\Analytics\Model\Config\Backend\Vertical
public function beforeSave()
{
    if (empty($this->getValue()) && ($this->getFieldsetDataValue('enabled') === '1')) {
        throw new LocalizedException(__('Please select an industry.'));
    }

    return $this;
}

which will allow disabling of the module, but make sure an Industry is supplied when trying to save the config with the module enabled.

Copy link
Contributor

Choose a reason for hiding this comment

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

@nfourteen Currently waiting for someone from product organization to describe the desired state of the feature.
Thank you for collaboration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ishakhsuvarov Thanks for the update. Let me know when you hear something as I'd be happy to edit this PR to reflect the desired state.

],
[
'scope' => 'default',
Expand Down