Skip to content

Commit

Permalink
Don't try access interval elem when ANNUALLY freq is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab authored and nilmerg committed May 12, 2023
1 parent 45ab6c2 commit c14a053
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/FormElement/ScheduleElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,10 @@ protected function assemble()
$isValid = $this->isValid();
$reason = null;
if (! $isValid && $this->getFrequency() === static::CUSTOM_EXPR) {
if (! $this->getElement('interval')->isValid()) {
if (
$this->getCustomFrequency() !== RRule::YEARLY
&& ! $this->getElement('interval')->isValid()
) {
$reason = current($this->getElement('interval')->getMessages());
} else {
$frequency = $this->getCustomFrequency();
Expand All @@ -511,9 +514,13 @@ protected function assemble()
$reason = current($this->weeklyField->getMessages());

break;
default: // monthly
case RRule::MONTHLY:
$reason = current($this->monthlyFields->getMessages());

break;
default: // annually
$reason = current($this->annuallyFields->getMessages());

break;
}
}
Expand Down

0 comments on commit c14a053

Please sign in to comment.