Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
Daniel Seifert | 39af6ba830 | |
Daniel Seifert | e473fd861e | |
Daniel Seifert | fe1d7c6fcd | |
Daniel Seifert | 5476891a88 | |
Daniel Seifert | f155ac5f0c | |
Daniel Seifert | 7baf766f2c | |
Daniel Seifert | c207a03287 | |
Daniel Seifert | 95e1002df5 |
|
@ -16,22 +16,26 @@ declare(strict_types=1);
|
|||
namespace D3\DataWizard\Application\Controller\Admin;
|
||||
|
||||
use D3\DataWizard\Application\Model\Configuration;
|
||||
use D3\DataWizard\Application\Model\Constants;
|
||||
use D3\DataWizard\Application\Model\Exceptions\DataWizardException;
|
||||
use D3\DataWizard\Application\Model\Exceptions\DebugException;
|
||||
use D3\DataWizard\Application\Model\Exceptions\InputUnvalidException;
|
||||
use D3\DataWizard\Application\Model\Exceptions\TaskException;
|
||||
use D3\ModCfg\Application\Model\d3database;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
|
||||
use OxidEsales\Eshop\Core\Config;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class d3ActionWizard extends AdminDetailsController
|
||||
{
|
||||
protected $_sThisTemplate = 'd3ActionWizard.tpl';
|
||||
protected $_sThisTemplate = '@'. Constants::OXID_MODULE_ID .'/admin/d3ActionWizard';
|
||||
|
||||
/** @var Configuration */
|
||||
protected $configuration;
|
||||
protected Configuration $configuration;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -45,59 +49,68 @@ class d3ActionWizard extends AdminDetailsController
|
|||
return $this->configuration->getActionGroups();
|
||||
}
|
||||
|
||||
public function getGroupTasks($group)
|
||||
public function getGroupTasks($group): array
|
||||
{
|
||||
return $this->configuration->getActionsByGroup($group);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function runTask()
|
||||
public function runTask(): void
|
||||
{
|
||||
try {
|
||||
$this->execute();
|
||||
} catch (DataWizardException|DBALException|DatabaseErrorException $e) {
|
||||
} catch (DataWizardException|DBALException $e) {
|
||||
Registry::getLogger()->error($e->getMessage());
|
||||
Registry::getUtilsView()->addErrorToDisplay($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DBALException
|
||||
* @throws DebugException
|
||||
* @throws InputUnvalidException
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws TaskException
|
||||
*/
|
||||
protected function execute()
|
||||
protected function execute(): void
|
||||
{
|
||||
$id = Registry::getRequest()->getRequestEscapedParameter('taskid');
|
||||
$action = $this->configuration->getActionById($id);
|
||||
|
||||
[ $queryString, $parameters ] = $action->getQuery();
|
||||
|
||||
if ($this->d3GetConfig()->getConfigParam('d3datawizard_debug')) {
|
||||
throw oxNew(
|
||||
if ($this->getSettingsService()->getBoolean('d3datawizard_debug', Constants::OXID_MODULE_ID)) {
|
||||
/** @var DebugException $debug */
|
||||
$debug = oxNew(
|
||||
DebugException::class,
|
||||
d3database::getInstance()->getPreparedStatementQuery($queryString, $parameters)
|
||||
);
|
||||
throw $debug;
|
||||
}
|
||||
|
||||
$action->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Config
|
||||
* @return ModuleSettingService
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function d3GetConfig(): Config
|
||||
public function getSettingsService(): ModuleSettingServiceInterface
|
||||
{
|
||||
return Registry::getConfig();
|
||||
return ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
||||
}
|
||||
|
||||
public function getUserMessages()
|
||||
public function getUserMessages(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getHelpURL()
|
||||
public function getHelpURL(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -16,27 +16,31 @@ declare(strict_types=1);
|
|||
namespace D3\DataWizard\Application\Controller\Admin;
|
||||
|
||||
use D3\DataWizard\Application\Model\Configuration;
|
||||
use D3\DataWizard\Application\Model\Constants;
|
||||
use D3\DataWizard\Application\Model\Exceptions\DataWizardException;
|
||||
use D3\DataWizard\Application\Model\Exceptions\DebugException;
|
||||
use D3\DataWizard\Application\Model\Exceptions\NoSuitableRendererException;
|
||||
use D3\DataWizard\Application\Model\Exceptions\TaskException;
|
||||
use D3\ModCfg\Application\Model\d3database;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Driver\Exception;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
|
||||
use OxidEsales\Eshop\Core\Config;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class d3ExportWizard extends AdminDetailsController
|
||||
{
|
||||
protected $_sThisTemplate = 'd3ExportWizard.tpl';
|
||||
protected $_sThisTemplate = '@'. Constants::OXID_MODULE_ID .'/admin/d3ExportWizard';
|
||||
|
||||
/** @var Configuration */
|
||||
protected $configuration;
|
||||
protected Configuration $configuration;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -50,18 +54,21 @@ class d3ExportWizard extends AdminDetailsController
|
|||
return $this->configuration->getExportGroups();
|
||||
}
|
||||
|
||||
public function getGroupTasks($group)
|
||||
public function getGroupTasks($group): array
|
||||
{
|
||||
return $this->configuration->getExportsByGroup($group);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws Exception
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function runTask()
|
||||
public function runTask(): void
|
||||
{
|
||||
try {
|
||||
$this->execute();
|
||||
|
@ -75,20 +82,22 @@ class d3ExportWizard extends AdminDetailsController
|
|||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws NoSuitableRendererException
|
||||
* @throws TaskException
|
||||
* @throws StandardException
|
||||
* @throws Exception
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
protected function execute()
|
||||
protected function execute(): void
|
||||
{
|
||||
$id = Registry::getRequest()->getRequestEscapedParameter('taskid');
|
||||
$export = $this->configuration->getExportById($id);
|
||||
|
||||
[ $queryString, $parameters ] = $export->getQuery();
|
||||
|
||||
if ($this->d3GetConfig()->getConfigParam('d3datawizard_debug')) {
|
||||
if ($this->getSettingsService()->getBoolean('d3datawizard_debug', Constants::OXID_MODULE_ID)) {
|
||||
throw oxNew(
|
||||
DebugException::class,
|
||||
d3database::getInstance()->getPreparedStatementQuery($queryString, $parameters)
|
||||
|
@ -99,19 +108,21 @@ class d3ExportWizard extends AdminDetailsController
|
|||
}
|
||||
|
||||
/**
|
||||
* @return Config
|
||||
* @return ModuleSettingService
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function d3GetConfig(): Config
|
||||
public function getSettingsService(): ModuleSettingServiceInterface
|
||||
{
|
||||
return Registry::getConfig();
|
||||
return ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
||||
}
|
||||
|
||||
public function getUserMessages()
|
||||
public function getUserMessages(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getHelpURL()
|
||||
public function getHelpURL(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -16,18 +16,20 @@ declare(strict_types=1);
|
|||
namespace D3\DataWizard\Application\Model;
|
||||
|
||||
use D3\DataWizard\Application\Model\Exceptions\InputUnvalidException;
|
||||
use D3\DataWizard\Application\Model\Exceptions\TaskException;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use FormManager\Inputs\Checkbox;
|
||||
use FormManager\Inputs\Input;
|
||||
use FormManager\Inputs\Radio;
|
||||
use OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface;
|
||||
use OxidEsales\Eshop\Core\DatabaseProvider;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Database\ConnectionProviderInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
abstract class ActionBase implements QueryBase
|
||||
{
|
||||
protected $formElements = [];
|
||||
protected array $formElements = [];
|
||||
|
||||
/**
|
||||
* Ensure that the translations are equally available in the frontend and the backend
|
||||
|
@ -39,16 +41,21 @@ abstract class ActionBase implements QueryBase
|
|||
}
|
||||
|
||||
/**
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DBALException
|
||||
* @throws InputUnvalidException
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws TaskException
|
||||
*/
|
||||
public function run()
|
||||
public function run(): void
|
||||
{
|
||||
if ($this->hasFormElements()) {
|
||||
/** @var Input $element */
|
||||
foreach ($this->getFormElements() as $element) {
|
||||
if (false === $element->isValid()) {
|
||||
throw oxNew(InputUnvalidException::class, $this, $element);
|
||||
/** @var InputUnvalidException $exception */
|
||||
$exception = oxNew(InputUnvalidException::class, $this, $element);
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,28 +66,34 @@ abstract class ActionBase implements QueryBase
|
|||
/**
|
||||
* @param array $query
|
||||
*
|
||||
* @return int
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws TaskException
|
||||
* @throws DBALException
|
||||
*/
|
||||
public function executeAction(array $query): int
|
||||
public function executeAction(array $query): void
|
||||
{
|
||||
[ $queryString, $parameters ] = $query;
|
||||
|
||||
$queryString = trim($queryString);
|
||||
|
||||
if (strtolower(substr($queryString, 0, 6)) === 'select') {
|
||||
throw oxNew(
|
||||
Exceptions\TaskException::class,
|
||||
/** @var TaskException $exception */
|
||||
$exception = oxNew(
|
||||
TaskException::class,
|
||||
$this,
|
||||
Registry::getLang()->translateString('D3_DATAWIZARD_ERR_ACTIONSELECT')
|
||||
);
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
$affected = $this->d3GetDb()->execute($queryString, $parameters);
|
||||
$connection = ContainerFactory::getInstance()->getContainer()->get(ConnectionProviderInterface::class)->get();
|
||||
$affected = (int) $connection->executeStatement($queryString, $parameters);
|
||||
|
||||
throw oxNew(
|
||||
Exceptions\TaskException::class,
|
||||
/** @var TaskException $exception */
|
||||
$exception = oxNew(
|
||||
TaskException::class,
|
||||
$this,
|
||||
sprintf(
|
||||
Registry::getLang()->translateString(
|
||||
|
@ -89,15 +102,7 @@ abstract class ActionBase implements QueryBase
|
|||
$affected
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DatabaseInterface|null
|
||||
* @throws DatabaseConnectionException
|
||||
*/
|
||||
public function d3GetDb(): ?DatabaseInterface
|
||||
{
|
||||
return DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,7 +116,7 @@ abstract class ActionBase implements QueryBase
|
|||
/**
|
||||
* @param Input $input
|
||||
*/
|
||||
public function registerFormElement(Input $input)
|
||||
public function registerFormElement(Input $input): void
|
||||
{
|
||||
if ($input instanceof Radio || $input instanceof Checkbox) {
|
||||
$input->setTemplate('<p class="form-check">{{ input }} {{ label }}</p>');
|
||||
|
|
|
@ -27,8 +27,8 @@ class Configuration
|
|||
public const GROUP_REMARKS = 'D3_DATAWIZARD_GROUP_REMARKS';
|
||||
public const GROUP_CMS = 'D3_DATAWIZARD_GROUP_CMS';
|
||||
|
||||
protected $actions = [];
|
||||
protected $exports = [];
|
||||
protected array $actions = [];
|
||||
protected array $exports = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ class Configuration
|
|||
* @param $group
|
||||
* @param ActionBase $action
|
||||
*/
|
||||
public function registerAction($group, ActionBase $action)
|
||||
public function registerAction($group, ActionBase $action): void
|
||||
{
|
||||
$this->actions[$group][md5(get_class($action))] = $action;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class Configuration
|
|||
* @param $group
|
||||
* @param ExportBase $export
|
||||
*/
|
||||
public function registerExport($group, ExportBase $export)
|
||||
public function registerExport($group, ExportBase $export): void
|
||||
{
|
||||
$this->exports[$group][md5(get_class($export))] = $export;
|
||||
}
|
||||
|
@ -93,9 +93,9 @@ class Configuration
|
|||
/**
|
||||
* @param $group
|
||||
*
|
||||
* @return mixed
|
||||
* @return array
|
||||
*/
|
||||
public function getActionsByGroup($group)
|
||||
public function getActionsByGroup($group): array
|
||||
{
|
||||
return $this->actions[$group];
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ class Configuration
|
|||
/**
|
||||
* @param $group
|
||||
*
|
||||
* @return mixed
|
||||
* @return array
|
||||
*/
|
||||
public function getExportsByGroup($group)
|
||||
public function getExportsByGroup($group): array
|
||||
{
|
||||
return $this->exports[$group];
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ class Configuration
|
|||
{
|
||||
$allActions = $this->getAllActions();
|
||||
|
||||
if (false == $allActions[$id]) {
|
||||
if ( ! $allActions[ $id ] ) {
|
||||
throw oxNew(DataWizardException::class, 'no action with id '.$id);
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ class Configuration
|
|||
{
|
||||
$allExports = $this->getAllExports();
|
||||
|
||||
if (false == $allExports[$id]) {
|
||||
if ( ! $allExports[ $id ] ) {
|
||||
throw oxNew(DataWizardException::class, 'no export with id '.$id);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* https://www.d3data.de
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link https://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\DataWizard\Application\Model;
|
||||
|
||||
class Constants
|
||||
{
|
||||
public const OXID_MODULE_ID = 'd3datawizard';
|
||||
}
|
|
@ -21,8 +21,7 @@ use FormManager\Inputs\Input;
|
|||
|
||||
class InputUnvalidException extends DataWizardException
|
||||
{
|
||||
/** @var QueryBase */
|
||||
public $task;
|
||||
public QueryBase $task;
|
||||
|
||||
/**
|
||||
* InputUnvalidException constructor.
|
||||
|
|
|
@ -20,8 +20,7 @@ use Exception;
|
|||
|
||||
class TaskException extends DataWizardException
|
||||
{
|
||||
/** @var QueryBase */
|
||||
public $task;
|
||||
public QueryBase $task;
|
||||
|
||||
public function __construct(QueryBase $task, $sMessage = "not set", $iCode = 0, Exception $previous = null)
|
||||
{
|
||||
|
|
|
@ -17,24 +17,30 @@ namespace D3\DataWizard\Application\Model;
|
|||
|
||||
use D3\DataWizard\Application\Model\Exceptions\ExportFileException;
|
||||
use D3\DataWizard\Application\Model\Exceptions\InputUnvalidException;
|
||||
use D3\DataWizard\Application\Model\Exceptions\NoSuitableRendererException;
|
||||
use D3\DataWizard\Application\Model\ExportRenderer\RendererBridge;
|
||||
use D3\DataWizard\Application\Model\ExportRenderer\RendererInterface;
|
||||
use D3\ModCfg\Application\Model\d3filesystem;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Driver\Exception;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use FormManager\Inputs\Checkbox;
|
||||
use FormManager\Inputs\Input;
|
||||
use FormManager\Inputs\Radio;
|
||||
use OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface;
|
||||
use OxidEsales\Eshop\Core\DatabaseProvider;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Database\ConnectionProviderInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
abstract class ExportBase implements QueryBase
|
||||
{
|
||||
protected $formElements = [];
|
||||
protected array $formElements = [];
|
||||
|
||||
/**
|
||||
* Ensure that the translations are equally available in the frontend and the backend
|
||||
|
@ -47,17 +53,19 @@ abstract class ExportBase implements QueryBase
|
|||
|
||||
/**
|
||||
* @param string $format
|
||||
* @param $path
|
||||
* @param null $path
|
||||
*
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws Exceptions\NoSuitableRendererException
|
||||
* @throws Exceptions\TaskException
|
||||
* @throws Exception
|
||||
* @throws NoSuitableRendererException
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
* @return string
|
||||
*/
|
||||
public function run(string $format = RendererBridge::FORMAT_CSV, $path = null): string
|
||||
{
|
||||
|
@ -82,31 +90,22 @@ abstract class ExportBase implements QueryBase
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $format
|
||||
*
|
||||
* @return ExportRenderer\RendererInterface
|
||||
* @throws Exceptions\NoSuitableRendererException
|
||||
* @throws NoSuitableRendererException
|
||||
*/
|
||||
public function getRenderer($format): ExportRenderer\RendererInterface
|
||||
public function getRenderer(string $format): RendererInterface
|
||||
{
|
||||
return $this->getRendererBridge()->getRenderer($format);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RendererBridge
|
||||
*/
|
||||
public function getRendererBridge(): RendererBridge
|
||||
{
|
||||
return oxNew(RendererBridge::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $format
|
||||
*
|
||||
* @return string
|
||||
* @throws Exceptions\NoSuitableRendererException
|
||||
* @throws NoSuitableRendererException
|
||||
*/
|
||||
public function getFileExtension($format): string
|
||||
public function getFileExtension(string $format): string
|
||||
{
|
||||
return $this->getRenderer($format)->getFileExtension();
|
||||
}
|
||||
|
@ -148,8 +147,10 @@ abstract class ExportBase implements QueryBase
|
|||
* @param array $query
|
||||
*
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getExportData(array $query): array
|
||||
{
|
||||
|
@ -165,7 +166,9 @@ abstract class ExportBase implements QueryBase
|
|||
);
|
||||
}
|
||||
|
||||
$rows = $this->d3GetDb()->getAll($queryString, $parameters);
|
||||
/** @var Connection $connection */
|
||||
$connection = ContainerFactory::getInstance()->getContainer()->get(ConnectionProviderInterface::class)->get();
|
||||
$rows = $connection->executeQuery($queryString, $parameters)->fetchAllAssociative();
|
||||
|
||||
if (count($rows) <= 0) {
|
||||
throw oxNew(
|
||||
|
@ -180,10 +183,7 @@ abstract class ExportBase implements QueryBase
|
|||
return [ $rows, $fieldNames ];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Input $input
|
||||
*/
|
||||
public function registerFormElement(Input $input)
|
||||
public function registerFormElement(Input $input): void
|
||||
{
|
||||
if ($input instanceof Radio || $input instanceof Checkbox) {
|
||||
$input->setTemplate('<p class="form-check">{{ input }} {{ label }}</p>');
|
||||
|
@ -213,12 +213,16 @@ abstract class ExportBase implements QueryBase
|
|||
|
||||
/**
|
||||
* @param string $format
|
||||
* @param $path
|
||||
* @param $path
|
||||
*
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws Exceptions\NoSuitableRendererException
|
||||
* @throws Exception
|
||||
* @throws NoSuitableRendererException
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
|
@ -227,13 +231,12 @@ abstract class ExportBase implements QueryBase
|
|||
{
|
||||
$content = $this->getContent($format);
|
||||
|
||||
/** @var $oFS d3filesystem */
|
||||
$oFS = $this->getFileSystem();
|
||||
if (is_null($path)) {
|
||||
$oFS->startDirectDownload($oFS->filterFilename($this->getExportFileName($format)), $content);
|
||||
} else {
|
||||
$filePath = $oFS->trailingslashit($path) . $oFS->filterFilename($this->getExportFileName($format));
|
||||
if (false === $oFS->createFile($filePath, $content, true)) {
|
||||
if (false === $oFS->createFile($filePath, $content)) {
|
||||
throw oxNew(ExportFileException::class, $filePath);
|
||||
}
|
||||
return $filePath;
|
||||
|
@ -242,19 +245,7 @@ abstract class ExportBase implements QueryBase
|
|||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DatabaseInterface|null
|
||||
* @throws DatabaseConnectionException
|
||||
*/
|
||||
protected function d3GetDb(): ?DatabaseInterface
|
||||
{
|
||||
return DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3filesystem|mixed
|
||||
*/
|
||||
protected function getFileSystem()
|
||||
protected function getFileSystem(): d3filesystem
|
||||
{
|
||||
return oxNew(d3filesystem::class);
|
||||
}
|
||||
|
@ -263,16 +254,16 @@ abstract class ExportBase implements QueryBase
|
|||
* @param string $format
|
||||
*
|
||||
* @return string
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws Exceptions\NoSuitableRendererException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
* @throws NoSuitableRendererException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getContent(string $format): string
|
||||
{
|
||||
[ $rows, $fieldNames ] = $this->getExportData($this->getQuery());
|
||||
|
||||
$content = $this->renderContent($rows, $fieldNames, $format);
|
||||
|
||||
return $content;
|
||||
return $this->renderContent($rows, $fieldNames, $format);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,16 +60,10 @@ class Csv implements RendererInterface
|
|||
|
||||
EncloseField::addTo($csv, "\t\x1f");
|
||||
|
||||
$sEncloser = $this->d3GetConfig()->getConfigParam('sGiCsvFieldEncloser');
|
||||
if (false == $sEncloser) {
|
||||
$sEncloser = '"';
|
||||
}
|
||||
$sEncloser = $this->d3GetConfig()->getConfigParam('sGiCsvFieldEncloser') ?? '"';
|
||||
$csv->setEnclosure($sEncloser);
|
||||
|
||||
$sDelimiter = $this->d3GetConfig()->getConfigParam('sCSVSign');
|
||||
if (false == $sDelimiter) {
|
||||
$sDelimiter = ';';
|
||||
}
|
||||
$sDelimiter = $this->d3GetConfig()->getConfigParam('sCSVSign') ?? ';';
|
||||
$csv->setDelimiter($sDelimiter);
|
||||
|
||||
return $csv;
|
||||
|
|
|
@ -45,7 +45,7 @@ class RendererBridge
|
|||
/**
|
||||
* @param RendererInterface $instance
|
||||
*/
|
||||
protected function translateRendererId(RendererInterface &$instance)
|
||||
protected function translateRendererId(RendererInterface &$instance): void
|
||||
{
|
||||
$instance = $instance->getTitleTranslationId();
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ class RendererBridge
|
|||
{
|
||||
$format = strtolower($format);
|
||||
|
||||
$rendererList = array_change_key_case($this->getRendererList(), CASE_LOWER);
|
||||
$rendererListTypes = array_keys(array_change_key_case($rendererList, CASE_LOWER));
|
||||
$rendererList = array_change_key_case($this->getRendererList());
|
||||
$rendererListTypes = array_keys(array_change_key_case($rendererList));
|
||||
|
||||
if (in_array($format, $rendererListTypes, true)) {
|
||||
return $rendererList[$format];
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* https://www.d3data.de
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||
* @link https://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
declare(strict_types=1);
|
||||
|
||||
$sLangName = 'Deutsch';
|
||||
|
||||
// -------------------------------
|
||||
// RESOURCE IDENTITFIER = STRING
|
||||
// -------------------------------
|
||||
|
||||
$aLang = include __DIR__."/../../de/d3DataWizard_translations.php";
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* https://www.d3data.de
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||
* @link https://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
declare(strict_types=1);
|
||||
|
||||
$sLangName = 'English';
|
||||
|
||||
// -------------------------------
|
||||
// RESOURCE IDENTITFIER = STRING
|
||||
// -------------------------------
|
||||
|
||||
$aLang = include __DIR__."/../../en/d3DataWizard_translations.php";
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
|
@ -14,12 +14,7 @@
|
|||
// @codeCoverageIgnoreStart
|
||||
declare(strict_types=1);
|
||||
|
||||
$sLangName = "Deutsch";
|
||||
// -------------------------------
|
||||
// RESOURCE IDENTITFIER = STRING
|
||||
// -------------------------------
|
||||
$aLang = [
|
||||
|
||||
return [
|
||||
//Navigation
|
||||
'charset' => 'UTF-8',
|
||||
'd3mxDataWizard' => '<i class="fas fa-fw fa-hat-wizard"></i> Data Wizard',
|
|
@ -14,11 +14,7 @@
|
|||
// @codeCoverageIgnoreStart
|
||||
declare(strict_types=1);
|
||||
|
||||
$sLangName = "English";
|
||||
// -------------------------------
|
||||
// RESOURCE IDENTITFIER = STRING
|
||||
// -------------------------------
|
||||
$aLang = [
|
||||
return [
|
||||
|
||||
//Navigation
|
||||
'charset' => 'UTF-8',
|
|
@ -25,21 +25,12 @@
|
|||
"GPL-3.0-or-later"
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.3",
|
||||
"oxid-esales/oxideshop-ce": "6.8 - 6.13",
|
||||
"php": "^8.0",
|
||||
"oxid-esales/oxideshop-ce": "7.0 - 7.0",
|
||||
"league/csv": "^9.0",
|
||||
"mathieuviossat/arraytotexttable": "^1.0",
|
||||
"form-manager/form-manager": "^6.1",
|
||||
"d3/modcfg": "^6.0"
|
||||
},
|
||||
"extra": {
|
||||
"oxideshop": {
|
||||
"blacklist-filter": [
|
||||
"*.md",
|
||||
"composer.json"
|
||||
],
|
||||
"target-directory": "d3/datawizard"
|
||||
}
|
||||
"d3/modcfg": "^7.0"
|
||||
},
|
||||
"suggest": {
|
||||
"d3/datawizardtasks": "useful example tasks for Data Wizard",
|
||||
|
@ -48,7 +39,7 @@
|
|||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"D3\\DataWizard\\": "../../../source/modules/d3/datawizard"
|
||||
"D3\\DataWizard\\": "./"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
modules:
|
||||
- d3modcfg_lib
|
19
metadata.php
19
metadata.php
|
@ -13,12 +13,11 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Metadata version
|
||||
*/
|
||||
use D3\DataWizard\Application\Model\Constants;
|
||||
|
||||
$sMetadataVersion = '2.1';
|
||||
|
||||
$sModuleId = 'd3datawizard';
|
||||
$sModuleId = Constants::OXID_MODULE_ID;
|
||||
$logo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="height:1em;width:1em">';
|
||||
|
||||
/**
|
||||
|
@ -32,7 +31,7 @@ $aModule = [
|
|||
'en' => '',
|
||||
],
|
||||
'thumbnail' => '',
|
||||
'version' => '2.1.1.0',
|
||||
'version' => '3.0.0.0',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
|
@ -43,11 +42,11 @@ $aModule = [
|
|||
'extend' => [],
|
||||
'events' => [],
|
||||
'templates' => [
|
||||
'd3ExportWizard.tpl' => 'd3/datawizard/Application/views/admin/tpl/d3ExportWizard.tpl',
|
||||
'd3ActionWizard.tpl' => 'd3/datawizard/Application/views/admin/tpl/d3ActionWizard.tpl',
|
||||
'd3Wizards.tpl' => 'd3/datawizard/Application/views/admin/tpl/inc/Wizards.tpl',
|
||||
'd3ExportSubmit.tpl' => 'd3/datawizard/Application/views/admin/tpl/inc/exportSubmit.tpl',
|
||||
'd3ActionSubmit.tpl' => 'd3/datawizard/Application/views/admin/tpl/inc/actionSubmit.tpl',
|
||||
'@' . Constants::OXID_MODULE_ID . '/admin/d3ExportWizard.tpl' => 'views/smarty/admin/tpl/d3ExportWizard.tpl',
|
||||
'@' . Constants::OXID_MODULE_ID . '/admin/d3ActionWizard.tpl' => 'views/smarty/admin/tpl/d3ActionWizard.tpl',
|
||||
'@' . Constants::OXID_MODULE_ID . '/admin/inc/d3Wizards.tpl' => 'views/smarty/admin/tpl/inc/Wizards.tpl',
|
||||
'@' . Constants::OXID_MODULE_ID . '/admin/inc/d3ExportSubmit.tpl' => 'views/smarty/admin/tpl/inc/exportSubmit.tpl',
|
||||
'@' . Constants::OXID_MODULE_ID . '/admin/inc/d3ActionSubmit.tpl' => 'views/smarty/admin/tpl/inc/actionSubmit.tpl',
|
||||
],
|
||||
'settings' => [
|
||||
[
|
||||
|
|
|
@ -22,7 +22,7 @@ use D3\DataWizard\Application\Model\Exceptions\DataWizardException;
|
|||
use D3\DataWizard\Application\Model\Exceptions\DebugException;
|
||||
use D3\DataWizard\tests\tools\d3TestAction;
|
||||
use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Config;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[{capture assign="d3dw_backgroundimage"}]linear-gradient(22.5deg, rgba(66, 66, 66, 0.02) 0%, rgba(66, 66, 66, 0.02) 11%,rgba(135, 135, 135, 0.02) 11%, rgba(135, 135, 135, 0.02) 24%,rgba(29, 29, 29, 0.02) 24%, rgba(29, 29, 29, 0.02) 38%,rgba(15, 15, 15, 0.02) 38%, rgba(15, 15, 15, 0.02) 50%,rgba(180, 180, 180, 0.02) 50%, rgba(180, 180, 180, 0.02) 77%,rgba(205, 205, 205, 0.02) 77%, rgba(205, 205, 205, 0.02) 100%),linear-gradient(67.5deg, rgba(10, 10, 10, 0.02) 0%, rgba(10, 10, 10, 0.02) 22%,rgba(52, 52, 52, 0.02) 22%, rgba(52, 52, 52, 0.02) 29%,rgba(203, 203, 203, 0.02) 29%, rgba(203, 203, 203, 0.02) 30%,rgba(69, 69, 69, 0.02) 30%, rgba(69, 69, 69, 0.02) 75%,rgba(231, 231, 231, 0.02) 75%, rgba(231, 231, 231, 0.02) 95%,rgba(138, 138, 138, 0.02) 95%, rgba(138, 138, 138, 0.02) 100%),linear-gradient(112.5deg, rgba(221, 221, 221, 0.02) 0%, rgba(221, 221, 221, 0.02) 17%,rgba(190, 190, 190, 0.02) 17%, rgba(190, 190, 190, 0.02) 39%,rgba(186, 186, 186, 0.02) 39%, rgba(186, 186, 186, 0.02) 66%,rgba(191, 191, 191, 0.02) 66%, rgba(191, 191, 191, 0.02) 68%,rgba(16, 16, 16, 0.02) 68%, rgba(16, 16, 16, 0.02) 70%,rgba(94, 94, 94, 0.02) 70%, rgba(94, 94, 94, 0.02) 100%),linear-gradient(90deg, #ffffff,#ffffff)[{/capture}]
|
||||
[{capture assign="d3dw_noitemmessageid"}]D3_DATAWIZARD_ERR_NOACTION_INSTALLED[{/capture}]
|
||||
|
||||
[{include file="d3Wizards.tpl" submit="d3ActionSubmit.tpl"}]
|
||||
[{include file="@d3datawizard/admin/inc/d3Wizards.tpl" submit="@d3datawizard/admin/inc/d3ActionSubmit.tpl"}]
|
|
@ -1,4 +1,4 @@
|
|||
[{capture assign="d3dw_backgroundimage"}]linear-gradient(339deg, rgba(47, 47, 47,0.02) 0%, rgba(47, 47, 47,0.02) 42%,transparent 42%, transparent 99%,rgba(17, 17, 17,0.02) 99%, rgba(17, 17, 17,0.02) 100%),linear-gradient(257deg, rgba(65, 65, 65,0.02) 0%, rgba(65, 65, 65,0.02) 11%,transparent 11%, transparent 92%,rgba(53, 53, 53,0.02) 92%, rgba(53, 53, 53,0.02) 100%),linear-gradient(191deg, rgba(5, 5, 5,0.02) 0%, rgba(5, 5, 5,0.02) 1%,transparent 1%, transparent 45%,rgba(19, 19, 19,0.02) 45%, rgba(19, 19, 19,0.02) 100%),linear-gradient(29deg, rgba(28, 28, 28,0.02) 0%, rgba(28, 28, 28,0.02) 33%,transparent 33%, transparent 40%,rgba(220, 220, 220,0.02) 40%, rgba(220, 220, 220,0.02) 100%),linear-gradient(90deg, rgb(255,255,255),rgb(255,255,255))[{/capture}]
|
||||
[{capture assign="d3dw_noitemmessageid"}]D3_DATAWIZARD_ERR_NOEXPORT_INSTALLED[{/capture}]
|
||||
|
||||
[{include file="d3Wizards.tpl" submit="d3ExportSubmit.tpl"}]
|
||||
[{include file="@d3datawizard/admin/inc/d3Wizards.tpl" submit="@d3datawizard/admin/inc/d3ExportSubmit.tpl"}]
|
|
@ -133,4 +133,4 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
[{include file="d3_cfg_mod_inc.tpl"}]
|
||||
[{include file="@d3modcfg_lib/admin/inc/inc.tpl"}]
|
Loading…
Reference in New Issue