Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix - Reuniones - "Run Email Reminder Notifications" no se ejecuta al eliminar una persona #406

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions modules/Reminders/Reminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,23 @@ private static function getEmailReminderInviteesRecipients($reminderId, $checkDe
$inviteeModuleId = $invitee->related_invitee_module_id;
$personBean = BeanFactory::getBean($inviteeModule, $inviteeModuleId);
// The original email reminders check the accept_status field in related users/leads/contacts etc. and filtered these users who not decline this event.
if ($checkDecline && !self::isDecline($event, $personBean)) {
if (!empty($personBean->email1)) {
$arr = array(
'type' => $inviteeModule,
'name' => $personBean->full_name,
'email' => $personBean->email1,
);
$emails[] = $arr;

// STIC-Custom 20240926 ART - “Run Email Reminder Notifications” does not run when deleting a person
ManuSinergiaCRM marked this conversation as resolved.
Show resolved Hide resolved
// https://github.com/SinergiaTIC/SinergiaCRM/pull/406
// Avoid sending the reminder to any guest if the guest does not already exist in the CRM, as it causes an error that prevents the “Run Email Reminder Notifications” task from finishing correctly

// Prevent a deleted contact, user, etc. from being deleted in order for the task to run
if($personBean != false) {
// END STIC-Custom
if ($checkDecline && !self::isDecline($event, $personBean)) {
if (!empty($personBean->email1)) {
$arr = array(
'type' => $inviteeModule,
'name' => $personBean->full_name,
'email' => $personBean->email1,
);
$emails[] = $arr;
}
}
}
}
Expand All @@ -264,7 +273,13 @@ private static function getUnsentEmailReminders()
if ($eventBean) {
$remind_ts = $timedate->fromUser($eventBean->date_start)->modify("-{$reminderBean->timer_email} seconds")->ts;
$now_ts = $timedate->getNow()->ts;
if ($now_ts >= $remind_ts) {

// STIC-Custom 20241001 ART - Do not send a reminder if the meeting has already taken place
// https://github.com/SinergiaTIC/SinergiaCRM/pull/406
// if ($now_ts >= $remind_ts) {
$event_ts = $timedate->fromUser($eventBean->date_start)->ts;
if ($now_ts >= $remind_ts && $now_ts <= $event_ts) {
// END STIC-Custom
$reminders[$reminderBean->id] = $reminderBean;
}
} else {
Expand Down
Loading