Skip to content

Commit

Permalink
Fixed various PHP8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Apr 12, 2023
1 parent 2e1805e commit b2a7448
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ public function onLogInputFieldCallback(DataContainer $dc)
return $template->parse();
}

public function prepareOrderLog(DataContainer $dc)
public function prepareOrderLog(DataContainer $dc): void
{
// Do not handle order log when toggling the notification subpalette
if ('toggleSubpalette' === Input::post('action')) {
Expand Down Expand Up @@ -757,7 +757,7 @@ public function prepareOrderLog(DataContainer $dc)
/**
* On data container submit callback.
*/
public function writeOrderLog($dc)
public function writeOrderLog($dc): void
{
if (empty($GLOBALS['ISO_ORDER_LOG']) || ($order = Order::findByPk($dc->id)) === null) {
return;
Expand Down Expand Up @@ -810,7 +810,7 @@ public function writeOrderLog($dc)
$blnNotificationError = null;

// Send a notification
if ($logData['sendNotification'] && $logData['notification'] && ($objNotification = Notification::findByPk($logData['notification'])) !== null) {
if (($logData['sendNotification'] ?? false) && ($logData['notification'] ?? null) && ($objNotification = Notification::findByPk($logData['notification'])) !== null) {
$objOldStatus = OrderStatus::findByPk($oldOrderStatus);
$objNewStatus = OrderStatus::findByPk($order->order_status);

Expand Down
19 changes: 14 additions & 5 deletions system/modules/isotope/library/Isotope/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,10 +654,10 @@ public static function loadPageConfig($objPage)

// Define the static URL constants
$isDebugMode = System::getContainer()->getParameter('kernel.debug');
\define('TL_FILES_URL', ($objPage->staticFiles != '' && !$isDebugMode) ? $objPage->staticFiles . TL_PATH . '/' : '');
\define('TL_ASSETS_URL', ($objPage->staticPlugins != '' && !$isDebugMode) ? $objPage->staticPlugins . TL_PATH . '/' : '');
\define('TL_SCRIPT_URL', TL_ASSETS_URL);
\define('TL_PLUGINS_URL', TL_ASSETS_URL);
self::define('TL_FILES_URL', ($objPage->staticFiles != '' && !$isDebugMode) ? $objPage->staticFiles . TL_PATH . '/' : '');
self::define('TL_ASSETS_URL', ($objPage->staticPlugins != '' && !$isDebugMode) ? $objPage->staticPlugins . TL_PATH . '/' : '');
self::define('TL_SCRIPT_URL', TL_ASSETS_URL);
self::define('TL_PLUGINS_URL', TL_ASSETS_URL);

$objLayout = Database::getInstance()->prepare("
SELECT l.*, t.templates
Expand All @@ -673,7 +673,7 @@ public static function loadPageConfig($objPage)
$objPage->templateGroup = $objLayout->templates;

// Store the output format
[$strFormat, $strVariant] = explode('_', $objLayout->doctype);
[$strFormat, $strVariant] = explode('_', $objLayout->doctype) + [null, null];
$objPage->outputFormat = $strFormat;
$objPage->outputVariant = $strVariant;
}
Expand Down Expand Up @@ -872,4 +872,13 @@ private static function setLanguage($language)

System::loadLanguageFile('default', $language, true);
}

private static function define(string $constant_name, $value): void
{
if (defined($constant_name)) {
return;
}

\define($constant_name, $value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected function generatePDF(IsotopeProductCollection $objCollection, array $a
*/
protected function generateTemplate(IsotopeProductCollection $objCollection, array $arrTokens)
{
$objPage = PageModel::findWithDetails($objCollection->page_id);
$objPage = PageModel::findWithDetails($objCollection->pageId);

/** @var Template|\stdClass $objTemplate */
$objTemplate = new Template($this->documentTpl);
Expand All @@ -177,9 +177,9 @@ protected function generateTemplate(IsotopeProductCollection $objCollection, arr
$objTemplate->collection = $objCollection;
$objTemplate->config = $objCollection->getConfig();
$objTemplate->page = $objPage;
$objTemplate->dateFormat = $objPage->dateFormat ?: $GLOBALS['TL_CONFIG']['dateFormat'];
$objTemplate->timeFormat = $objPage->timeFormat ?: $GLOBALS['TL_CONFIG']['timeFormat'];
$objTemplate->datimFormat = $objPage->datimFormat ?: $GLOBALS['TL_CONFIG']['datimFormat'];
$objTemplate->dateFormat = $objPage->dateFormat ?? $GLOBALS['TL_CONFIG']['dateFormat'];
$objTemplate->timeFormat = $objPage->timeFormat ?? $GLOBALS['TL_CONFIG']['timeFormat'];
$objTemplate->datimFormat = $objPage->datimFormat ?? $GLOBALS['TL_CONFIG']['datimFormat'];

// Render the collection
$objCollectionTemplate = new Template($this->collectionTpl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
<div class="clear">&nbsp;</div>
</div>
<?php endforeach; ?>
<div class="subtotal"><span class="label"><?= $GLOBALS['TL_LANG']['MSC']['subTotalLabel'] ?></span> <?= $this->subtotal ?></div><?php if ($this->buttons['cart']): ?>
<div class="subtotal"><span class="label"><?= $GLOBALS['TL_LANG']['MSC']['subTotalLabel'] ?></span> <?= $this->subtotal ?></div><?php if ($this->buttons['cart'] ?? null): ?>
<div class="cart"><a class="button" href="<?= $this->buttons['cart']['href'] ?>"><?= $this->buttons['cart']['label'] ?></a></div><?php endif; if ($this->buttons['checkout'] ?? null): ?>
<div class="checkout"><a class="button dark" href="<?= $this->buttons['checkout']['href'] ?>"><?= $this->buttons['checkout']['label'] ?></a></div><?php endif; ?>

0 comments on commit b2a7448

Please sign in to comment.