Skip to content

Commit

Permalink
Merge pull request #1248 from dasgarner/release23
Browse files Browse the repository at this point in the history
Release 2.3.12
  • Loading branch information
dasgarner authored Sep 8, 2021
2 parents 7ec5d79 + c150fd7 commit 19effac
Show file tree
Hide file tree
Showing 5 changed files with 311 additions and 262 deletions.
31 changes: 24 additions & 7 deletions lib/Entity/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ class Schedule implements \JsonSerializable

private $datesToFormat = ['toDt', 'fromDt'];

private $dayPart = null;

/**
* @var ConfigServiceInterface
*/
Expand Down Expand Up @@ -517,6 +519,11 @@ public function validate()
. ', CampaignId: ' . $this->campaignId
. ', CommandId: ' . $this->commandId);

// If we are a custom day part, make sure we don't have a fromDt which is way in the past
if ($this->isCustomDayPart() && $this->fromDt < Date::now()->subYears(10)->format('U')) {
throw new InvalidArgumentException(__('The from date is too far in the past.'), 'fromDt');
}

if ($this->eventTypeId == Schedule::$LAYOUT_EVENT ||
$this->eventTypeId == Schedule::$CAMPAIGN_EVENT ||
$this->eventTypeId == Schedule::$OVERLAY_EVENT ||
Expand Down Expand Up @@ -1236,7 +1243,8 @@ private function calculateDayPartTimes($start, $end)
// End is always based on Start
$end->setTimestamp($start->format('U'));

$dayPart = $this->dayPartFactory->getById($this->dayPartId);
// Get the day part
$dayPart = $this->getDayPart();

$this->getLog()->debug('Start and end time for dayPart is ' . $dayPart->startTime . ' - ' . $dayPart->endTime);

Expand Down Expand Up @@ -1367,16 +1375,27 @@ private function unlinkDisplayGroups()
$this->getStore()->update($sql, $params);
}

/**
* @return \Xibo\Entity\DayPart
* @throws \Xibo\Exception\NotFoundException
*/
private function getDayPart()
{
if ($this->dayPart === null) {
$this->dayPart = $this->dayPartFactory->getById($this->dayPartId);
}

return $this->dayPart;
}

/**
* Is this event an always daypart event
* @return bool
* @throws \Xibo\Exception\NotFoundException
*/
public function isAlwaysDayPart()
{
$dayPart = $this->dayPartFactory->getById($this->dayPartId);

return $dayPart->isAlways === 1;
return $this->getDayPart()->isAlways === 1;
}

/**
Expand All @@ -1386,9 +1405,7 @@ public function isAlwaysDayPart()
*/
public function isCustomDayPart()
{
$dayPart = $this->dayPartFactory->getById($this->dayPartId);

return $dayPart->isCustom === 1;
return $this->getDayPart()->isCustom === 1;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Helper/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
class Environment
{
public static $WEBSITE_VERSION_NAME = '2.3.11';
public static $WEBSITE_VERSION_NAME = '2.3.12';
public static $XMDS_VERSION = '5';
public static $XLF_VERSION = 3;
public static $VERSION_REQUIRED = '7.0.8';
Expand Down
Binary file modified locale/de.mo
Binary file not shown.
Loading

0 comments on commit 19effac

Please sign in to comment.