Bläddra i källkod

[backend] distribution/index : redirection vers le tableau de bord si aucun produit ou point de vente de saisi

refactoring
Guillaume Bourgeois 5 år sedan
förälder
incheckning
7c53298478
3 ändrade filer med 15 tillägg och 5 borttagningar
  1. +10
    -0
      backend/controllers/BackendController.php
  2. +2
    -0
      backend/controllers/DistributionController.php
  3. +3
    -5
      backend/controllers/SubscriptionController.php

+ 10
- 0
backend/controllers/BackendController.php Visa fil

@@ -42,6 +42,16 @@ use common\models\Producer ;

class BackendController extends \common\controllers\CommonController
{
/**
* Vérifie si l'utilisateur a au moins saisi un produit et un point de vente.
* Si ce n'est pas le cas : redirection vers le tableau de bord.
*/
public function checkProductsPointsSale()
{
if (!Product::searchCount() || !PointSale::searchCount()) {
$this->redirect(['site/index', 'error_products_points_sale' => 1]);
}
}

}


+ 2
- 0
backend/controllers/DistributionController.php Visa fil

@@ -77,6 +77,8 @@ class DistributionController extends BackendController
public function actionIndex($date = '')
{
$this->checkProductsPointsSale() ;
$format = 'Y-m-d' ;
$theDate = '' ;
$dateObject = DateTime::createFromFormat($format, $date);

+ 3
- 5
backend/controllers/SubscriptionController.php Visa fil

@@ -68,10 +68,8 @@ class SubscriptionController extends BackendController
*/
public function actionIndex()
{
if (!Product::searchCount() || !PointSale::searchCount()) {
$this->redirect(['site/index', 'error_products_points_sale' => 1]);
}

$this->checkProductsPointsSale() ;
$searchModel = new SubscriptionSearch ;
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
@@ -87,7 +85,7 @@ class SubscriptionController extends BackendController
* @return string
*/
public function actionCreate($idOrder = 0)
{
{
// form
$model = new SubscriptionForm;
$model->id_producer = Producer::getId();

Laddar…
Avbryt
Spara