fix calendar service

This commit is contained in:
zebardy 2019-11-23 21:15:54 +00:00
parent 90c00680fa
commit 35e88ba5f1

View File

@ -29,8 +29,8 @@ class CalendarService extends BaseService
public function GetEvents() public function GetEvents()
{ {
$products = $this->Database->products(); $products = $this->getDatabase()->products();
$titlePrefix = $this->LocalizationService->__t('Product expires') . ': '; $titlePrefix = $this->getLocalizationService()->__t('Product expires') . ': ';
$stockEvents = array(); $stockEvents = array();
foreach($this->StockService->GetCurrentStock() as $currentStockEntry) 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(); $taskEvents = array();
foreach($this->TasksService->GetCurrent() as $currentTaskEntry) foreach($this->TasksService->GetCurrent() as $currentTaskEntry)
{ {
@ -58,8 +58,8 @@ class CalendarService extends BaseService
$usersService = new UsersService(); $usersService = new UsersService();
$users = $usersService->GetUsersAsDto(); $users = $usersService->GetUsersAsDto();
$chores = $this->Database->chores(); $chores = $this->getDatabase()->chores();
$titlePrefix = $this->LocalizationService->__t('Chore due') . ': '; $titlePrefix = $this->getLocalizationService()->__t('Chore due') . ': ';
$choreEvents = array(); $choreEvents = array();
foreach($this->ChoresService->GetCurrent() as $currentChoreEntry) foreach($this->ChoresService->GetCurrent() as $currentChoreEntry)
{ {
@ -68,7 +68,7 @@ class CalendarService extends BaseService
$assignedToText = ''; $assignedToText = '';
if (!empty($currentChoreEntry->next_execution_assigned_to_user_id)) 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( $choreEvents[] = array(
@ -78,8 +78,8 @@ class CalendarService extends BaseService
); );
} }
$batteries = $this->Database->batteries(); $batteries = $this->getDatabase()->batteries();
$titlePrefix = $this->LocalizationService->__t('Battery charge cycle due') . ': '; $titlePrefix = $this->getLocalizationService()->__t('Battery charge cycle due') . ': ';
$batteryEvents = array(); $batteryEvents = array();
foreach($this->BatteriesService->GetCurrent() as $currentBatteryEntry) foreach($this->BatteriesService->GetCurrent() as $currentBatteryEntry)
{ {
@ -90,13 +90,13 @@ class CalendarService extends BaseService
); );
} }
$recipes = $this->Database->recipes(); $recipes = $this->getDatabase()->recipes();
$mealPlanDayRecipes = $this->Database->recipes()->where('type', 'mealplan-day'); $mealPlanDayRecipes = $this->getDatabase()->recipes()->where('type', 'mealplan-day');
$titlePrefix = $this->LocalizationService->__t('Meal plan') . ': '; $titlePrefix = $this->getLocalizationService()->__t('Meal plan') . ': ';
$mealPlanRecipeEvents = array(); $mealPlanRecipeEvents = array();
foreach($mealPlanDayRecipes as $mealPlanDayRecipe) 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) foreach ($recipesOfCurrentDay as $recipeOfCurrentDay)
{ {
$mealPlanRecipeEvents[] = array( $mealPlanRecipeEvents[] = array(