Skip to content

Commit

Permalink
Fix: Schedule Event add form modal not closing on save when Criteria …
Browse files Browse the repository at this point in the history
…is added (#2649)

relates to xibosignage/xibo#3444
  • Loading branch information
nadzpogi authored Jul 24, 2024
1 parent f294f68 commit a2304fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Entity/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,11 @@ public function setOwner($ownerId)
*/
public function addOrUpdateCriteria(ScheduleCriteria $criteria, ?int $id = null): Schedule
{
// set empty array as the default value if original value is empty/null
$originalValue = $this->getOriginalValue('criteria') ?? [];

// Does this already exist?
foreach ($this->getOriginalValue('criteria') as $existing) {
foreach ($originalValue as $existing) {
if ($id !== null && $existing->id === $id) {
$this->criteria[] = $criteria;
return $this;
Expand Down

0 comments on commit a2304fa

Please sign in to comment.