ソースを参照

fixed sql for Notify get todo list

Piotr Labudda 10 年 前
コミット
9659fe00f1
2 ファイル変更10 行追加2 行削除
  1. 1 1
      SE/se-lib/Route/Cron.php
  2. 9 1
      SE/se-lib/Route/Notify.php

+ 1 - 1
SE/se-lib/Route/Cron.php

@@ -103,7 +103,7 @@ class Route_Cron extends RouteBase {
 			$timeSendLimitFrom = mktime(8, 0, 0, date('n'), date('j'), date('Y'));
 			$timeSendLimitTo = mktime(20, 0, 0, date('n'), date('j'), date('Y'));
 			if ($timeNow > $timeSendLimitFrom && $timeNow < $timeSendLimitTo) {
-				$todoReminders = $notify->getTodoList(100);
+				$todoReminders = $notify->getTodoList(2);
 			}
 		}
 

+ 9 - 1
SE/se-lib/Route/Notify.php

@@ -725,7 +725,15 @@ function refreshPreview() {
 		$sth = DB::getPDO()->prepare("
 			select n.`who`, n.`when`, n.`what`, UNIX_TIMESTAMP(n.last_exec_time) as last_exec_time
 			from ADMIN_USERS u
-				left join CRM_NOTIFY n on(n.`who` = u.ADM_ACCOUNT)
+				left join CRM_NOTIFY n on(n.`who` = u.ADM_ACCOUNT
+					and (
+						n.`when` = 'once_a_day' and (
+								n.last_exec_time is null
+								or DATE(n.last_exec_time) < CURDATE()
+							)
+						-- TODO add `or` with another `when` values
+					)
+				)
 			where u.A_STATUS = 'NORMAL'
 				and u.EMPLOYEE_TYPE = 'Pracownik'
 				and n.`who` is not null