|
15 | 15 | use Magento\Framework\App\ObjectManager;
|
16 | 16 | use Magento\Framework\Exception\LocalizedException;
|
17 | 17 | use Magento\Framework\Filesystem;
|
| 18 | +use Magento\Framework\Intl\DateTimeFactory; |
18 | 19 | use Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor;
|
19 | 20 | use Magento\Framework\Model\ResourceModel\Db\TransactionManagerInterface;
|
20 | 21 | use Magento\Framework\Stdlib\DateTime;
|
@@ -724,6 +725,11 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
|
724 | 725 | */
|
725 | 726 | private $mediaProcessor;
|
726 | 727 |
|
| 728 | + /** |
| 729 | + * @var DateTimeFactory |
| 730 | + */ |
| 731 | + private $dateTimeFactory; |
| 732 | + |
727 | 733 | /**
|
728 | 734 | * @param \Magento\Framework\Json\Helper\Data $jsonHelper
|
729 | 735 | * @param \Magento\ImportExport\Helper\Data $importExportData
|
@@ -767,7 +773,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
|
767 | 773 | * @param ImageTypeProcessor $imageTypeProcessor
|
768 | 774 | * @param MediaGalleryProcessor $mediaProcessor
|
769 | 775 | * @param StockItemImporterInterface|null $stockItemImporter
|
770 |
| - * |
| 776 | + * @param DateTimeFactory $dateTimeFactory |
771 | 777 | * @SuppressWarnings(PHPMD.ExcessiveParameterList)
|
772 | 778 | */
|
773 | 779 | public function __construct(
|
@@ -812,7 +818,8 @@ public function __construct(
|
812 | 818 | CatalogConfig $catalogConfig = null,
|
813 | 819 | ImageTypeProcessor $imageTypeProcessor = null,
|
814 | 820 | MediaGalleryProcessor $mediaProcessor = null,
|
815 |
| - StockItemImporterInterface $stockItemImporter = null |
| 821 | + StockItemImporterInterface $stockItemImporter = null, |
| 822 | + DateTimeFactory $dateTimeFactory = null |
816 | 823 | ) {
|
817 | 824 | $this->_eventManager = $eventManager;
|
818 | 825 | $this->stockRegistry = $stockRegistry;
|
@@ -868,6 +875,7 @@ public function __construct(
|
868 | 875 | ->_initSkus()
|
869 | 876 | ->initImagesArrayKeys();
|
870 | 877 | $this->validator->init($this);
|
| 878 | + $this->dateTimeFactory = $dateTimeFactory ?? ObjectManager::getInstance()->get(DateTimeFactory::class); |
871 | 879 | }
|
872 | 880 |
|
873 | 881 | /**
|
@@ -2873,8 +2881,8 @@ private function formatStockDataForRow(array $rowData): array
|
2873 | 2881 | ? $row['is_in_stock']
|
2874 | 2882 | : $this->stockStateProvider->verifyStock($stockItemDo);
|
2875 | 2883 | if ($this->stockStateProvider->verifyNotification($stockItemDo)) {
|
2876 |
| - $row['low_stock_date'] = |
2877 |
| - gmdate(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT, (new \DateTime())->getTimestamp()); |
| 2884 | + $date = $this->dateTimeFactory->create('now', new \DateTimeZone('UTC')); |
| 2885 | + $row['low_stock_date'] = $date->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT); |
2878 | 2886 | }
|
2879 | 2887 | $row['stock_status_changed_auto'] = (int)!$this->stockStateProvider->verifyStock($stockItemDo);
|
2880 | 2888 | } else {
|
|
0 commit comments