Working import stock
modifié: core/lib/Thelia/Controller/Admin/ExportController.php modifié: core/lib/Thelia/Controller/Admin/ImportController.php modifié: core/lib/Thelia/Core/Event/ImportExport.php modifié: core/lib/Thelia/Core/Event/TheliaEvents.php modifié: core/lib/Thelia/Core/FileFormat/Formatting/AbstractFormatter.php modifié: core/lib/Thelia/Core/FileFormat/Formatting/Formatter/JsonFormatter.php modifié: core/lib/Thelia/Core/FileFormat/Formatting/FormatterData.php modifié: core/lib/Thelia/ImportExport/Import/Type/ProductStockImport.php modifié: templates/backOffice/default/ajax/import-modal.html modifié: templates/backOffice/default/import-page.html
This commit is contained in:
@@ -11,10 +11,10 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Core\FileFormat\Archive\AbstractArchiveBuilder;
|
||||
use Thelia\Core\FileFormat\Formatting\AbstractFormatter;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\ImportExport\AbstractHandler;
|
||||
use Thelia\ImportExport\Export\ExportHandler;
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ use Thelia\ImportExport\Export\ExportHandler;
|
||||
*/
|
||||
class ImportExport extends ActionEvent
|
||||
{
|
||||
/** @var \Thelia\ImportExport\Export\ExportHandler */
|
||||
/** @var \Thelia\ImportExport\AbstractHandler */
|
||||
protected $handler;
|
||||
|
||||
/** @var \Thelia\Core\FileFormat\Formatting\AbstractFormatter */
|
||||
@@ -36,10 +36,13 @@ class ImportExport extends ActionEvent
|
||||
/** @var \Thelia\Core\FileFormat\Archive\AbstractArchiveBuilder */
|
||||
protected $archiveBuilder;
|
||||
|
||||
/** @var mixed */
|
||||
protected $content;
|
||||
|
||||
public function __construct(
|
||||
AbstractFormatter $formatter,
|
||||
\Thelia\ImportExport\Export\ExportHandler $handler,
|
||||
FormatterData $data,
|
||||
AbstractFormatter $formatter = null,
|
||||
AbstractHandler $handler = null,
|
||||
FormatterData $data = null,
|
||||
AbstractArchiveBuilder $archiveBuilder = null
|
||||
) {
|
||||
$this->archiveBuilder = $archiveBuilder;
|
||||
@@ -123,4 +126,25 @@ class ImportExport extends ActionEvent
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $content
|
||||
* @return $this
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -769,5 +769,9 @@ final class TheliaEvents
|
||||
|
||||
// -- Export ----------------------------------------------
|
||||
|
||||
const BEFORE_EXPORT = "Thelia.before.export";
|
||||
const EXPORT_BEFORE_ENCODE = "Thelia.export.encode.before";
|
||||
const EXPORT_AFTER_ENCODE = "Thelia.export.encode.after";
|
||||
|
||||
const IMPORT_BEFORE_DECODE = "Thelia.import.decode.before";
|
||||
const IMPORT_AFTER_DECODE = "Thelia.import.decode.after";
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ use Thelia\Log\Tlog;
|
||||
*/
|
||||
abstract class AbstractFormatter implements FormatInterface, FormatterInterface
|
||||
{
|
||||
const FILENAME = "export";
|
||||
const FILENAME = "data";
|
||||
|
||||
/** @var \Thelia\Core\Translation\Translator */
|
||||
protected $translator;
|
||||
|
||||
@@ -83,7 +83,7 @@ class JsonFormatter extends AbstractFormatter
|
||||
*/
|
||||
public function decode($rawData)
|
||||
{
|
||||
return (new FormatterData($this->getAliases()))->setData(
|
||||
return (new FormatterData())->setData(
|
||||
json_decode($rawData, true)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -172,13 +172,9 @@ class FormatterData
|
||||
* @param int $index
|
||||
* @return array|bool
|
||||
*/
|
||||
public function popRow($index = 0)
|
||||
public function popRow()
|
||||
{
|
||||
$row = $this->getRow($index);
|
||||
|
||||
if (false !== $row) {
|
||||
unset($this->data[$index]);
|
||||
}
|
||||
$row = array_pop($this->data);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user