kiwicommerce/magento2-cron-scheduler

Editing Cron error when Updating Version

jutenga opened this issue · 3 comments

Updating from 1.0.5 to 1.0.6

Preconditions

  1. First have a version of 1.0.5
  2. Having a crontab.xml defined like this
<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 * @see https://devdocs.magento.com/guides/v2.1/config-guide/cron/custom-cron-ref.html
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="orders"> 
        <job name="cron_export" instance="NAMESPACE\TO\CRON\JOB" method="execute">
            <schedule>*/5 * * * *</schedule>
        </job>
    </group>
</config>

Steps to reproduce

  1. Update to 1.0.6
  2. Go to cronjob administration
  3. try to edit cronjob

Expected result

  1. Edit cronjob

Actual result

kiwi_edit_cron

If the error is unreadable :

Notice: Undefined index: config_path in /srv/www/vendor/kiwicommerce/module-cron-scheduler/Ui/DataProvider/Form/CronJobDataProvider.php on line 91

Possible Solutions

First solution

Obviously, update the crontab.xml to add the missing node

Second solution

To prevent any problem from updating version,
some modification can be made in this files Ui/DataProvider/Form/CronJobDataProvider.php
Before

if ($configPath = $this->loadedData[$jobCode]['config_path']) {
   $this->loadedData[$jobCode]['schedule'] = $this->scopeConfig->getValue($configPath);
}

After :

if (isset($this->loadedData[$jobCode]['config_path']) && $configPath = $this->loadedData[$jobCode]['config_path']) {
   $this->loadedData[$jobCode]['schedule'] = $this->scopeConfig->getValue($configPath);
}

I am observing this same issue.

Magento 2.3.4 on Ubunutu
Module Version: 1.0.6

Hey,

can confirm this issue exists, opened pull request,
#20

Hello, Thank you for your report.
The issue has been fixed in #20 by @dsitovs

Related commit(s):

The fix will be available with the upcoming release.

Thank you.