Skip to content

Commit c14a053

Browse files
yhabteabnilmerg
authored andcommitted
Don't try access interval elem when ANNUALLY freq is selected
1 parent 45ab6c2 commit c14a053

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/FormElement/ScheduleElement.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,10 @@ protected function assemble()
502502
$isValid = $this->isValid();
503503
$reason = null;
504504
if (! $isValid && $this->getFrequency() === static::CUSTOM_EXPR) {
505-
if (! $this->getElement('interval')->isValid()) {
505+
if (
506+
$this->getCustomFrequency() !== RRule::YEARLY
507+
&& ! $this->getElement('interval')->isValid()
508+
) {
506509
$reason = current($this->getElement('interval')->getMessages());
507510
} else {
508511
$frequency = $this->getCustomFrequency();
@@ -511,9 +514,13 @@ protected function assemble()
511514
$reason = current($this->weeklyField->getMessages());
512515

513516
break;
514-
default: // monthly
517+
case RRule::MONTHLY:
515518
$reason = current($this->monthlyFields->getMessages());
516519

520+
break;
521+
default: // annually
522+
$reason = current($this->annuallyFields->getMessages());
523+
517524
break;
518525
}
519526
}

0 commit comments

Comments
 (0)