tweaked filters in send-maintenance-notifications.php
This commit is contained in:
@@ -407,10 +407,17 @@ class MaintenanceNotification extends mfBaseModel {
|
||||
if(array_key_exists("to>", $filter)) {
|
||||
$to = $filter['to>'];
|
||||
if(is_numeric($to)) {
|
||||
$where .= " AND MaintenanceNotification.to >= $to";
|
||||
$where .= " AND MaintenanceNotification.to > $to";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("send_ts<", $filter)) {
|
||||
$send_ts = $filter['send_ts<'];
|
||||
if(is_numeric($send_ts)) {
|
||||
$where .= " AND MaintenanceNotification.send_ts <= $send_ts";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("sent", $filter)) {
|
||||
$sent = $filter['sent'];
|
||||
if($sent === true) {
|
||||
|
||||
@@ -138,18 +138,21 @@ class MaintenanceNotificationController extends mfBaseController {
|
||||
$data["to"] = $to->getTimestamp();
|
||||
|
||||
|
||||
try {
|
||||
$send_ts = new DateTime($r->sendts_day." ".$r->sendts_hour.":00");
|
||||
//var_dump($send_ts);exit;
|
||||
} catch(Exception $e) {
|
||||
$this->layout()->setFlash("Ungültige Versandzeitpunkt", "error");
|
||||
if($mode = "edit") {
|
||||
return $this->editAction();
|
||||
if($r->sendts_day && $r->sendts_hour) {
|
||||
try {
|
||||
$send_ts = new DateTime($r->sendts_day . " " . $r->sendts_hour . ":00");
|
||||
//var_dump($send_ts);exit;
|
||||
} catch(Exception $e) {
|
||||
$this->layout()->setFlash("Ungültige Versandzeitpunkt", "error");
|
||||
if($mode = "edit") {
|
||||
return $this->editAction();
|
||||
}
|
||||
return $this->addAction();
|
||||
}
|
||||
return $this->addAction();
|
||||
$data["send_ts"] = $send_ts->getTimestamp();
|
||||
} else {
|
||||
$data["send_ts"] = null;
|
||||
}
|
||||
$data["send_ts"] = $send_ts->getTimestamp();
|
||||
|
||||
|
||||
if($mode == "add") {
|
||||
$notification = MaintenanceNotification::create($data);
|
||||
|
||||
@@ -16,6 +16,6 @@ define("INTERNAL_USER_ID", $me->id);
|
||||
define("INTERNAL_USER_USERNAME", $me->username);
|
||||
define("MFBASE_BYPASS_LOGIN", true);
|
||||
|
||||
foreach(MaintenanceNotification::searchActive([]) as $notification) {
|
||||
foreach(MaintenanceNotification::searchActive(["send_ts<" => date("U")]) as $notification) {
|
||||
$notification->sendToRecipients();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user