From 35e88ba5f1d0f7845b6d92301da15c39fabab3d7 Mon Sep 17 00:00:00 2001 From: zebardy Date: Sat, 23 Nov 2019 21:15:54 +0000 Subject: [PATCH] fix calendar service --- services/CalendarService.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/services/CalendarService.php b/services/CalendarService.php index e951cb91..71a0df7e 100644 --- a/services/CalendarService.php +++ b/services/CalendarService.php @@ -29,8 +29,8 @@ class CalendarService extends BaseService public function GetEvents() { - $products = $this->Database->products(); - $titlePrefix = $this->LocalizationService->__t('Product expires') . ': '; + $products = $this->getDatabase()->products(); + $titlePrefix = $this->getLocalizationService()->__t('Product expires') . ': '; $stockEvents = array(); foreach($this->StockService->GetCurrentStock() as $currentStockEntry) { @@ -44,7 +44,7 @@ class CalendarService extends BaseService } } - $titlePrefix = $this->LocalizationService->__t('Task due') . ': '; + $titlePrefix = $this->getLocalizationService()->__t('Task due') . ': '; $taskEvents = array(); foreach($this->TasksService->GetCurrent() as $currentTaskEntry) { @@ -58,8 +58,8 @@ class CalendarService extends BaseService $usersService = new UsersService(); $users = $usersService->GetUsersAsDto(); - $chores = $this->Database->chores(); - $titlePrefix = $this->LocalizationService->__t('Chore due') . ': '; + $chores = $this->getDatabase()->chores(); + $titlePrefix = $this->getLocalizationService()->__t('Chore due') . ': '; $choreEvents = array(); foreach($this->ChoresService->GetCurrent() as $currentChoreEntry) { @@ -68,7 +68,7 @@ class CalendarService extends BaseService $assignedToText = ''; if (!empty($currentChoreEntry->next_execution_assigned_to_user_id)) { - $assignedToText = ' (' . $this->LocalizationService->__t('assigned to %s', FindObjectInArrayByPropertyValue($users, 'id', $currentChoreEntry->next_execution_assigned_to_user_id)->display_name) . ')'; + $assignedToText = ' (' . $this->getLocalizationService()->__t('assigned to %s', FindObjectInArrayByPropertyValue($users, 'id', $currentChoreEntry->next_execution_assigned_to_user_id)->display_name) . ')'; } $choreEvents[] = array( @@ -78,8 +78,8 @@ class CalendarService extends BaseService ); } - $batteries = $this->Database->batteries(); - $titlePrefix = $this->LocalizationService->__t('Battery charge cycle due') . ': '; + $batteries = $this->getDatabase()->batteries(); + $titlePrefix = $this->getLocalizationService()->__t('Battery charge cycle due') . ': '; $batteryEvents = array(); foreach($this->BatteriesService->GetCurrent() as $currentBatteryEntry) { @@ -90,13 +90,13 @@ class CalendarService extends BaseService ); } - $recipes = $this->Database->recipes(); - $mealPlanDayRecipes = $this->Database->recipes()->where('type', 'mealplan-day'); - $titlePrefix = $this->LocalizationService->__t('Meal plan') . ': '; + $recipes = $this->getDatabase()->recipes(); + $mealPlanDayRecipes = $this->getDatabase()->recipes()->where('type', 'mealplan-day'); + $titlePrefix = $this->getLocalizationService()->__t('Meal plan') . ': '; $mealPlanRecipeEvents = array(); foreach($mealPlanDayRecipes as $mealPlanDayRecipe) { - $recipesOfCurrentDay = $this->Database->recipes_nestings_resolved()->where('recipe_id = :1 AND includes_recipe_id != :1', $mealPlanDayRecipe->id); + $recipesOfCurrentDay = $this->getDatabase()->recipes_nestings_resolved()->where('recipe_id = :1 AND includes_recipe_id != :1', $mealPlanDayRecipe->id); foreach ($recipesOfCurrentDay as $recipeOfCurrentDay) { $mealPlanRecipeEvents[] = array(