move tasks from Data Wizard core
This commit is contained in:
parent
de37471614
commit
6f5eb5f0ad
87
Application/Model/Actions/FixArtextendsItems.php
Normal file
87
Application/Model/Actions/FixArtextendsItems.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?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\DataWizardTasks\Application\Model\Actions;
|
||||
|
||||
use D3\DataWizard\Application\Model\ActionBase;
|
||||
use OxidEsales\Eshop\Core\Model\BaseModel;
|
||||
use OxidEsales\Eshop\Core\Model\MultiLanguageModel;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class FixArtextendsItems extends ActionBase
|
||||
{
|
||||
/**
|
||||
* fehlende oxartextends-Einträge nachtragen
|
||||
*/
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle() : string
|
||||
{
|
||||
return Registry::getLang()->translateString('D3_DATAWIZARDTASKS_ACTIONS_FIXARTEXTENDSITEMS');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getQuery() : array
|
||||
{
|
||||
$aDefaultValueFields = array(
|
||||
'oxtimestamp' => "''",
|
||||
);
|
||||
|
||||
$aNonArtExtendsFields = array(
|
||||
'oxid' => 'oxarticles.oxid',
|
||||
);
|
||||
|
||||
$aArtExtendsFields = array_fill_keys($this->getArtExtendsFields(), "''");
|
||||
$aMergedFields = array_merge($aNonArtExtendsFields, $aArtExtendsFields);
|
||||
$aQueryFields = array_diff_key($aMergedFields, $aDefaultValueFields);
|
||||
|
||||
$sArtExtendsFields = implode(', ', array_keys($aQueryFields));
|
||||
|
||||
$select = "SELECT ".implode(', ', $aQueryFields).
|
||||
" FROM oxarticles".
|
||||
" LEFT JOIN oxartextends AS arx ON oxarticles.oxid = arx.oxid".
|
||||
" WHERE arx.oxid IS NULL";
|
||||
|
||||
$query = "INSERT INTO oxartextends ($sArtExtendsFields) ".
|
||||
$select;
|
||||
|
||||
return [$query, []];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getArtExtendsFields(): array
|
||||
{
|
||||
/** @var $oArtExtends MultiLanguageModel */
|
||||
$oArtExtends = oxNew(BaseModel::class);
|
||||
$oArtExtends->init('oxartextends', false);
|
||||
|
||||
$aFieldNames = $oArtExtends->getFieldNames();
|
||||
|
||||
if (false == $aFieldNames) {
|
||||
$oArtExtends->disableLazyLoading();
|
||||
$aFieldNames = $oArtExtends->getFieldNames();
|
||||
}
|
||||
|
||||
unset($aFieldNames[array_search('oxid', $aFieldNames)]);
|
||||
|
||||
return $aFieldNames;
|
||||
}
|
||||
}
|
75
Application/Model/Exports/InactiveCategories.php
Normal file
75
Application/Model/Exports/InactiveCategories.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace D3\DataWizardTasks\Application\Model\Exports;
|
||||
|
||||
use D3\DataWizard\Application\Model\ExportBase;
|
||||
use OxidEsales\Eshop\Application\Model\Article;
|
||||
use OxidEsales\Eshop\Application\Model\Category;
|
||||
use OxidEsales\Eshop\Application\Model\Object2Category;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class InactiveCategories extends ExportBase
|
||||
{
|
||||
/**
|
||||
* Kategorien -deaktiviert, mit aktiven Artikeln
|
||||
*/
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle() : string
|
||||
{
|
||||
return Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getQuery() : array
|
||||
{
|
||||
$categoryTableName = oxNew(Category::class)->getCoreTableName();
|
||||
$object2categoryTableName = oxNew(Object2Category::class)->getCoreTableName();
|
||||
$articleTableName = oxNew(Article::class)->getCoreTableName();
|
||||
|
||||
$treeTitle = Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES_TREE');
|
||||
$titleTitle = Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES_TITLE');
|
||||
$countTitle = Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES_COUNT');
|
||||
|
||||
return [
|
||||
"SELECT
|
||||
oc.OXID,
|
||||
oc.OXSHOPID,
|
||||
oc.oxtitle as :titleTitle,
|
||||
(
|
||||
SELECT GROUP_CONCAT(oxtitle ORDER BY oxleft ASC SEPARATOR ' > ')
|
||||
from ".$categoryTableName."
|
||||
WHERE OXLEFT < oc.oxleft AND OXRIGHT > oc.oxright AND OXROOTID = oc.OXROOTID AND OXSHOPID = oc.OXSHOPID
|
||||
) as :treeTitle,
|
||||
COUNT(oa.oxid) as :countTitle
|
||||
FROM ".$categoryTableName." oc
|
||||
LEFT JOIN ".$object2categoryTableName." o2c ON oc.OXID = o2c.OXCATNID
|
||||
LEFT JOIN ".$articleTableName." oa ON o2c.OXOBJECTID = oa.OXID
|
||||
WHERE oc.OXACTIVE = :categoryActive AND oa.OXACTIVE = :articleActive
|
||||
GROUP BY oc.oxid
|
||||
ORDER BY oc.oxleft ASC",
|
||||
[
|
||||
'categoryActive' => 0,
|
||||
'articleActive' => 1,
|
||||
'titleTitle' => $titleTitle,
|
||||
'treeTitle' => $treeTitle,
|
||||
'countTitle' => $countTitle
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
96
Application/Model/Exports/KeyFigures.php
Normal file
96
Application/Model/Exports/KeyFigures.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace D3\DataWizardTasks\Application\Model\Exports;
|
||||
|
||||
use D3\DataWizard\Application\Model\ExportBase;
|
||||
use FormManager\Inputs\Date;
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use FormManager\Factory as FormFactory;
|
||||
|
||||
class KeyFigures extends ExportBase
|
||||
{
|
||||
const STARTDATE_NAME = 'startdate';
|
||||
const ENDDATE_NAME = 'enddate';
|
||||
|
||||
/**
|
||||
* Shopkennzahlen
|
||||
*/
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
/** @var Date $startDate */
|
||||
$startDateValue = Registry::getRequest()->getRequestEscapedParameter(self::STARTDATE_NAME);
|
||||
$startDate = FormFactory::date(
|
||||
Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_FIELD_STARTDATE'),
|
||||
[
|
||||
'name' => self::STARTDATE_NAME,
|
||||
'value' => $startDateValue
|
||||
]
|
||||
);
|
||||
$this->registerFormElement($startDate);
|
||||
|
||||
/** @var Date $endDate */
|
||||
$endDateValue = Registry::getRequest()->getRequestEscapedParameter(self::ENDDATE_NAME);
|
||||
$endDate = FormFactory::date(
|
||||
Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_FIELD_ENDDATE'),
|
||||
[
|
||||
'name' => self::ENDDATE_NAME,
|
||||
'value' => $endDateValue
|
||||
]
|
||||
);
|
||||
$this->registerFormElement($endDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle() : string
|
||||
{
|
||||
return Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getQuery() : array
|
||||
{
|
||||
$orderTable = oxNew(Order::class)->getCoreTableName();
|
||||
$ordersTitle = Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_ORDERSPERMONTH');
|
||||
$basketsTitle = Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_BASKETSIZE');
|
||||
$monthTitle = Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_MONTH');
|
||||
|
||||
$startDateValue = Registry::getRequest()->getRequestEscapedParameter(self::STARTDATE_NAME) ?: '1970-01-01';
|
||||
$endDateValue = Registry::getRequest()->getRequestEscapedParameter(self::ENDDATE_NAME) ?: date('Y-m-d');
|
||||
|
||||
return [
|
||||
'SELECT
|
||||
DATE_FORMAT(oo.oxorderdate, "%Y-%m") as :monthTitle,
|
||||
FORMAT(COUNT(oo.oxid), 0) AS :ordersTitle,
|
||||
FORMAT(SUM(oo.OXTOTALBRUTSUM / oo.oxcurrate) / COUNT(oo.oxid), 2) as :basketsTitle
|
||||
FROM '.$orderTable.' AS oo
|
||||
WHERE oo.oxorderdate >= :startDate AND oo.oxorderdate <= :endDate
|
||||
GROUP BY DATE_FORMAT(oo.oxorderdate, "%Y-%m")
|
||||
ORDER BY DATE_FORMAT(oo.oxorderdate, "%Y-%m") DESC
|
||||
LIMIT 30',
|
||||
[
|
||||
'startDate' => $startDateValue,
|
||||
'endDate' => $endDateValue,
|
||||
'monthTitle' => $monthTitle,
|
||||
'ordersTitle' => $ordersTitle,
|
||||
'basketsTitle' => $basketsTitle
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
38
Application/views/admin/de/d3DataWizard_lang.php
Normal file
38
Application/views/admin/de/d3DataWizard_lang.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?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);
|
||||
|
||||
$sLangName = "Deutsch";
|
||||
// -------------------------------
|
||||
// RESOURCE IDENTITFIER = STRING
|
||||
// -------------------------------
|
||||
$aLang = array(
|
||||
|
||||
//Navigation
|
||||
'charset' => 'UTF-8',
|
||||
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES' => 'deaktivierte Kategorien, mit aktiven Artikeln',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES_TREE' => 'Baum',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES_TITLE' => 'Titel',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES_COUNT' => 'Anzahl',
|
||||
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES' => 'Bestellungskennzahlen nach Monat',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_FIELD_STARTDATE'=> 'Startdatum (optional)',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_FIELD_ENDDATE' => 'Enddatum (optional)',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_ORDERSPERMONTH' => 'Bestellungen pro Monat',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_BASKETSIZE' => 'Warenkorbhöhe',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_MONTH' => 'Monat',
|
||||
|
||||
'D3_DATAWIZARDTASKS_ACTIONS_FIXARTEXTENDSITEMS' => 'fehlende oxartextends-Einträge nachtragen',
|
||||
);
|
38
Application/views/admin/en/d3DataWizard_lang.php
Normal file
38
Application/views/admin/en/d3DataWizard_lang.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?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);
|
||||
|
||||
$sLangName = "English";
|
||||
// -------------------------------
|
||||
// RESOURCE IDENTITFIER = STRING
|
||||
// -------------------------------
|
||||
$aLang = array(
|
||||
|
||||
//Navigation
|
||||
'charset' => 'UTF-8',
|
||||
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES' => 'deactivated categories, with active articles',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES_TREE' => 'tree',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES_TITLE' => 'title',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_INACTIVECATEGORIES_COUNT' => 'count',
|
||||
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES' => 'Order key figures by month',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_FIELD_STARTDATE'=> 'start date (optional)',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_FIELD_ENDDATE' => 'end date (optional)',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_ORDERSPERMONTH' => 'orders per month',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_BASKETSIZE' => 'shopping cart value',
|
||||
'D3_DATAWIZARDTASKS_EXPORTS_KEYFIGURES_MONTH' => 'month',
|
||||
|
||||
'D3_DATAWIZARDTASKS_ACTIONS_FIXARTEXTENDSITEMS' => 'add missing oxartextends entries',
|
||||
);
|
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 1.0.0.0 (2021-07-27)
|
||||
|
||||
- extract tasks (exports and action) from DataWizard Core
|
19
IntelliSenseHelper.php
Normal file
19
IntelliSenseHelper.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace D3\DataWizardTasks\Modules\DataWizard\Application\Model {
|
||||
|
||||
use D3\DataWizard\Application\Model\Configuration;
|
||||
|
||||
class Configuration_parent extends Configuration{}
|
||||
}
|
32
Modules/DataWizard/Application/Model/Configuration.php
Normal file
32
Modules/DataWizard/Application/Model/Configuration.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
|
||||
*/
|
||||
|
||||
namespace D3\DataWizardTasks\Modules\DataWizard\Application\Model;
|
||||
|
||||
use D3\DataWizard\Application\Model\Configuration as ConfigurationParent;
|
||||
use D3\DataWizardTasks\Application\Model\Actions\FixArtextendsItems;
|
||||
use D3\DataWizardTasks\Application\Model\Exports\InactiveCategories;
|
||||
use D3\DataWizardTasks\Application\Model\Exports\KeyFigures;
|
||||
|
||||
class Configuration extends Configuration_parent
|
||||
{
|
||||
public function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this->registerAction( ConfigurationParent::GROUP_ARTICLES, oxNew( FixArtextendsItems::class));
|
||||
|
||||
$this->registerExport( ConfigurationParent::GROUP_CATEGORY, oxNew( InactiveCategories::class));
|
||||
$this->registerExport( ConfigurationParent::GROUP_SHOP, oxNew( KeyFigures::class));
|
||||
}
|
||||
}
|
30
README.en.md
Normal file
30
README.en.md
Normal file
@ -0,0 +1,30 @@
|
||||
> [deutsche Version](README.md)
|
||||
|
||||
# D³ Data Wizard Tasks for OXID eShop
|
||||
|
||||
This module contains useful sample tasks for the D3 `DataWizard` in the OXID eShop.
|
||||
|
||||
## Installation
|
||||
|
||||
In the console in the shop root (above source and vendor), execute the following command:
|
||||
|
||||
```bash
|
||||
php composer require d3/datawizardtasks
|
||||
```
|
||||
|
||||
Activate the module in the admin area of the shop in "Extensions -> Modules".
|
||||
|
||||
## Changelog
|
||||
|
||||
See [CHANGELOG](CHANGELOG.md) for further informations.
|
||||
|
||||
## Licence of this software (d3/datawizardtasks)
|
||||
(status: 2021-07-27)
|
||||
|
||||
```
|
||||
Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
|
||||
This software is distributed under the GNU GENERAL PUBLIC LICENSE version 3.
|
||||
```
|
||||
|
||||
For full copyright and licensing information, please see the [LICENSE](LICENSE.md) file distributed with this source code.
|
30
README.md
Normal file
30
README.md
Normal file
@ -0,0 +1,30 @@
|
||||
> [english version](README.en.md)
|
||||
|
||||
# D³ Data Wizard Aufgaben für OXID eShop
|
||||
|
||||
Dieses Modul enthält nützliche Beispielaufgaben für den D3 `DataWizard` im OXID eShop.
|
||||
|
||||
## Schnellinstallation
|
||||
|
||||
Auf der Konsole im Shoproot (oberhalb von source und vendor) folgenden Befehl ausführen:
|
||||
|
||||
```bash
|
||||
php composer require d3/datawizardtasks
|
||||
```
|
||||
|
||||
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
||||
|
||||
## Changelog
|
||||
|
||||
Siehe [CHANGELOG](CHANGELOG.md) für weitere Informationen.
|
||||
|
||||
## Lizenz dieser Software (d3/datawizardtasks)
|
||||
(Stand: 27.07.2021)
|
||||
|
||||
```
|
||||
Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
|
||||
Diese Software wird unter der GNU GENERAL PUBLIC LICENSE Version 3 vertrieben.
|
||||
```
|
||||
|
||||
Die vollständigen Copyright- und Lizenzinformationen entnehmen Sie bitte der [LICENSE](LICENSE.md)-Datei, die mit diesem Quellcode verteilt wurde.
|
@ -16,6 +16,10 @@ declare(strict_types=1);
|
||||
/**
|
||||
* Metadata version
|
||||
*/
|
||||
|
||||
use D3\DataWizard\Application\Model\Configuration as ConfigurationParent;
|
||||
use D3\DataWizardTasks\Modules\DataWizard\Application\Model\Configuration;
|
||||
|
||||
$sMetadataVersion = '2.1';
|
||||
|
||||
$sModuleId = 'd3datawizardtasks';
|
||||
@ -40,7 +44,9 @@ $aModule = [
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
'controllers' => [],
|
||||
'extend' => [],
|
||||
'extend' => [
|
||||
ConfigurationParent::class => Configuration::class
|
||||
],
|
||||
'events' => [],
|
||||
'templates' => [],
|
||||
'settings' => [],
|
||||
|
Loading…
Reference in New Issue
Block a user