Selaa lähdekoodia

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

feature/souke
Guillaume Bourgeois 9 kuukautta sitten
vanhempi
commit
c15bdde14d
1 muutettua tiedostoa jossa 10 lisäystä ja 9 poistoa
  1. +10
    -9
      backend/controllers/PointSaleController.php

+ 10
- 9
backend/controllers/PointSaleController.php Näytä tiedosto

@@ -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…
Peruuta
Tallenna