From 5bac7c479cb30727c2b8e1bbbabfd06c9b1f26f6 Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Tue, 27 Dec 2022 21:38:48 +0100 Subject: [PATCH] Bugfix date display --- .../Scheduler/SubscriptionCycleManualJobTask.php | 2 +- .../SubscriptionCycle/SubscriptionModule.php | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/classes/Modules/SubscriptionCycle/Scheduler/SubscriptionCycleManualJobTask.php b/classes/Modules/SubscriptionCycle/Scheduler/SubscriptionCycleManualJobTask.php index f7378baa..d032099d 100644 --- a/classes/Modules/SubscriptionCycle/Scheduler/SubscriptionCycleManualJobTask.php +++ b/classes/Modules/SubscriptionCycle/Scheduler/SubscriptionCycleManualJobTask.php @@ -36,7 +36,7 @@ final class SubscriptionCycleManualJobTask Database $db, TaskMutexServiceInterface $taskMutexService, SubscriptionCycleJobService $cycleJobService, - SubscriptionModuleInterface $subscriptionModule, + SubscriptionModuleInterface $subscriptionModule ) { $this->app = $app; $this->db = $db; diff --git a/classes/Modules/SubscriptionCycle/SubscriptionModule.php b/classes/Modules/SubscriptionCycle/SubscriptionModule.php index c46a5a97..8b6ecead 100644 --- a/classes/Modules/SubscriptionCycle/SubscriptionModule.php +++ b/classes/Modules/SubscriptionCycle/SubscriptionModule.php @@ -74,10 +74,14 @@ class SubscriptionModule implements SubscriptionModuleInterface $this->app->erp->LoadRechnungStandardwerte($invoice, $address); foreach ($positions as $pos) { $beschreibung = $pos['beschreibung']; - $beschreibung .= "
Zeitraum: {$pos['start']} - {$pos['end']}"; + + $starts = DateTimeImmutable::createFromFormat('Y-m-d', $pos['start'])->format('d.m.Y'); + $newends = DateTimeImmutable::createFromFormat('Y-m-d', $pos['newend'])->format('d.m.Y'); + $beschreibung .= "
Zeitraum: $starts - $newends"; + $this->app->erp->AddRechnungPositionManuell($invoice, $pos['artikel'], $pos['preis'], $pos['menge']*$pos['cycles'], $pos['bezeichnung'], $beschreibung, $pos['waehrung'], $pos['rabatt']); - $this->db->update("UPDATE abrechnungsartikel SET abgerechnetbis='{$pos['newend']}' WHERE id={$pos['id']}"); + $this->db->exec("UPDATE abrechnungsartikel SET abgerechnetbis='{$pos['newend']}' WHERE id={$pos['id']}"); } $this->app->erp->RechnungNeuberechnen($invoice); //$this->app->erp->BelegFreigabe('rechnung', $invoice); @@ -92,10 +96,14 @@ class SubscriptionModule implements SubscriptionModuleInterface $this->app->erp->LoadAuftragStandardwerte($orderid, $address); foreach ($positions as $pos) { $beschreibung = $pos['beschreibung']; - $beschreibung .= "
Zeitraum: {$pos['start']} - {$pos['end']}"; + + $starts = DateTimeImmutable::createFromFormat('Y-m-d', $pos['start'])->format('d.m.Y'); + $newends = DateTimeImmutable::createFromFormat('Y-m-d', $pos['newend'])->format('d.m.Y'); + $beschreibung .= "
Zeitraum: $starts - $newends"; + $this->app->erp->AddAuftragPositionManuell($orderid, $pos['artikel'], $pos['preis'], $pos['menge']*$pos['cycles'], $pos['bezeichnung'], $beschreibung, $pos['waehrung'], $pos['rabatt']); - $this->db->update("UPDATE abrechnungsartikel SET abgerechnetbis='{$pos['newend']}' WHERE id={$pos['id']}"); + $this->db->exec("UPDATE abrechnungsartikel SET abgerechnetbis='{$pos['newend']}' WHERE id={$pos['id']}"); } $this->app->erp->AuftragNeuberechnen($orderid); //$this->app->erp->BelegFreigabe('auftrag', $orderid);