Refactor calculating max/min expiration date and enforce on poll edition

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-12-17 14:08:09 +01:00
parent 9c969f8896
commit 5a5c233a5e
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
6 changed files with 46 additions and 77 deletions

View file

@ -80,7 +80,7 @@ $messagePollCreated = $sessionService->get("Framadate", "messagePollCreated", FA
if ($messagePollCreated) {
$sessionService->remove("Framadate", "messagePollCreated");
$message = new Message('success', __('adminstuds', 'The poll is created.'));
}
@ -137,9 +137,9 @@ if (isset($_POST['update_poll_info'])) {
break;
}
} elseif ($field === 'expiration_date') {
$expiration_date = $inputService->filterDate($_POST['expiration_date']);
$expiration_date = $inputService->validateDate($_POST['expiration_date'], $pollService->minExpiryDate(), $pollService->maxExpiryDate());
if ($expiration_date) {
$poll->end_date = $expiration_date;
$poll->end_date = $expiration_date->getTimestamp();
$updated = true;
}
} elseif ($field === 'name') {