class BackendController extends \common\controllers\CommonController | 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]); | |||||
} | |||||
} | |||||
} | } | ||||
public function actionIndex($date = '') | public function actionIndex($date = '') | ||||
{ | { | ||||
$this->checkProductsPointsSale() ; | |||||
$format = 'Y-m-d' ; | $format = 'Y-m-d' ; | ||||
$theDate = '' ; | $theDate = '' ; | ||||
$dateObject = DateTime::createFromFormat($format, $date); | $dateObject = DateTime::createFromFormat($format, $date); |
*/ | */ | ||||
public function actionIndex() | public function actionIndex() | ||||
{ | { | ||||
if (!Product::searchCount() || !PointSale::searchCount()) { | |||||
$this->redirect(['site/index', 'error_products_points_sale' => 1]); | |||||
} | |||||
$this->checkProductsPointsSale() ; | |||||
$searchModel = new SubscriptionSearch ; | $searchModel = new SubscriptionSearch ; | ||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams); | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function actionCreate($idOrder = 0) | public function actionCreate($idOrder = 0) | ||||
{ | |||||
{ | |||||
// form | // form | ||||
$model = new SubscriptionForm; | $model = new SubscriptionForm; | ||||
$model->id_producer = Producer::getId(); | $model->id_producer = Producer::getId(); |