fix docblock

This commit is contained in:
Dennis Eichhorn 2019-09-21 15:28:07 +02:00
parent b4af6aab1b
commit 765d542bc2
14 changed files with 383 additions and 8 deletions

View File

@ -102,4 +102,20 @@ final class ApiController extends Controller
public function apiExchangeExport(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
}
/**
* Api method to handle file upload
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiExchangeUpload(RequestAbstract $request, ResponseAbstract $response, $data = null): void
{ }
}

View File

@ -4,7 +4,7 @@
*
* PHP Version 7.4
*
* @package TBD
* @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0

221
Interfaces/OMS/Importer.php Normal file
View File

@ -0,0 +1,221 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @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 Modules\Accounting\Models\CostCenter;
use Modules\Accounting\Models\CostCenterMapper;
use Modules\Accounting\Models\CostObject;
use Modules\Accounting\Models\CostObjectMapper;
use Modules\Exchange\Interfaces\OMS\Model\ExchangeType;
use Modules\Exchange\Models\ImporterAbstract;
use phpOMS\DataStorage\Database\Connection\ConnectionFactory;
use phpOMS\DataStorage\Database\DatabaseStatus;
use phpOMS\Message\RequestAbstract;
/**
* OMS import class
*
* @package Modules\Exchange\Models\Interfaces\OMS
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
final class Importer extends ImporterAbstract
{
/**
* Import data from request
*
* @param RequestAbstract $request Request
*
* @return bool
*
* @since 1.0.0
*/
public function importFromRequest(RequestAbstract $request): bool
{
$start = new \DateTime($request->getData('start') ?? 'now');
$end = new \DateTime($request->getData('end') ?? 'now');
$type = (int) ($request->getData('type') ?? 0);
if ($type === ExchangeType::CUSTOMER) {
$this->importCustomer($start, $end);
} elseif ($type === ExchangeType::SUPPLIER) {
$this->importSupplier($start, $end);
} elseif ($type === ExchangeType::ACCOUNT) {
$this->importAccount($start, $end);
} elseif ($type === ExchangeType::COSTCENTER) {
$this->importCostCenter($start, $end);
} elseif ($type === ExchangeType::COSTOBJECT) {
$this->importCostObject($start, $end);
} elseif ($type === ExchangeType::ARTICLE) {
$this->importArticle($start, $end);
} elseif ($type === ExchangeType::INVOICE) {
$this->importInvoice($start, $end);
}
return true;
}
/**
* Import cost centers
*
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
*
* @return void
*
* @since 1.0.0
*/
public function importCostCenter(\DateTime $start, \DateTime $end): void
{
$costCenters = OMSCostCenterMapper::getAll();
$obj = new CostCenter();
DataMapperAbstract::setConnection($this->local);
foreach ($costCenters as $cc) {
$obj->setCostCenter((int) $cc->getCostCenter());
$obj->setCostCenterName($cc->getDescription());
CostCenterMapper::create($obj);
}
}
/**
* Import cost objects
*
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
*
* @return void
*
* @since 1.0.0
*/
public function importCostObject(\DateTime $start, \DateTime $end): void
{
$costObjects = OMSCostObjectMapper::getAll();
$obj = new CostObject();
DataMapperAbstract::setConnection($this->local);
foreach ($costObjects as $co) {
$obj->setCostObject((int) $co->getCostObject());
$obj->setCostObjectName($co->getDescription());
CostObjectMapper::create($obj);
}
}
/**
* Import addresses
*
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
*
* @return void
*
* @since 1.0.0
*/
public function importAddress(\DateTime $start, \DateTime $end): void
{
while (($line = \fgetcsv($this->remote)) !== false) {
}
}
/**
* Import customers
*
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
*
* @return void
*
* @since 1.0.0
*/
public function importCustomer(\DateTime $start, \DateTime $end): void
{
}
/**
* Import suppliers
*
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
*
* @return void
*
* @since 1.0.0
*/
public function importSupplier(\DateTime $start, \DateTime $end): void
{ }
/**
* Import accounts
*
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
*
* @return void
*
* @since 1.0.0
*/
public function importAccount(\DateTime $start, \DateTime $end): void
{ }
/**
* Import invoices
*
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
*
* @return void
*
* @since 1.0.0
*/
public function importInvoice(\DateTime $start, \DateTime $end): void
{ }
/**
* Import postings
*
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
*
* @return void
*
* @since 1.0.0
*/
public function importPosting(\DateTime $start, \DateTime $end): void
{ }
/**
* Import batch postings
*
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
*
* @return void
*
* @since 1.0.0
*/
public function importBatchPosting(\DateTime $start, \DateTime $end): void
{ }
}

View File

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
return [
'Account' => 'Account',
'Article' => 'Articls',
'CostCenter' => 'Cost Center',
'CostObject' => 'Cost Object',
'Customer' => 'Customer',
'Invoice' => 'Invoice',
'Options' => 'Options',
'Supplier' => 'Supplier',
];

View File

@ -0,0 +1,66 @@
<?php
use Modules\Exchange\Models\ExchangeType;
?>
<div class="tabview tab-2">
<div class="box wf-100 col-xs-12">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('File'); ?></label></li>
<li><label for="c-tab-2"><?= $this->getHtml('Database'); ?></label></li>
</ul>
</div>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2" checked>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header>
<h1><?= $this->getHtml('Import') ?> - Orange Management</h1>
</header>
<div class="inner">
<form id="fImport" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('{/api}admin/exchange/import/profile?{?}&exchange=GSD&csrf={$CSRF}'); ?>">
<table class="layout wf-100" style="table-layout: fixed">
<tbody>
<tr>
<td><label for="iHost"><?= $this->getHtml('Host') ?></label>
<tr>
<td><input type="file" id="iFile" name="file" placeholder="&#xf040; <?= $this->getHtml('Host') ?>" data-uri="api/exchange/file" required><input type="hidden" id="iUploaded" name="uploaded">
<tr>
<td><?= $this->getHtml('Options') ?>
<tr>
<td>
<select>
<option value="<?= ExchangeType::CUSTOMER; ?>"><?= $this->getHtml('Customer') ?>
<option value="<?= ExchangeType::SUPPLIER; ?>"><?= $this->getHtml('Supplier') ?>
<option value="<?= ExchangeType::ARTICLE; ?>"><?= $this->getHtml('Article') ?>
<option value="<?= ExchangeType::BOOKING; ?>"><?= $this->getHtml('Booking') ?>
<option value="<?= ExchangeType::ACCOUNT; ?>"><?= $this->getHtml('Account') ?>
<option value="<?= ExchangeType::COSTCENTER; ?>"><?= $this->getHtml('CostCenter') ?>
<option value="<?= ExchangeType::COSTOBJECT; ?>"><?= $this->getHtml('CostObject') ?>
<option value="<?= ExchangeType::ADDRESS; ?>"><?= $this->getHtml('Address') ?>
</select>
<tr>
<td><label for="iStart"><?= $this->getHtml('Start') ?></label>
<tr>
<td><input type="datetime-local" id="iStart" name="start" value="<?= $this->printHtml((new \DateTime('NOW'))->format('Y-m-d\TH:i:s')); ?>">
<tr>
<td><label for="iEnd"><?= $this->getHtml('End') ?></label>
<tr>
<td><input type="datetime-local" id="iEnd" name="end" value="<?= $this->printHtml((new \DateTime('NOW'))->format('Y-m-d\TH:i:s')); ?>">
<tr>
<td>
<input type="submit" value="<?= $this->getHtml('Import'); ?>">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-2" name="tabular-2">
<div class="tab">
</div>
</div>
</div>

View File

@ -0,0 +1,8 @@
{
"name": "OMS",
"version": "1.0.0",
"website": "",
"path": "OMS",
"export": false,
"import": true
}

39
Models/ExchangeType.php Normal file
View File

@ -0,0 +1,39 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\Exchange\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Exchange status enum.
*
* @package Modules\Exchange
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
abstract class ExchangeType extends Enum
{
public const CUSTOMER = 1;
public const SUPPLIER = 2;
public const ARTICLE = 3;
public const BOOKING = 4;
public const ACCOUNT = 5;
public const ADDRESS = 6;
public const COSTCENTER = 7;
public const COSTOBJECT = 8;
}

View File

@ -4,7 +4,7 @@
*
* PHP Version 7.4
*
* @package TBD
* @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0

View File

@ -4,7 +4,7 @@
*
* PHP Version 7.4
*
* @package TBD
* @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
@ -16,6 +16,7 @@ return ['Exchange' => [
'Exchange' => 'Exchange',
'Export' => 'Export',
'Exports' => 'Exports',
'File' => 'File',
'Host' => 'Host',
'Import' => 'Import',
'Imports' => 'Imports',

View File

@ -4,7 +4,7 @@
*
* PHP Version 7.4
*
* @package TBD
* @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0

View File

@ -4,7 +4,7 @@
*
* PHP Version 7.4
*
* @package TBD
* @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0

View File

@ -4,7 +4,7 @@
*
* PHP Version 7.4
*
* @package TBD
* @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0

View File

@ -4,7 +4,7 @@
*
* PHP Version 7.4
*
* @package TBD
* @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0

View File

@ -4,7 +4,7 @@
*
* PHP Version 7.4
*
* @package TBD
* @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0