Skip to content
Snippets Groups Projects
Commit ec939a8a authored by Thomas Citharel's avatar Thomas Citharel
Browse files

Merge branch 'framadate-bug/limit_end_date_when_updating_poll' into 'develop'

Limit end date when updating poll (#336)

See merge request framasoft/framadate/framadate!372
parents 0fb67345 2e87e1f7
No related branches found
No related tags found
No related merge requests found
......@@ -33,10 +33,16 @@ class AdminPollService {
function updatePoll($poll) {
global $config;
if ($poll->end_date > $poll->creation_date) {
return $this->pollRepository->update($poll);
$end_date = strtotime($poll->end_date);
if ($end_date < strtotime($poll->creation_date)) {
$poll->end_date = $poll->creation_date;
} elseif ($end_date > $this->pollService->maxExpiryDate()) {
$poll->end_date = utf8_encode(strftime('%Y-%m-%d', $this->pollService->maxExpiryDate()));
}
return false;
return $this->pollRepository->update($poll);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment