Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
075df7fbfb | |||
3fe01aa227 | |||
16fbebb915 | |||
175bcdd956 | |||
532e5f6960 | |||
744efd5d59 |
@ -224,9 +224,7 @@ abstract class ExportBase implements QueryBase
|
||||
*/
|
||||
protected function executeExport(string $format, $path): string
|
||||
{
|
||||
[$rows, $fieldNames] = $this->getExportData($this->getQuery());
|
||||
|
||||
$content = $this->renderContent($rows, $fieldNames, $format);
|
||||
$content = $this->getContent( $format );
|
||||
|
||||
/** @var $oFS d3filesystem */
|
||||
$oFS = $this->getFileSystem();
|
||||
@ -259,4 +257,21 @@ abstract class ExportBase implements QueryBase
|
||||
{
|
||||
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}]
|
||||
[{oxscript add=$smarty.capture.d3script}]
|
||||
|
||||
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post" style="padding: 0;margin: 0;height:0;">
|
||||
[{$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">
|
||||
|
||||
<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()}]
|
||||
[{assign var="description" value=$item->getDescription()}]
|
||||
[{assign var="sectionlength" value="100"}]
|
||||
@ -104,25 +106,27 @@
|
||||
[{block name="exportSubmit"}]
|
||||
[{include file=$submit}]
|
||||
[{/block}]
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
[{/foreach}]
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
[{/foreach}]
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[{/foreach}]
|
||||
</div>
|
||||
[{else}]
|
||||
<div class="alert alert-primary" role="alert">
|
||||
[{oxmultilang ident=$d3dw_noitemmessageid}]
|
||||
</div>
|
||||
[{/if}]
|
||||
</form>
|
||||
[{/foreach}]
|
||||
</div>
|
||||
[{else}]
|
||||
<div class="alert alert-primary" role="alert">
|
||||
[{oxmultilang ident=$d3dw_noitemmessageid}]
|
||||
</div>
|
||||
[{/if}]
|
||||
|
||||
<div id="mask" class=""></div>
|
||||
<div id="popup2" class="d3loader-2">
|
||||
|
15
CHANGELOG.md
15
CHANGELOG.md
@ -1,5 +1,20 @@
|
||||
# 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)
|
||||
|
||||
#### 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:
|
||||
|
||||
```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".
|
||||
|
@ -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:
|
||||
|
||||
```bash
|
||||
php composer require d3/datawizard
|
||||
php composer require d3/datawizard:^1.0
|
||||
```
|
||||
|
||||
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
||||
|
@ -26,10 +26,11 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1",
|
||||
"oxid-esales/oxideshop-ce": "6.3 - 6.9",
|
||||
"oxid-esales/oxideshop-ce": "6.3 - 6.7",
|
||||
"league/csv": "^9.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": {
|
||||
"oxid-esales/oxideshop-ce": "6.8 - 6.9"
|
||||
|
@ -32,7 +32,7 @@ $aModule = [
|
||||
'en' => '',
|
||||
],
|
||||
'thumbnail' => '',
|
||||
'version' => '1.4.0.0',
|
||||
'version' => '1.5.0.1',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
|
@ -285,16 +285,12 @@ class ExportBaseTest extends d3ModCfgUnitTestCase
|
||||
/** @var d3TestExport|MockObject $modelMock */
|
||||
$modelMock = $this->getMockBuilder(d3TestExport::class)
|
||||
->onlyMethods([
|
||||
'getQuery',
|
||||
'getExportData',
|
||||
'renderContent',
|
||||
'getContent',
|
||||
'getFileSystem',
|
||||
'getExportFileName'
|
||||
])
|
||||
->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');
|
||||
$modelMock->expects($this->atLeastOnce())->method('getContent')->willReturn('some content');
|
||||
$modelMock->expects($this->atLeastOnce())->method('getFileSystem')->willReturn($fsMock);
|
||||
$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']]],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @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']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user