mirror of
https://github.com/Karaka-Management/oms-Exchange.git
synced 2026-01-27 16:28:41 +00:00
103 lines
2.2 KiB
PHP
103 lines
2.2 KiB
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 8.0
|
|
*
|
|
* @package Interfaces
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link https://orange-management.org
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Exchange\Interfaces\OMS;
|
|
|
|
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
|
use phpOMS\DataStorage\Database\Connection\ConnectionFactory;
|
|
use phpOMS\DataStorage\Database\DatabaseStatus;
|
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
|
use phpOMS\Localization\ISO3166TwoEnum;
|
|
use phpOMS\Localization\ISO639x1Enum;
|
|
use phpOMS\Message\RequestAbstract;
|
|
use phpOMS\System\File\Local\Directory;
|
|
use phpOMS\Utils\IO\Zip\Zip;
|
|
|
|
/**
|
|
* OMS export class
|
|
*
|
|
* @package Modules\Exchange\Models\Interfaces\OMS
|
|
* @license OMS License 1.0
|
|
* @link https://orange-management.org
|
|
* @since 1.0.0
|
|
*/
|
|
final class Exporter extends ExporterAbstract
|
|
{
|
|
/**
|
|
* Database connection.
|
|
*
|
|
* @var ConnectionAbstract
|
|
* @since 1.0.0
|
|
*/
|
|
private ConnectionAbstract $remote;
|
|
|
|
/**
|
|
* Account
|
|
*
|
|
* @var int
|
|
* @since 1.0.0
|
|
*/
|
|
private int $account = 1;
|
|
|
|
/**
|
|
* Export all data in time span
|
|
*
|
|
* @param \DateTime $start Start time (inclusive)
|
|
* @param \DateTime $end End time (inclusive)
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function export(\DateTime $start, \DateTime $end) : void
|
|
{
|
|
$this->exportLanguage($start, $end);
|
|
}
|
|
|
|
/**
|
|
* Export data from request
|
|
*
|
|
* @param RequestAbstract $request Request
|
|
*
|
|
* @return bool
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function exportFromRequest(RequestAbstract $request) : bool
|
|
{
|
|
$start = new \DateTime($request->getData('start') ?? 'now');
|
|
$end = new \DateTime($request->getData('end') ?? 'now');
|
|
|
|
$this->account = $request->header->account;
|
|
|
|
if (((bool) ($request->getData('language') ?? false))) {
|
|
$this->exportLanguage();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Export language
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function exportLanguage() : void
|
|
{
|
|
|
|
}
|
|
}
|