소스 검색

[Administration] Points de vente : problème possibilité de modifier le point de vente d'un autre producteur

feature/souke
Guillaume Bourgeois 9 달 전
부모
커밋
c15bdde14d
1개의 변경된 파일10개의 추가작업 그리고 9개의 파일을 삭제
  1. +10
    -9
      backend/controllers/PointSaleController.php

+ 10
- 9
backend/controllers/PointSaleController.php 파일 보기

@@ -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;
}
}

Loading…
취소
저장