|
|
@@ -118,11 +118,7 @@ class PointSaleController extends BackendController |
|
|
|
{ |
|
|
|
$distributionModule = $this-> getDistributionModule(); |
|
|
|
$pointSaleModule = $this->getPointSaleModule(); |
|
|
|
|
|
|
|
$model = PointSale::find() |
|
|
|
->with('userPointSale') |
|
|
|
->where(['id' => $id]) |
|
|
|
->one(); |
|
|
|
$model = $this->findModel($id); |
|
|
|
|
|
|
|
foreach ($model->userPointSale as $userPointSale) { |
|
|
|
$model->users[] = $userPointSale->id_user; |
|
|
@@ -240,10 +236,15 @@ class PointSaleController extends BackendController |
|
|
|
*/ |
|
|
|
protected function findModel(int $id) |
|
|
|
{ |
|
|
|
if (($model = PointSale::findOne($id)) !== null) { |
|
|
|
return $model; |
|
|
|
} else { |
|
|
|
throw new NotFoundHttpException('The requested page does not exist.'); |
|
|
|
$model = PointSale::find() |
|
|
|
->with('userPointSale') |
|
|
|
->where(['id' => $id]) |
|
|
|
->one(); |
|
|
|
|
|
|
|
if(!$model || $model->id_producer != $this->getProducerCurrent()->id) { |
|
|
|
throw new NotFoundHttpException('Le point de vente demandé est introuvable.'); |
|
|
|
} |
|
|
|
|
|
|
|
return $model; |
|
|
|
} |
|
|
|
} |