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 { } }