Skip to content

Commit

Permalink
fix sleep value issue that added more occurrences than needed to the …
Browse files Browse the repository at this point in the history
…database.
  • Loading branch information
elabx committed Aug 9, 2024
1 parent c594f01 commit d91d162
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions FieldtypeRecurringDates.module
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,21 @@ class FieldtypeRecurringDates extends FieldtypeMulti
{
$sleepValue = array();
if ($value->rrule) {
$this->saveSettings($page, $field, $value);
foreach ($value->rrule as $date) {
$occurrence_date = new Occurrence();
// TODO
// $occurrence_date->excluded = false;
$occurrence_date->date = $date;
$value->occurrences->add($occurrence_date);

if ($value->occurrences->count() == 0) {
$this->saveSettings($page, $field, $value);
foreach ($value->rrule as $date) {
$occurrence_date = new Occurrence();
// TODO
// $occurrence_date->excluded = false;
$occurrence_date->date = $date;
$value->occurrences->add($occurrence_date);
}
}

$this->saveSettings($page, $field, $value);
}

if (!$value instanceof RecurringDate) return $sleepValue;

foreach ($value->occurrences as $occurrence) {
Expand Down

0 comments on commit d91d162

Please sign in to comment.