Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
|
- <?php
-
- namespace domain\Document\Document;
-
- use domain\Producer\Producer\ProducerSolver;
- use domain\_\AbstractBuilder;
-
- class DocumentBuilder extends AbstractBuilder
- {
- protected DocumentSolver $documentSolver;
- protected DocumentRepository $documentRepository;
- protected ProducerSolver $producerSolver;
-
- public function loadDependencies(): void
- {
- $this->documentSolver = $this->loadService(DocumentSolver::class);
- $this->documentRepository = $this->loadService(DocumentRepository::class);
- $this->producerSolver = $this->loadService(ProducerSolver::class);
- }
-
- public function initDocumentProducer(Document $document): void
- {
- $document->id_producer = $this->getProducerContextId();
- }
-
- public function initTaxCalculationMethod(DocumentInterface $document): void
- {
- $producerTaxCalculationMethod = $this->producerSolver->getConfig('option_tax_calculation_method');
-
- if ($producerTaxCalculationMethod) {
- $document->tax_calculation_method = $producerTaxCalculationMethod;
- } else {
- $document->tax_calculation_method = Document::TAX_CALCULATION_METHOD_DEFAULT;
- }
- }
-
- public function initDocumentDate(Document $document)
- {
- $document->date = date('Y-m-d H:i:s');
- }
-
- public function updateDocumentIsSend(Document $document, bool $isSent)
- {
- $document->is_sent = $isSent;
- $this->update($document);
- }
- }
|