1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Load recent edited tasks with history

This commit is contained in:
Hillel Coren 2016-09-06 14:55:15 +03:00
parent 2f54d1dfa3
commit 9e082ef274

View File

@ -22,6 +22,8 @@ class HistoryUtils
$activityTypes = [
ACTIVITY_TYPE_CREATE_CLIENT,
ACTIVITY_TYPE_CREATE_TASK,
ACTIVITY_TYPE_UPDATE_TASK,
ACTIVITY_TYPE_CREATE_INVOICE,
ACTIVITY_TYPE_UPDATE_INVOICE,
ACTIVITY_TYPE_EMAIL_INVOICE,
@ -33,7 +35,7 @@ class HistoryUtils
];
$activities = Activity::scope()
->with(['client.contacts', 'invoice'])
->with(['client.contacts', 'invoice', 'task'])
->whereIn('user_id', $userIds)
->whereIn('activity_type_id', $activityTypes)
->orderBy('id', 'asc')
@ -44,6 +46,9 @@ class HistoryUtils
{
if ($activity->activity_type_id == ACTIVITY_TYPE_CREATE_CLIENT) {
$entity = $activity->client;
} else if ($activity->activity_type_id == ACTIVITY_TYPE_CREATE_TASK || $activity->activity_type_id == ACTIVITY_TYPE_UPDATE_TASK) {
$entity = $activity->task;
$entity->setRelation('client', $activity->client);
} else {
$entity = $activity->invoice;
$entity->setRelation('client', $activity->client);