akeneo / magento2-connector-community

Akeneo Connector for Magento 2
Open Software License 3.0
80 stars 87 forks source link

Using "Since last successful import" option, ignores the last successful import date. #657

Open robinero opened 10 months ago

robinero commented 10 months ago

Environment and configuration

  1. Magento 2.4.6-p2
  2. Akeneo connector 104.0.0
  3. Akeneo 6.x

Steps to reproduce

  1. Set Updated mode to "Since last successful import"
  2. Run bin/magento akeneo_connector:import --code=product (or schedule the job)

Expected result

  1. Akeneo connector should only import products since last successful executed date.

Actual result

  1. Akeneo connector imports all products.

When running the connector the "last successful executed date" is set per family by the following code: https://github.com/akeneo/magento2-connector-community/blob/v104.0.0/Executor/JobExecutor.php#L356

This line of code uses date('y-m-d H:i:s');, which will use a two digit year format. The Akeneo API however expects a 4 digit year format: https://api.akeneo.com/documentation/filter.html#on-their-creation-or-update-date.

This normally wouldn't be a problem when inserting this value in a datetime column, but last_success_executed_date uses text to allow saving the JSON format: https://github.com/akeneo/magento2-connector-community/blob/v104.0.0/etc/db_schema.xml#L80

To fix this, simply replace date('y-m-d H:i:s'); with date('Y-m-d H:i:s'); for the following:

Using the same format, the following should probably also be changed:

rbouma commented 10 months ago

We have same problem, thanks for sorting out @robinero Hope this will be fixed soon. for time being we will create composer patch for this.

Bartlomiejsz commented 10 months ago

Fyi @robinero, I created PR for this issue some time ago but it wasn't yet merged - https://github.com/akeneo/magento2-connector-community/pull/646

robinero commented 10 months ago

@Bartlomiejsz, bit stupid of me, I only checked the PRs after creating the issue.

Although I'm not sure if Akeneo merges PRs, so here's hoping they do after seeing this issue.

robinero commented 7 months ago

Issue still exists in v104.0.7.

rbouma2 commented 4 weeks ago

@magentix @Dnd-Gimix or someone else, please merge the fix in #646. Its not that hard? There is a bug, the solution is presented, but still, nobody has merged it. This issue is really annoying to apply a patch to every customer.

Edit: Sorry for my bad language, it is frustrating that these simple fixes takes ages to get merged.