mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Show to whom the chore execution is assigned in calendar events (references #253)
This commit is contained in:
parent
597a9e3d21
commit
b5761ae544
@ -1411,3 +1411,6 @@ msgstr[1] ""
|
||||
|
||||
msgid "Assigned to me"
|
||||
msgstr ""
|
||||
|
||||
msgid "assigned to %s"
|
||||
msgstr ""
|
||||
|
@ -6,6 +6,7 @@ use \Grocy\Services\StockService;
|
||||
use \Grocy\Services\TasksService;
|
||||
use \Grocy\Services\ChoresService;
|
||||
use \Grocy\Services\BatteriesService;
|
||||
use \Grocy\Services\UsersService;
|
||||
|
||||
class CalendarService extends BaseService
|
||||
{
|
||||
@ -51,13 +52,24 @@ class CalendarService extends BaseService
|
||||
);
|
||||
}
|
||||
|
||||
$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);
|
||||
|
||||
$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) . ')';
|
||||
}
|
||||
|
||||
$choreEvents[] = array(
|
||||
'title' => $titlePrefix . FindObjectInArrayByPropertyValue($chores, 'id', $currentChoreEntry->chore_id)->name,
|
||||
'title' => $titlePrefix . $chore->name . $assignedToText,
|
||||
'start' => $currentChoreEntry->next_estimated_execution_time,
|
||||
'date_format' => 'datetime'
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user