Bladeren bron

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

feature/souke
Guillaume Bourgeois 9 maanden geleden
bovenliggende
commit
c15bdde14d
1 gewijzigde bestanden met toevoegingen van 10 en 9 verwijderingen
  1. +10
    -9
      backend/controllers/PointSaleController.php

+ 10
- 9
backend/controllers/PointSaleController.php Bestand weergeven

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

Laden…
Annuleren
Opslaan