Skip to content

Commit 6ac21aa

Browse files
committed
Bug fixes
1 parent 188eac1 commit 6ac21aa

File tree

8 files changed

+109
-128
lines changed

8 files changed

+109
-128
lines changed

Model/Source/Config/Reader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public function __construct(
2727
$this->_fileName = $fileName;
2828
$this->_idAttributes = array_replace($this->_idAttributes, $idAttributes);
2929
$this->_schemaFile = $schemaLocator->getSchema();
30-
$this->_isValidated = $validationState->isValidated();
31-
$this->_perFileSchema = $schemaLocator->getPerFileSchema() &&
32-
$this->_isValidated ? $schemaLocator->getPerFileSchema() : null;
30+
$this->validationState = $validationState;
31+
$this->_perFileSchema = $schemaLocator->getPerFileSchema() && $validationState->isValidationRequired()
32+
? $schemaLocator->getPerFileSchema() : null;
3333
$this->_domDocumentClass = $domDocumentClass;
3434
$this->_defaultScope = $defaultScope;
3535
}

Model/Source/Type/AbstractType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
use Magento\Framework\App\Filesystem\DirectoryList;
1010

11-
abstract class AbstractType extends \Magento\Framework\Object {
11+
abstract class AbstractType extends \Magento\Framework\DataObject {
1212

1313
const IMPORT_DIR = 'var/import';
1414

Model/Source/Type/Ftp.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public function uploadSource()
1616
$sourceFilePath = $this->getData($this->_code . '_file_path');
1717
$fileName = basename($sourceFilePath);
1818
$filePath = $this->_directory->getAbsolutePath($this->getImportPath() . '/' . $fileName);
19+
20+
$filesystem = new \Magento\Framework\Filesystem\Io\File();
21+
$filesystem->setAllowCreateFolders(true);
22+
$filesystem->checkAndCreateFolder($this->_directory->getAbsolutePath($this->getImportPath()));
23+
1924
$result = $client->read($sourceFilePath, $filePath);
2025

2126
if($result) {

Plugin/Block/Import/Form.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ public function beforeSetForm(\Magento\ImportExport\Block\Adminhtml\Import\Edit\
2828
$fileFieldset->setClass('source-fieldset ' . $oldClass);
2929

3030
$types = $this->_config->get();
31-
$sources = [['label' => __('-- Please Select --'), 'value' => '']];
31+
$sources = [
32+
['label' => __('-- Please Select --'), 'value' => ''],
33+
['label' => __('File'), 'value' => 'file']
34+
];
3235
foreach ($types as $typeName => $type) {
3336
$sources[] = ['label' => $type['label'], 'value' => $typeName];
3437
}

Plugin/Model/Import.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class Import extends \Magento\ImportExport\Model\Import {
2727
* @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig
2828
* @param \Magento\ImportExport\Model\Import\ConfigInterface $importConfig
2929
* @param \Magento\ImportExport\Model\Import\Entity\Factory $entityFactory
30-
* @param \Magento\ImportExport\Model\Resource\Import\Data $importData
3130
* @param \Magento\ImportExport\Model\Export\Adapter\CsvFactory $csvFactory
3231
* @param \Magento\Framework\HTTP\Adapter\FileTransferFactory $httpFactory
3332
* @param \Magento\MediaStorage\Model\File\UploaderFactory $uploaderFactory
@@ -47,12 +46,12 @@ public function __construct(
4746
\Magento\Framework\App\Config\ScopeConfigInterface $coreConfig,
4847
\Magento\ImportExport\Model\Import\ConfigInterface $importConfig,
4948
\Magento\ImportExport\Model\Import\Entity\Factory $entityFactory,
50-
\Magento\ImportExport\Model\Resource\Import\Data $importData,
49+
\Magento\ImportExport\Model\ResourceModel\Import\Data $importData,
5150
\Magento\ImportExport\Model\Export\Adapter\CsvFactory $csvFactory,
5251
\Magento\Framework\HTTP\Adapter\FileTransferFactory $httpFactory,
5352
\Magento\MediaStorage\Model\File\UploaderFactory $uploaderFactory,
5453
\Magento\ImportExport\Model\Source\Import\Behavior\Factory $behaviorFactory,
55-
\Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
54+
\Magento\Framework\Indexer\IndexerRegistry $indexerRegistry,
5655
\Magento\ImportExport\Model\History $importHistoryModel,
5756
\Magento\Framework\Stdlib\DateTime\DateTime $localeDate,
5857
array $data = []
@@ -88,7 +87,8 @@ public function uploadSource()
8887
{
8988
$result = null;
9089

91-
if($sourceType = $this->getImportSource()) {
90+
if($this->getImportSource() && $this->getImportSource() != 'file') {
91+
$sourceType = $this->getImportSource();
9292
$source = $this->_helper->getSourceModelByType($sourceType);
9393
$source->setData($this->getData());
9494

Plugin/Model/Import/Product.php

Lines changed: 90 additions & 117 deletions
Large diffs are not rendered by default.

etc/import.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Magento/ImportExport/etc/import.xsd">
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_ImportExport:etc/import.xsd">
99
<entity name="catalog_product" label="Products" model="Firebear\ImportExport\Model\Import\Product" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" />
1010
</config>

view/adminhtml/templates/import/form/before.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/** @var $block \Magento\ImportExport\Block\Adminhtml\Import\Edit\Before */
99
?>
1010
<script>
11-
require(['jquery', 'prototype'], function(jQuery){
11+
require(['jquery', 'Magento_Ui/js/modal/alert', 'prototype'], function(jQuery){
1212

1313
//<![CDATA[
1414
// Temporary Class will be replaced after refactoring of import/export functionality

0 commit comments

Comments
 (0)