Bläddra i källkod

Suppression de la limitation relative aux produits (au moins un produit nécessaire) pour permettre de garder les données d'une commande récurrente sans les produits.

D'autre part, bien notifier et alerter qu'aucune commande ne sera initialisée si aucun produit n'est configuré dans la commande récurrente. Idem pour les jours de production, permettre d'en avoir aucun de configuré mais le notifier dans la liste.
master
keun 8 år sedan
förälder
incheckning
c5c1f70b65
3 ändrade filer med 10 tillägg och 19 borttagningar
  1. +9
    -1
      backend/views/commandeauto/index.php
  2. +1
    -1
      common/models/CommandeAuto.php
  3. +0
    -17
      common/models/CommandeAutoForm.php

+ 9
- 1
backend/views/commandeauto/index.php Visa fil

@@ -46,6 +46,13 @@ $this->params['breadcrumbs'][] = $this->title;
{
$html .= $commande_produit->quantite . ' x '.Html::encode($commande_produit->produit->nom).'<br />' ;
}
// aucun produit
if(!count($model->commandeAutoProduit))
{
$html .= '<span class="glyphicon glyphicon-warning-sign"></span> Aucun produit' ;
}
return $html ;
}
],
@@ -67,6 +74,7 @@ $this->params['breadcrumbs'][] = $this->title;
[
'attribute' => 'lundi',
'label' => 'Jours',
'format' => 'raw',
'value' => function($model) {
$html = '' ;
if($model->lundi)
@@ -87,7 +95,7 @@ $this->params['breadcrumbs'][] = $this->title;
if(strlen($html))
return substr ($html, 0, strlen($html) - 2) ;
else
return '' ;
return '<span class="glyphicon glyphicon-warning-sign"></span> Aucun jour' ;
}
],
[

+ 1
- 1
common/models/CommandeAuto.php Visa fil

@@ -173,7 +173,7 @@ class CommandeAuto extends \yii\db\ActiveRecord
'id_etablissement' => Yii::$app->user->identity->id_etablissement
]) ;
if($production)
if($production && count($this->commandeAutoProduit))
{
// commande
$commande = new Commande ;

+ 0
- 17
common/models/CommandeAutoForm.php Visa fil

@@ -45,23 +45,6 @@ class CommandeAutoForm extends Model
$this->addError($attribute,'Vous devez sélectionner ou saisir un utilisateur.') ;
}
},'skipOnEmpty' => false],
['produits', function($attribute, $params) {
$produits = $this->produits ;
$quantite = 0 ;
if(count($produits))
{
foreach($produits as $name_input => $quantite_produit) {
if($quantite_produit)
$quantite += $quantite_produit ;
}
}
if(!$quantite)
{
$this->addError($attribute, 'Vous devez saisir au moins un produit');
}
}],
];
}

Laddar…
Avbryt
Spara