CHANGE_ADD_ACTIVITY_FOR_MULTIPLE_USER
This commit is contained in:
parent
6b99b9961b
commit
8c09841c8f
@ -652,12 +652,16 @@ class SalesController extends BaseController
|
||||
$data['additional_assigned_ids'] = json_encode($data['additional_assigned_ids']);
|
||||
}
|
||||
|
||||
if (!$this->activityModel->insert($data)) {
|
||||
$activityId = $this->activityModel->insert($data);
|
||||
if (!$activityId) {
|
||||
return $this->fail($this->activityModel->errors(), ResponseInterface::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
$data['activity_id'] = $activityId;
|
||||
|
||||
// add google calender event
|
||||
$response = $this->addCalenderEvent($data);
|
||||
log_message("error", '[GOOGLE_CALENDER] addCalenderEvent response: ' . json_encode($response));
|
||||
|
||||
$activityId = $this->activityModel->getInsertID();
|
||||
$activity = $this->activityModel->find((int)$activityId);
|
||||
@ -1962,6 +1966,23 @@ public function salesManagerLevelDashboard($userId, $current_fin_year = null, $f
|
||||
];
|
||||
}
|
||||
|
||||
$activity_data = $this->activityModel->where('activity_id', $input['activity_id'])->first();
|
||||
|
||||
|
||||
$emails[] = $user_data['email'];
|
||||
if (isset($activity_data['additional_assigned_ids']) && !empty($activity_data['additional_assigned_ids'])) {
|
||||
$additional_assigned_ids = json_decode($activity_data['additional_assigned_ids'], true) ?? [];
|
||||
|
||||
foreach ($additional_assigned_ids as $additional_assigned_id) {
|
||||
$additional_user_data = $this->userModel->where('id', $additional_assigned_id)->first();
|
||||
|
||||
if (!empty($additional_user_data['email'])) {
|
||||
$emails[] = $additional_user_data['email'];
|
||||
}
|
||||
}
|
||||
}
|
||||
log_message('error', '[GOOGLE_CALENDER] User emails: ' . json_encode($emails));
|
||||
|
||||
/* ---------------- SUMMARY ---------------- */
|
||||
|
||||
$activityType = ucfirst($input['activity_type']);
|
||||
@ -1988,7 +2009,7 @@ public function salesManagerLevelDashboard($userId, $current_fin_year = null, $f
|
||||
'summary' => $summary,
|
||||
'meeting_date' => $input['scheduled_date'],
|
||||
'description' => $input['notes'] ?? '',
|
||||
'emails' => [$user_data['email']],
|
||||
'emails' => $emails,
|
||||
];
|
||||
|
||||
log_message('error', '[GOOGLE_CALENDER] Google Calendar Payload: ' . json_encode($eventData));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user