Browse Source

Remove reminder_time column, as the cron job uses SQL to calculate the time

merge-requests/1/head
Mike Koch 6 years ago
parent
commit
2863fb82e2
  1. 21
      cron/calendar_reminders.php
  2. 1
      install/mods-for-hesk/sql/installSql.php

21
cron/calendar_reminders.php

@ -29,9 +29,24 @@ if ($hesk_settings['debug_mode']) {
}
// Get all reminders that have a reminder date that is now or earlier, and an email has not been sent for the event yet.
// The reminder time is calculated by
$sql = "SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder`
WHERE `reminder_time` <= NOW()
/*
* Reminder units:
* 0 - minutes
* 1 - hours
* 2 - days
* 3 - weeks
*/
$sql = "SELECT `reminder`.`id`, `reminder`.`user_id`, `reminder`.`event_id`,
CASE
WHEN `unit` = '0' THEN DATE_SUB(`event`.`start`, INTERVAL `reminder`.`amount` MINUTE)
WHEN `unit` = '1' THEN DATE_SUB(`event`.`start`, INTERVAL `reminder`.`amount` HOUR)
WHEN `unit` = '2' THEN DATE_SUB(`event`.`start`, INTERVAL `reminder`.`amount` DAY)
WHEN `unit` = '3' THEN DATE_SUB(`event`.`start`, INTERVAL `reminder`.amount` WEEK)
END AS `reminder_date`
FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` AS `reminder`
INNER JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event` AS `event`
ON `reminder`.`event_id` = `event`.`id`
WHERE `reminder_date` <= NOW()
AND `email_sent` = '0'";
$rs = hesk_dbQuery($sql);

1
install/mods-for-hesk/sql/installSql.php

@ -735,7 +735,6 @@ function execute260Scripts()
`event_id` INT NOT NULL,
`amount` INT NOT NULL,
`unit` INT NOT NULL,
`reminder_time` DATETIME NOT NULL,
`email_sent` ENUM('0', '1') NOT NULL DEFAULT '0') ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `due_date` DATETIME");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `color` VARCHAR(7)");

Loading…
Cancel
Save