소스 검색

Activer/désactiver les points de vente : adaptations

prodstable
keun 7 년 전
부모
커밋
73bdc55002
3개의 변경된 파일19개의 추가작업 그리고 14개의 파일을 삭제
  1. +17
    -8
      backend/controllers/CommandeController.php
  2. +0
    -5
      backend/views/commande/index.php
  3. +2
    -1
      common/models/ProductionPointVente.php

+ 17
- 8
backend/controllers/CommandeController.php 파일 보기

@@ -280,6 +280,22 @@ class CommandeController extends BackendController {
->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement,])
->all();
}
// production_point_vente à définir s'ils ne sont pas initialisés
if($production && $production->actif) {
$count_productions_point_vente = self::find()->
where([
'id_production' => $production->id
])
->count() ;
ProductionPointVente::setAll($production->id, true) ;
}
if(!$count_productions_point_vente)
{
ProductionPointVente::setAll() ;
}

// produits
$produits = Produit::getAll() ;
@@ -817,17 +833,10 @@ class CommandeController extends BackendController {
$production->actif = $actif;
$production->save();
if($actif)
{
// add commandes automatiques
CommandeAuto::addAll($date) ;
// livraisons
ProductionPointVente::setAll($production->id, true) ;
}
else {
ProductionPointVente::setAll($production->id, false) ;
CommandeAuto::addAll($date) ;
}
$this->redirect(['index', 'date' => $date]);

+ 0
- 5
backend/views/commande/index.php 파일 보기

@@ -54,11 +54,6 @@ foreach ($produits as $p) {
<br />

<?php if ($production->actif): ?>
<strong>Livraison</strong><br />
<div class="btn-group" role="group">
<a class="btn btn-default<?php if ($production->livraison): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison', 'date' => $date, 'livraison' => 1]); ?>">Activé</a>
<a class="btn btn-default<?php if (!$production->livraison): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison', 'date' => $date, 'livraison' => 0]); ?>">Désactivé</a>
</div>
<?php if($production->livraison && count($arr_productions_point_vente)): ?>
<div id="productions-point-vente">
<strong>Points de vente : </strong>

+ 2
- 1
common/models/ProductionPointVente.php 파일 보기

@@ -104,7 +104,8 @@ class ProductionPointVente extends \yii\db\ActiveRecord
($jour == 4 && $production_pv->pointVente->livraison_jeudi) ||
($jour == 5 && $production_pv->pointVente->livraison_vendredi) ||
($jour == 6 && $production_pv->pointVente->livraison_samedi) ||
($jour == 7 && $production_pv->pointVente->livraison_dimanche)
($jour == 7 && $production_pv->pointVente->livraison_dimanche) ||
$production_pv->pointVente->point_fabrication
))
{
$production_pv->livraison = 1 ;

Loading…
취소
저장