Merge remote-tracking branch 'remotes/origin/Branch_dev_1.x_cli' into rel_1.x
This commit is contained in:
commit
9e9a0fdd4c
@ -25,7 +25,7 @@ use OxidEsales\Eshop\Core\Registry;
|
|||||||
class FixArtextendsItems extends ActionBase
|
class FixArtextendsItems extends ActionBase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* fehlende oxartextends-Einträge nachtragen
|
* fehlende oxartextends-Einträge nachtragen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +16,6 @@ declare(strict_types=1);
|
|||||||
namespace D3\DataWizard\Application\Model\Exceptions;
|
namespace D3\DataWizard\Application\Model\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
class DebugException extends DataWizardException
|
class DebugException extends DataWizardException
|
||||||
|
32
Application/Model/Exceptions/ExportFileException.php
Normal file
32
Application/Model/Exceptions/ExportFileException.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace D3\DataWizard\Application\Model\Exceptions;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
|
class ExportFileException extends DataWizardException
|
||||||
|
{
|
||||||
|
public function __construct($sMessage = "not set", $iCode = 0, Exception $previous = null )
|
||||||
|
{
|
||||||
|
$sMessage = sprintf(
|
||||||
|
Registry::getLang()->translateString('D3_DATAWIZARD_ERR_EXPORTFILEERROR'),
|
||||||
|
$sMessage
|
||||||
|
);
|
||||||
|
|
||||||
|
parent::__construct($sMessage, $iCode, $previous );
|
||||||
|
}
|
||||||
|
}
|
@ -18,13 +18,20 @@ namespace D3\DataWizard\Application\Model\Exceptions;
|
|||||||
use D3\DataWizard\Application\Model\QueryBase;
|
use D3\DataWizard\Application\Model\QueryBase;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FormManager\Inputs\Input;
|
use FormManager\Inputs\Input;
|
||||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
|
||||||
|
|
||||||
class InputUnvalidException extends DataWizardException
|
class InputUnvalidException extends DataWizardException
|
||||||
{
|
{
|
||||||
/** @var QueryBase */
|
/** @var QueryBase */
|
||||||
public $task;
|
public $task;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InputUnvalidException constructor.
|
||||||
|
* @param QueryBase $task
|
||||||
|
* @param Input $inputElement
|
||||||
|
* @param int $iCode
|
||||||
|
* @param Exception|null $previous
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
public function __construct( QueryBase $task, Input $inputElement, $iCode = 0, Exception $previous = null )
|
public function __construct( QueryBase $task, Input $inputElement, $iCode = 0, Exception $previous = null )
|
||||||
{
|
{
|
||||||
$messages = [];
|
$messages = [];
|
||||||
|
@ -16,7 +16,6 @@ declare(strict_types=1);
|
|||||||
namespace D3\DataWizard\Application\Model\Exceptions;
|
namespace D3\DataWizard\Application\Model\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
class NoSuitableRendererException extends DataWizardException
|
class NoSuitableRendererException extends DataWizardException
|
||||||
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\DataWizard\Application\Model;
|
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\InputUnvalidException;
|
||||||
use D3\DataWizard\Application\Model\ExportRenderer\RendererBridge;
|
use D3\DataWizard\Application\Model\ExportRenderer\RendererBridge;
|
||||||
use D3\ModCfg\Application\Model\d3filesystem;
|
use D3\ModCfg\Application\Model\d3filesystem;
|
||||||
@ -44,6 +45,7 @@ abstract class ExportBase implements QueryBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $format
|
* @param string $format
|
||||||
|
* @param $path
|
||||||
*
|
*
|
||||||
* @throws DBALException
|
* @throws DBALException
|
||||||
* @throws DatabaseConnectionException
|
* @throws DatabaseConnectionException
|
||||||
@ -53,8 +55,9 @@ abstract class ExportBase implements QueryBase
|
|||||||
* @throws StandardException
|
* @throws StandardException
|
||||||
* @throws d3ShopCompatibilityAdapterException
|
* @throws d3ShopCompatibilityAdapterException
|
||||||
* @throws d3_cfg_mod_exception
|
* @throws d3_cfg_mod_exception
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function run($format = RendererBridge::FORMAT_CSV)
|
public function run( string $format = RendererBridge::FORMAT_CSV, $path = null): string
|
||||||
{
|
{
|
||||||
if ($this->hasFormElements()) {
|
if ($this->hasFormElements()) {
|
||||||
/** @var Input $element */
|
/** @var Input $element */
|
||||||
@ -70,11 +73,18 @@ abstract class ExportBase implements QueryBase
|
|||||||
$content = $this->renderContent($rows, $fieldNames, $format);
|
$content = $this->renderContent($rows, $fieldNames, $format);
|
||||||
|
|
||||||
/** @var $oFS d3filesystem */
|
/** @var $oFS d3filesystem */
|
||||||
$oFS = oxNew(d3filesystem::class);
|
$oFS = oxNew( d3filesystem::class );
|
||||||
$oFS->startDirectDownload(
|
if (is_null($path)) {
|
||||||
$oFS->filterFilename($this->getExportFileName($format)),
|
$oFS->startDirectDownload( $oFS->filterFilename( $this->getExportFileName( $format ) ), $content );
|
||||||
$content
|
} else {
|
||||||
);
|
$filePath = $oFS->trailingslashit($path).$oFS->filterFilename( $this->getExportFileName( $format ) );
|
||||||
|
if (false === $oFS->createFile($filePath, $content,true)) {
|
||||||
|
throw oxNew(ExportFileException::class, $filePath);
|
||||||
|
}
|
||||||
|
return $filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,19 +22,32 @@ class RendererBridge
|
|||||||
const FORMAT_CSV = 'CSV';
|
const FORMAT_CSV = 'CSV';
|
||||||
const FORMAT_PRETTY = 'Pretty';
|
const FORMAT_PRETTY = 'Pretty';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getRendererList(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
self::FORMAT_CSV => oxNew(Csv::class),
|
||||||
|
self::FORMAT_PRETTY => oxNew(Pretty::class)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $format
|
* @param string $format
|
||||||
*
|
*
|
||||||
* @throws NoSuitableRendererException
|
|
||||||
* @return RendererInterface
|
* @return RendererInterface
|
||||||
|
* @throws NoSuitableRendererException
|
||||||
*/
|
*/
|
||||||
public function getRenderer($format = self::FORMAT_CSV): RendererInterface
|
public function getRenderer(string $format = self::FORMAT_CSV): RendererInterface
|
||||||
{
|
{
|
||||||
switch ($format) {
|
$format = strtolower($format);
|
||||||
case self::FORMAT_CSV:
|
|
||||||
return oxNew(Csv::class);
|
$rendererList = array_change_key_case($this->getRendererList(), CASE_LOWER);
|
||||||
case self::FORMAT_PRETTY:
|
$rendererListTypes = array_keys(array_change_key_case($rendererList, CASE_LOWER));
|
||||||
return oxNew(Pretty::class);
|
|
||||||
|
if (in_array($format, $rendererListTypes, true)) {
|
||||||
|
return $rendererList[$format];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var NoSuitableRendererException $e */
|
/** @var NoSuitableRendererException $e */
|
||||||
|
@ -24,7 +24,7 @@ use OxidEsales\Eshop\Core\Registry;
|
|||||||
class InactiveCategories extends ExportBase
|
class InactiveCategories extends ExportBase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Kategorien -deaktiviert, mit aktiven Artikel
|
* Kategorien -deaktiviert, mit aktiven Artikeln
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,8 +48,9 @@ $aLang = array(
|
|||||||
'D3_DATAWIZARD_ERR_NOEXPORT_INSTALLED' => 'Es sind keine Exporte installiert oder aktiviert.',
|
'D3_DATAWIZARD_ERR_NOEXPORT_INSTALLED' => 'Es sind keine Exporte installiert oder aktiviert.',
|
||||||
'D3_DATAWIZARD_ERR_NOEXPORTCONTENT' => 'Export ist leer, kein Inhalt zum Download verfügbar',
|
'D3_DATAWIZARD_ERR_NOEXPORTCONTENT' => 'Export ist leer, kein Inhalt zum Download verfügbar',
|
||||||
'D3_DATAWIZARD_ERR_NOSUITABLERENDERER' => 'kein Renderer für Format "%1$s" registriert',
|
'D3_DATAWIZARD_ERR_NOSUITABLERENDERER' => 'kein Renderer für Format "%1$s" registriert',
|
||||||
|
'D3_DATAWIZARD_ERR_EXPORTFILEERROR' => 'Exportdatei "%1$s" kann nicht angelegt werden',
|
||||||
|
|
||||||
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES' => 'deaktivierte Kategorien, mit aktiven Artikel',
|
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES' => 'deaktivierte Kategorien, mit aktiven Artikeln',
|
||||||
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TREE' => 'Baum',
|
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TREE' => 'Baum',
|
||||||
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TITLE' => 'Titel',
|
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TITLE' => 'Titel',
|
||||||
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_COUNT' => 'Anzahl',
|
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_COUNT' => 'Anzahl',
|
||||||
|
22
README.en.md
22
README.en.md
@ -10,8 +10,6 @@ All exports are grouped together for better clarity.
|
|||||||
|
|
||||||
Sample exports are included in the scope of delivery. These are intended to serve as an implementation reference for individual exports. The display of the sample exports can be deactivated in the basic module settings.
|
Sample exports are included in the scope of delivery. These are intended to serve as an implementation reference for individual exports. The display of the sample exports can be deactivated in the basic module settings.
|
||||||
|
|
||||||
Translated with www.DeepL.com/Translator (free version)
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
In the console in the shop root (above source and vendor), execute the following command:
|
In the console in the shop root (above source and vendor), execute the following command:
|
||||||
@ -20,9 +18,9 @@ In the console in the shop root (above source and vendor), execute the following
|
|||||||
php composer require d3/datawizard
|
php composer require d3/datawizard
|
||||||
```
|
```
|
||||||
|
|
||||||
Activate in the admin area of the shop under "Extensions -> Modules".
|
Activate the module in the admin area of the shop in "Extensions -> Modules".
|
||||||
|
|
||||||
# Extensibility
|
## Extensibility
|
||||||
|
|
||||||
The module represents the technical basic framework of the exports and does not claim to be complete. In order to adapt the scope to individual requirements, the following extensions are prepared:
|
The module represents the technical basic framework of the exports and does not claim to be complete. In order to adapt the scope to individual requirements, the following extensions are prepared:
|
||||||
|
|
||||||
@ -32,24 +30,24 @@ The module represents the technical basic framework of the exports and does not
|
|||||||
|
|
||||||
Independently of this, all extension options are available that the OXID Shop provides for modules.
|
Independently of this, all extension options are available that the OXID Shop provides for modules.
|
||||||
|
|
||||||
## Add exports
|
### Add exports
|
||||||
|
|
||||||
### Define export
|
#### Define export
|
||||||
|
|
||||||
Each export is defined in a separate class. This export class must extend the class `D3\DataWizard\Application\Model\ExportBase`. All necessary functions are predefined in it. The following methods are available:
|
Each export is defined in a separate class. This export class must extend the class `D3\DataWizard\Application\Model\ExportBase`. All necessary functions are predefined in it. The following methods are available:
|
||||||
|
|
||||||
#### mandatory method calls:
|
##### mandatory method calls:
|
||||||
- getTitle() - defines the title in the admin area and the base of the later export file name.
|
- getTitle() - defines the title in the admin area and the base of the later export file name.
|
||||||
- getQuery() - contains the query as a prepared statement that defines the data to be exported
|
- getQuery() - contains the query as a prepared statement that defines the data to be exported
|
||||||
|
|
||||||
#### optional method calls:
|
##### optional method calls:
|
||||||
- getDescription() - contains a short additional description of the export, this will be shown in the admin area
|
- getDescription() - contains a short additional description of the export, this will be shown in the admin area
|
||||||
- getButtonText() - defines the text of the submit button in the admin area
|
- getButtonText() - defines the text of the submit button in the admin area
|
||||||
- getExportFilenameBase() - defines the base of the later export filename
|
- getExportFilenameBase() - defines the base of the later export filename
|
||||||
- executeQuery() - returns the compiled export data
|
- executeQuery() - returns the compiled export data
|
||||||
- further methods, the adaptation of which, however, can lead to changed module behaviour and should therefore only be changed with caution
|
- further methods, the adaptation of which, however, can lead to changed module behaviour and should therefore only be changed with caution
|
||||||
|
|
||||||
### Register exports
|
#### Register exports
|
||||||
|
|
||||||
In order to be able to use the created export in the module, it must be registered. For this purpose there is the class `D3\DataWizard\Application\Model\Configuration`. This is to be overloaded with the possibilities of the OXID shop and the method `configure()` contained therein is to be supplemented. The following call is available for registering an export:
|
In order to be able to use the created export in the module, it must be registered. For this purpose there is the class `D3\DataWizard\Application\Model\Configuration`. This is to be overloaded with the possibilities of the OXID shop and the method `configure()` contained therein is to be supplemented. The following call is available for registering an export:
|
||||||
|
|
||||||
@ -64,7 +62,7 @@ The first parameter contains the language identifier for the export group. Typic
|
|||||||
See [CHANGELOG](CHANGELOG.md) for further informations.
|
See [CHANGELOG](CHANGELOG.md) for further informations.
|
||||||
|
|
||||||
## Licence of this software (d3/datawizard)
|
## Licence of this software (d3/datawizard)
|
||||||
(status: 06.05.2021)
|
(status: 2021-05-06)
|
||||||
|
|
||||||
```
|
```
|
||||||
Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
@ -92,7 +90,7 @@ Gradients available on the site are free to use on personal and commercial proje
|
|||||||
The following software packages are not part of this module. However, they are required for use. The linked packages are under the following licences:
|
The following software packages are not part of this module. However, they are required for use. The linked packages are under the following licences:
|
||||||
|
|
||||||
### league/csv [MIT]
|
### league/csv [MIT]
|
||||||
(https://github.com/thephpleague/csv - status: 06.05.2021)
|
(https://github.com/thephpleague/csv - status: 2021-05-06)
|
||||||
|
|
||||||
```
|
```
|
||||||
Copyright (c) 2013-2017 ignace nyamagana butera
|
Copyright (c) 2013-2017 ignace nyamagana butera
|
||||||
@ -116,7 +114,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
```
|
```
|
||||||
|
|
||||||
### mathieuviossat/arraytotexttable [MIT]
|
### mathieuviossat/arraytotexttable [MIT]
|
||||||
(https://github.com/viossat/arraytotexttable - status: 06.05.2021)
|
(https://github.com/viossat/arraytotexttable - status: 2021-05-06)
|
||||||
|
|
||||||
```
|
```
|
||||||
Copyright (c) 2015 Mathieu Viossat
|
Copyright (c) 2015 Mathieu Viossat
|
||||||
|
@ -18,6 +18,8 @@ Auf der Konsole im Shoproot (oberhalb von source und vendor) folgenden Befehl au
|
|||||||
php composer require d3/datawizard
|
php composer require d3/datawizard
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
||||||
|
|
||||||
## Erweiterbarkeit
|
## Erweiterbarkeit
|
||||||
|
|
||||||
Das Modul stellt das technische Grundgerüst der Exporte dar und erhebt keinen Anspruch auf Vollständigkeit. Um den Umfang an die individuellen Anforderungen anzupassen, sind folgende Erweiterungen vorbereitet:
|
Das Modul stellt das technische Grundgerüst der Exporte dar und erhebt keinen Anspruch auf Vollständigkeit. Um den Umfang an die individuellen Anforderungen anzupassen, sind folgende Erweiterungen vorbereitet:
|
||||||
|
Loading…
Reference in New Issue
Block a user