diff --git a/bin/notification/stack_letterbox_alerts.php b/bin/notification/stack_letterbox_alerts.php index 372949e060507fd4cbce310b255098a7ce66fad7..c4cb92f7a4dbede2348499977ee2e8c9913a99f5 100644 --- a/bin/notification/stack_letterbox_alerts.php +++ b/bin/notification/stack_letterbox_alerts.php @@ -75,7 +75,7 @@ while ($state <> 'END') { $user = $users[0]; // Alert 1 = limit - n days - if ($myDoc['flag_alarm1'] != 'Y' && $myDoc['flag_alarm2'] != 'Y') { + if ($myDoc['flag_alarm1'] != 'Y' && $myDoc['flag_alarm2'] != 'Y' && $myDoctype['delay1'] > 0) { $processDate = \Resource\controllers\IndexingController::calculateProcessDate(['date' => $myDoc['process_limit_date'], 'delay' => $myDoctype['delay1'], 'sub' => true]); if (strtotime($processDate) <= time()) { Bt_writeLog(['level' => 'INFO', 'message' => "Alarm 1 will be sent"]); @@ -96,7 +96,7 @@ while ($state <> 'END') { } // Alert 2 = limit + n days - if ($myDoc['flag_alarm2'] != 'Y') { + if ($myDoc['flag_alarm2'] != 'Y' && $myDoctype['delay2'] > 0) { $processDate = \Resource\controllers\IndexingController::calculateProcessDate(['date' => $myDoc['process_limit_date'], 'delay' => $myDoctype['delay2']]); if (strtotime($processDate) <= time()) { Bt_writeLog(['level' => 'INFO', 'message' => "Alarm 2 will be sent"]); diff --git a/src/app/resource/controllers/IndexingController.php b/src/app/resource/controllers/IndexingController.php index 1d3dd4af728ab9945f7aa6156fd0a1727909b641..e67a60c93cf6d4190bbaa7a9231d7e3e97051345 100755 --- a/src/app/resource/controllers/IndexingController.php +++ b/src/app/resource/controllers/IndexingController.php @@ -233,10 +233,13 @@ class IndexingController if (!empty($queryParams['doctype'])) { $doctype = DoctypeModel::getById(['id' => $queryParams['doctype'], 'select' => ['process_delay']]); - $delay = $doctype['process_delay']; + $delay = $doctype['process_delay']; } elseif (!empty($queryParams['priority'])) { $priority = PriorityModel::getById(['id' => $queryParams['priority'], 'select' => ['delays']]); - $delay = $priority['delays']; + $delay = $priority['delays']; + } + if ($delay == 0) { + return $response->withJson(['processLimitDate' => null]); } if (!isset($delay) || !Validator::intVal()->validate($delay)) { return $response->withStatus(400)->withJson(['errors' => 'Delay is not a numeric value']);