mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
CalendarService reflect config options for GetEvents (#552)
This commit is contained in:
parent
ba4dfa30a7
commit
13f99ad5f2
@ -28,10 +28,12 @@ class CalendarService extends BaseService
|
||||
protected $UrlManager;
|
||||
|
||||
public function GetEvents()
|
||||
{
|
||||
$stockEvents = array();
|
||||
if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
|
||||
{
|
||||
$products = $this->Database->products();
|
||||
$titlePrefix = $this->LocalizationService->__t('Product expires') . ': ';
|
||||
$stockEvents = array();
|
||||
foreach($this->StockService->GetCurrentStock() as $currentStockEntry)
|
||||
{
|
||||
if ($currentStockEntry->amount > 0)
|
||||
@ -43,9 +45,12 @@ class CalendarService extends BaseService
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$titlePrefix = $this->LocalizationService->__t('Task due') . ': ';
|
||||
$taskEvents = array();
|
||||
if (GROCY_FEATURE_FLAG_TASKS)
|
||||
{
|
||||
$titlePrefix = $this->LocalizationService->__t('Task due') . ': ';
|
||||
foreach($this->TasksService->GetCurrent() as $currentTaskEntry)
|
||||
{
|
||||
$taskEvents[] = array(
|
||||
@ -54,13 +59,16 @@ class CalendarService extends BaseService
|
||||
'date_format' => 'date'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$choreEvents = array();
|
||||
if (GROCY_FEATURE_FLAG_CHORES)
|
||||
{
|
||||
$usersService = new UsersService();
|
||||
$users = $usersService->GetUsersAsDto();
|
||||
|
||||
$chores = $this->Database->chores();
|
||||
$titlePrefix = $this->LocalizationService->__t('Chore due') . ': ';
|
||||
$choreEvents = array();
|
||||
foreach($this->ChoresService->GetCurrent() as $currentChoreEntry)
|
||||
{
|
||||
$chore = FindObjectInArrayByPropertyValue($chores, 'id', $currentChoreEntry->chore_id);
|
||||
@ -77,10 +85,13 @@ class CalendarService extends BaseService
|
||||
'date_format' => 'datetime'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$batteryEvents = array();
|
||||
if (GROCY_FEATURE_FLAG_BATTERIES)
|
||||
{
|
||||
$batteries = $this->Database->batteries();
|
||||
$titlePrefix = $this->LocalizationService->__t('Battery charge cycle due') . ': ';
|
||||
$batteryEvents = array();
|
||||
foreach($this->BatteriesService->GetCurrent() as $currentBatteryEntry)
|
||||
{
|
||||
$batteryEvents[] = array(
|
||||
@ -89,6 +100,7 @@ class CalendarService extends BaseService
|
||||
'date_format' => 'datetime'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$recipes = $this->Database->recipes();
|
||||
$mealPlanDayRecipes = $this->Database->recipes()->where('type', 'mealplan-day');
|
||||
|
Loading…
x
Reference in New Issue
Block a user