Vergelijk commits
6 Commits
Auteur | SHA1 | Datum |
---|---|---|
Daniel Seifert | 075df7fbfb | |
Daniel Seifert | 3fe01aa227 | |
Daniel Seifert | 16fbebb915 | |
Daniel Seifert | 175bcdd956 | |
Daniel Seifert | 532e5f6960 | |
Daniel Seifert | 744efd5d59 |
|
@ -224,9 +224,7 @@ abstract class ExportBase implements QueryBase
|
||||||
*/
|
*/
|
||||||
protected function executeExport(string $format, $path): string
|
protected function executeExport(string $format, $path): string
|
||||||
{
|
{
|
||||||
[$rows, $fieldNames] = $this->getExportData($this->getQuery());
|
$content = $this->getContent( $format );
|
||||||
|
|
||||||
$content = $this->renderContent($rows, $fieldNames, $format);
|
|
||||||
|
|
||||||
/** @var $oFS d3filesystem */
|
/** @var $oFS d3filesystem */
|
||||||
$oFS = $this->getFileSystem();
|
$oFS = $this->getFileSystem();
|
||||||
|
@ -259,4 +257,21 @@ abstract class ExportBase implements QueryBase
|
||||||
{
|
{
|
||||||
return oxNew(d3filesystem::class);
|
return oxNew(d3filesystem::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $format
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws DatabaseConnectionException
|
||||||
|
* @throws DatabaseErrorException
|
||||||
|
* @throws Exceptions\NoSuitableRendererException
|
||||||
|
*/
|
||||||
|
public function getContent( string $format ): string
|
||||||
|
{
|
||||||
|
[ $rows, $fieldNames ] = $this->getExportData( $this->getQuery() );
|
||||||
|
|
||||||
|
$content = $this->renderContent( $rows, $fieldNames, $format );
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -48,36 +48,38 @@
|
||||||
[{/strip}][{/capture}]
|
[{/strip}][{/capture}]
|
||||||
[{oxscript add=$smarty.capture.d3script}]
|
[{oxscript add=$smarty.capture.d3script}]
|
||||||
|
|
||||||
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post" style="padding: 0;margin: 0;height:0;">
|
[{assign var="groups" value=$oView->getGroups()}]
|
||||||
[{$oViewConf->getHiddenSid()}]
|
[{if $groups|@count}]
|
||||||
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
|
<div id="accordion">
|
||||||
<input type="hidden" name="fnc" value="runTask">
|
[{foreach from=$oView->getGroups() item="group"}]
|
||||||
<input type="hidden" name="taskid" id="taskid" value="">
|
<div class="card mb-2">
|
||||||
<input type="hidden" name="format" id="format" value="CSV">
|
<div class="card-header p-1" id="heading[{$group}]">
|
||||||
|
<h4 class="mb-0">
|
||||||
|
<span class="btn p-1" data-toggle="collapse" data-target="#collapse[{$group}]" aria-expanded="false" aria-controls="collapse[{$group}]">
|
||||||
|
[{oxmultilang ident=$group}]
|
||||||
|
</span>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="collapse[{$group}]" class="collapse" aria-labelledby="heading[{$group}]" data-parent="#accordion">
|
||||||
|
<div class="card-body pb-0">
|
||||||
|
<div class="row">
|
||||||
|
[{foreach from=$oView->getGroupTasks($group) key="id" item="item"}]
|
||||||
|
<div class="col-sm-6 col-md-4 col-lg-3 pb-4">
|
||||||
|
<div class="card">
|
||||||
|
<h5 class="card-header">
|
||||||
|
[{$item->getTitle()}]
|
||||||
|
</h5>
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post">
|
||||||
|
[{$oViewConf->getHiddenSid()}]
|
||||||
|
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
|
||||||
|
<input type="hidden" name="fnc" value="runTask">
|
||||||
|
<input type="hidden" name="taskid" id="taskid" value="">
|
||||||
|
<input type="hidden" name="format" id="format" value="CSV">
|
||||||
|
|
||||||
[{assign var="groups" value=$oView->getGroups()}]
|
|
||||||
[{if $groups|@count}]
|
|
||||||
<div id="accordion">
|
|
||||||
[{foreach from=$oView->getGroups() item="group"}]
|
|
||||||
<div class="card mb-2">
|
|
||||||
<div class="card-header p-1" id="heading[{$group}]">
|
|
||||||
<h4 class="mb-0">
|
|
||||||
<span class="btn p-1" data-toggle="collapse" data-target="#collapse[{$group}]" aria-expanded="false" aria-controls="collapse[{$group}]">
|
|
||||||
[{oxmultilang ident=$group}]
|
|
||||||
</span>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="collapse[{$group}]" class="collapse" aria-labelledby="heading[{$group}]" data-parent="#accordion">
|
|
||||||
<div class="card-body pb-0">
|
|
||||||
<div class="row">
|
|
||||||
[{foreach from=$oView->getGroupTasks($group) key="id" item="item"}]
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 pb-4">
|
|
||||||
<div class="card">
|
|
||||||
<h5 class="card-header">
|
|
||||||
[{$item->getTitle()}]
|
|
||||||
</h5>
|
|
||||||
<div class="card-body">
|
|
||||||
[{if $item->getDescription()}]
|
[{if $item->getDescription()}]
|
||||||
[{assign var="description" value=$item->getDescription()}]
|
[{assign var="description" value=$item->getDescription()}]
|
||||||
[{assign var="sectionlength" value="100"}]
|
[{assign var="sectionlength" value="100"}]
|
||||||
|
@ -104,25 +106,27 @@
|
||||||
[{block name="exportSubmit"}]
|
[{block name="exportSubmit"}]
|
||||||
[{include file=$submit}]
|
[{include file=$submit}]
|
||||||
[{/block}]
|
[{/block}]
|
||||||
</div>
|
|
||||||
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
[{/foreach}]
|
</div>
|
||||||
</div>
|
[{/foreach}]
|
||||||
|
|
||||||
<div class="clear"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
[{/foreach}]
|
[{/foreach}]
|
||||||
</div>
|
</div>
|
||||||
[{else}]
|
[{else}]
|
||||||
<div class="alert alert-primary" role="alert">
|
<div class="alert alert-primary" role="alert">
|
||||||
[{oxmultilang ident=$d3dw_noitemmessageid}]
|
[{oxmultilang ident=$d3dw_noitemmessageid}]
|
||||||
</div>
|
</div>
|
||||||
[{/if}]
|
[{/if}]
|
||||||
</form>
|
|
||||||
|
|
||||||
<div id="mask" class=""></div>
|
<div id="mask" class=""></div>
|
||||||
<div id="popup2" class="d3loader-2">
|
<div id="popup2" class="d3loader-2">
|
||||||
|
|
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -1,5 +1,20 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.5.0.1 (2023-03-22)
|
||||||
|
### Fixed
|
||||||
|
- wrong cascaded HTML elements
|
||||||
|
|
||||||
|
## 1.5.0.0 (2021-12-21)
|
||||||
|
|
||||||
|
#### Added
|
||||||
|
- add tests
|
||||||
|
|
||||||
|
#### Changed
|
||||||
|
- adjust to CLI extension which can export to STDOUT
|
||||||
|
- restrict dependencies to OXID 6.2, use 2.x for newer installations
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 1.4.0.0 (2021-11-11)
|
## 1.4.0.0 (2021-11-11)
|
||||||
|
|
||||||
#### Added
|
#### Added
|
||||||
|
|
|
@ -18,7 +18,7 @@ Sample exports are included in the package d3/datawizardtasks. These are intende
|
||||||
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:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
php composer require d3/datawizard
|
php composer require d3/datawizard:^1.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Activate the module in the admin area of the shop in "Extensions -> Modules".
|
Activate the module in the admin area of the shop in "Extensions -> Modules".
|
||||||
|
|
|
@ -18,7 +18,7 @@ Im Paket d3/datawizardtasks sind Beispielexporte enthalten. Diese sollen als Imp
|
||||||
Auf der Konsole im Shoproot (oberhalb von source und vendor) folgenden Befehl ausführen:
|
Auf der Konsole im Shoproot (oberhalb von source und vendor) folgenden Befehl ausführen:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
php composer require d3/datawizard
|
php composer require d3/datawizard:^1.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
||||||
|
|
|
@ -26,10 +26,11 @@
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1",
|
"php": ">=7.1",
|
||||||
"oxid-esales/oxideshop-ce": "6.3 - 6.9",
|
"oxid-esales/oxideshop-ce": "6.3 - 6.7",
|
||||||
"league/csv": "^9.0",
|
"league/csv": "^9.0",
|
||||||
"mathieuviossat/arraytotexttable": "^1.0",
|
"mathieuviossat/arraytotexttable": "^1.0",
|
||||||
"form-manager/form-manager": "^5.1 || ^6.1"
|
"form-manager/form-manager": "^5.1 || ^6.1",
|
||||||
|
"d3/modcfg": "^5.3.6.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"oxid-esales/oxideshop-ce": "6.8 - 6.9"
|
"oxid-esales/oxideshop-ce": "6.8 - 6.9"
|
||||||
|
|
|
@ -32,7 +32,7 @@ $aModule = [
|
||||||
'en' => '',
|
'en' => '',
|
||||||
],
|
],
|
||||||
'thumbnail' => '',
|
'thumbnail' => '',
|
||||||
'version' => '1.4.0.0',
|
'version' => '1.5.0.1',
|
||||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||||
'email' => 'support@shopmodule.com',
|
'email' => 'support@shopmodule.com',
|
||||||
'url' => 'https://www.oxidmodule.com/',
|
'url' => 'https://www.oxidmodule.com/',
|
||||||
|
|
|
@ -285,16 +285,12 @@ class ExportBaseTest extends d3ModCfgUnitTestCase
|
||||||
/** @var d3TestExport|MockObject $modelMock */
|
/** @var d3TestExport|MockObject $modelMock */
|
||||||
$modelMock = $this->getMockBuilder(d3TestExport::class)
|
$modelMock = $this->getMockBuilder(d3TestExport::class)
|
||||||
->onlyMethods([
|
->onlyMethods([
|
||||||
'getQuery',
|
'getContent',
|
||||||
'getExportData',
|
|
||||||
'renderContent',
|
|
||||||
'getFileSystem',
|
'getFileSystem',
|
||||||
'getExportFileName'
|
'getExportFileName'
|
||||||
])
|
])
|
||||||
->getMock();
|
->getMock();
|
||||||
$modelMock->expects($this->atLeastOnce())->method('getQuery')->willReturn(['SELECT 1', ['arg1', 'arg2']]);
|
$modelMock->expects($this->atLeastOnce())->method('getContent')->willReturn('some content');
|
||||||
$modelMock->expects($this->atLeastOnce())->method('getExportData')->willReturn([[1, 2], ['field1', 'field2']]);
|
|
||||||
$modelMock->expects($this->atLeastOnce())->method('renderContent')->willReturn('some content');
|
|
||||||
$modelMock->expects($this->atLeastOnce())->method('getFileSystem')->willReturn($fsMock);
|
$modelMock->expects($this->atLeastOnce())->method('getFileSystem')->willReturn($fsMock);
|
||||||
$modelMock->expects($this->atLeastOnce())->method('getExportFileName')->willReturn('exportFileName');
|
$modelMock->expects($this->atLeastOnce())->method('getExportFileName')->willReturn('exportFileName');
|
||||||
|
|
||||||
|
@ -604,4 +600,35 @@ class ExportBaseTest extends d3ModCfgUnitTestCase
|
||||||
'fulfilled SELECT' => [' SELECT 1', false, [['field1' => 'content1', 'field2' => 'content2']]],
|
'fulfilled SELECT' => [' SELECT 1', false, [['field1' => 'content1', 'field2' => 'content2']]],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \D3\DataWizard\Application\Model\ExportBase::getContent
|
||||||
|
* @test
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
|
public function canGetContent()
|
||||||
|
{
|
||||||
|
/** @var d3TestExport|MockObject $modelMock */
|
||||||
|
$modelMock = $this->getMockBuilder(d3TestExport::class)
|
||||||
|
->onlyMethods([
|
||||||
|
'getQuery',
|
||||||
|
'getExportData',
|
||||||
|
'renderContent'
|
||||||
|
])
|
||||||
|
->getMock();
|
||||||
|
$modelMock->expects($this->atLeastOnce())->method('getQuery')->willReturn(['SELECT 1', ['arg1', 'arg2']]);
|
||||||
|
$modelMock->expects($this->atLeastOnce())->method('getExportData')->willReturn([[1, 2], ['field1', 'field2']]);
|
||||||
|
$modelMock->expects($this->atLeastOnce())->method('renderContent')->willReturn('some content');
|
||||||
|
|
||||||
|
$this->_oModel = $modelMock;
|
||||||
|
|
||||||
|
$this->assertSame(
|
||||||
|
'some content',
|
||||||
|
$this->callMethod(
|
||||||
|
$this->_oModel,
|
||||||
|
'getContent',
|
||||||
|
['CSV']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
Laden…
Verwijs in nieuw issue