Updated AdminPollService to limit end_date (#336).
This commit is contained in:
parent
324ac9dfcb
commit
38552da738
@ -33,10 +33,20 @@ 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 = $this->pollService->maxExpiryDate();
|
||||
|
||||
}
|
||||
return false;
|
||||
|
||||
return $this->pollRepository->update($poll);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user