diff --git a/Controller/ApiController.php b/Controller/ApiController.php index a800a25..8fe6dd8 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -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 + { } } diff --git a/Interfaces/GSD/en.lang.php b/Interfaces/GSD/en.lang.php index 1204fed..6a65786 100644 --- a/Interfaces/GSD/en.lang.php +++ b/Interfaces/GSD/en.lang.php @@ -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 diff --git a/Interfaces/OMS/Importer.php b/Interfaces/OMS/Importer.php new file mode 100644 index 0000000..cd1a39a --- /dev/null +++ b/Interfaces/OMS/Importer.php @@ -0,0 +1,221 @@ +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 + { } +} diff --git a/Interfaces/OMS/en.lang.php b/Interfaces/OMS/en.lang.php new file mode 100644 index 0000000..f248ad6 --- /dev/null +++ b/Interfaces/OMS/en.lang.php @@ -0,0 +1,24 @@ + 'Account', + 'Article' => 'Articls', + 'CostCenter' => 'Cost Center', + 'CostObject' => 'Cost Object', + 'Customer' => 'Customer', + 'Invoice' => 'Invoice', + 'Options' => 'Options', + 'Supplier' => 'Supplier', +]; diff --git a/Interfaces/OMS/import.tpl.php b/Interfaces/OMS/import.tpl.php new file mode 100644 index 0000000..95793fb --- /dev/null +++ b/Interfaces/OMS/import.tpl.php @@ -0,0 +1,66 @@ + +
+
+ +
+
+ +
+
+
+
+
+

getHtml('Import') ?> - Orange Management

+
+ +
+
+ + + + + + + + + + + +
+
+
getHtml('Options') ?> +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/Interfaces/OMS/interface.json b/Interfaces/OMS/interface.json new file mode 100644 index 0000000..5d8ec8e --- /dev/null +++ b/Interfaces/OMS/interface.json @@ -0,0 +1,8 @@ +{ + "name": "OMS", + "version": "1.0.0", + "website": "", + "path": "OMS", + "export": false, + "import": true +} \ No newline at end of file diff --git a/Models/ExchangeType.php b/Models/ExchangeType.php new file mode 100644 index 0000000..b3e2c4c --- /dev/null +++ b/Models/ExchangeType.php @@ -0,0 +1,39 @@ + [ 'Exchange' => 'Exchange', 'Export' => 'Export', 'Exports' => 'Exports', + 'File' => 'File', 'Host' => 'Host', 'Import' => 'Import', 'Imports' => 'Imports', diff --git a/Theme/Backend/exchange-dashboard.tpl.php b/Theme/Backend/exchange-dashboard.tpl.php index 27af383..21b9d6a 100644 --- a/Theme/Backend/exchange-dashboard.tpl.php +++ b/Theme/Backend/exchange-dashboard.tpl.php @@ -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 diff --git a/Theme/Backend/exchange-export-list.tpl.php b/Theme/Backend/exchange-export-list.tpl.php index 2a7abe5..2ed9fd5 100644 --- a/Theme/Backend/exchange-export-list.tpl.php +++ b/Theme/Backend/exchange-export-list.tpl.php @@ -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 diff --git a/Theme/Backend/exchange-export.tpl.php b/Theme/Backend/exchange-export.tpl.php index 27af383..21b9d6a 100644 --- a/Theme/Backend/exchange-export.tpl.php +++ b/Theme/Backend/exchange-export.tpl.php @@ -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 diff --git a/Theme/Backend/exchange-import-list.tpl.php b/Theme/Backend/exchange-import-list.tpl.php index 4180ce8..f0dd350 100644 --- a/Theme/Backend/exchange-import-list.tpl.php +++ b/Theme/Backend/exchange-import-list.tpl.php @@ -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 diff --git a/Theme/Backend/exchange-import.tpl.php b/Theme/Backend/exchange-import.tpl.php index f818139..b7200bb 100644 --- a/Theme/Backend/exchange-import.tpl.php +++ b/Theme/Backend/exchange-import.tpl.php @@ -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