@@ -47,8 +47,18 @@ class BackendController extends CommonController | |||
{ | |||
public function beforeAction($event) | |||
{ | |||
$producerCurrent = $this->getProducerCurrent(); | |||
// Contexte producteur | |||
$this->getLogic()->setProducerContext($this->getProducerCurrent()); | |||
if($producerCurrent) { | |||
$this->getLogic()->setProducerContext($producerCurrent); | |||
} | |||
// Pas de producteur défini | |||
if(!$producerCurrent) { | |||
$this->redirect(\Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/index'])); | |||
return false; | |||
} | |||
return parent::beforeAction($event); | |||
} | |||
@@ -64,7 +74,7 @@ class BackendController extends CommonController | |||
} | |||
} | |||
public function getProducerCurrent(): Producer | |||
public function getProducerCurrent(): ?Producer | |||
{ | |||
return Producer::searchOne(); | |||
} |
@@ -80,7 +80,7 @@ $producerManager = $this->getProducerManager(); | |||
<section class="content"> | |||
<?php $producer = GlobalParam::getCurrentProducer(); ?> | |||
<?php if(!$producerManager->isUpToDateWithOpendistribVersion($producer) && $producer->option_display_message_new_opendistrib_version): ?> | |||
<?php if($producer && !$producerManager->isUpToDateWithOpendistribVersion($producer) && $producer->option_display_message_new_opendistrib_version): ?> | |||
<div class="alert alert-warning"> | |||
<p>Opendistrib a été mis à jour vers la version <?= GlobalParam::getOpendistribVersion() ?> ! <a class="alert-link" href="<?= Yii::$app->urlManager->createUrl(['development/index']) ?>">Découvrir les nouveautés</a></p> | |||
<a href="<?= Yii::$app->urlManager->createUrl(['producer/update-opendistrib-version']) ?>" class="close"><span aria-hidden="true">×</span></a> |
@@ -50,7 +50,7 @@ $userManager = $this->getUserManager(); | |||
<?php | |||
$producer = GlobalParam::getCurrentProducer(); | |||
$newVersionOpendistribTemplate = ''; | |||
if(!$producerManager->isUpToDateWithOpendistribVersion($producer)) { | |||
if($producer && !$producerManager->isUpToDateWithOpendistribVersion($producer)) { | |||
$newVersionOpendistribTemplate = '<span class="pull-right-container"><small class="label pull-right bg-orange"> </small></span>'; | |||
} | |||
?> |
@@ -342,6 +342,7 @@ class OrderController extends ProducerBaseController | |||
$errorPointSale = false; | |||
if (isset($distribution) && $distribution) { | |||
$order->populateDistribution($distribution); | |||
$pointSale = $pointSaleManager->findOnePointSaleById($posts['Order']['id_point_sale']); | |||
$pointSaleDistribution = $pointSaleDistributionManager->findOnePointSaleDistribution($distribution, $pointSale); | |||