app = $app; $this->db = $db; $this->taskMutexService = $taskMutexService; $this->cycleJobService = $cycleJobService; $this->subscriptionModule = $subscriptionModule; } public function execute(): void { if ($this->taskMutexService->isTaskInstanceRunning('rechnungslauf_manual')) { return; } $this->taskMutexService->setMutex('rechnungslauf_manual'); $jobs = $this->cycleJobService->listAll(100); foreach ($jobs as $job) { switch ($job['document_type']) { case 'rechnung': $this->subscriptionModule->CreateInvoice((int)$job['address_id']); break; case 'auftrag': $this->subscriptionModule->CreateOrder((int)$job['address_id']); break; } $this->cycleJobService->delete((int)$job['id']); } } public function cleanup(): void { $this->taskMutexService->setMutex('rechnungslauf_manual', false); } }