Browse Source

Merge branch 'dev'

master
Guillaume Bourgeois 5 years ago
parent
commit
33968b563b
8 changed files with 21 additions and 8 deletions
  1. +5
    -0
      backend/controllers/DistributionController.php
  2. +1
    -1
      backend/controllers/OrderController.php
  3. +2
    -1
      backend/controllers/ProductController.php
  4. +2
    -2
      backend/controllers/StatsController.php
  5. +5
    -2
      backend/views/product/_form.php
  6. +2
    -0
      common/models/Distribution.php
  7. +2
    -2
      common/models/Product.php
  8. +2
    -0
      common/models/User.php

+ 5
- 0
backend/controllers/DistributionController.php View File

foreach($productsArray as &$theProduct) { foreach($productsArray as &$theProduct) {
$quantityOrder = Order::getProductQuantity($theProduct['id'], $ordersArray) ; $quantityOrder = Order::getProductQuantity($theProduct['id'], $ordersArray) ;
$theProduct['quantity_ordered'] = $quantityOrder ; $theProduct['quantity_ordered'] = $quantityOrder ;
if(!isset($theProduct['productDistribution'][0])) {
$theProduct['productDistribution'][0] = $distribution->linkProduct($theProduct) ;
}
if(!is_numeric($theProduct['productDistribution'][0]['quantity_max'])) { if(!is_numeric($theProduct['productDistribution'][0]['quantity_max'])) {
$theProduct['quantity_remaining'] = null ; $theProduct['quantity_remaining'] = null ;
} }

+ 1
- 1
backend/controllers/OrderController.php View File

$distribution) { $distribution) {
$order = new Order; $order = new Order;
$order->date = date('Y-m-d H:i:s', strtotime($date . ' ' . date('H:i:s')));
$order->date = date('Y-m-d H:i:s') ;
$order->id_point_sale = $idPointSale; $order->id_point_sale = $idPointSale;
$order->id_distribution = $distribution->id; $order->id_distribution = $distribution->id;
$order->origin = Order::ORIGIN_ADMIN; $order->origin = Order::ORIGIN_ADMIN;

+ 2
- 1
backend/controllers/ProductController.php View File

Yii::$app->getSession()->setFlash('success', 'Produit <strong>'.Html::encode($model->name).'</strong> ajouté'); Yii::$app->getSession()->setFlash('success', 'Produit <strong>'.Html::encode($model->name).'</strong> ajouté');


return $this->redirect(['index']); return $this->redirect(['index']);
} else {
}
else {
return $this->render('create', [ return $this->render('create', [
'model' => $model, 'model' => $model,
]); ]);

+ 2
- 2
backend/controllers/StatsController.php View File

*/ */


$dateStart = date('Y-m-d', time() - 60 * 60 * 24 * 365); $dateStart = date('Y-m-d', time() - 60 * 60 * 24 * 365);
$dateEnd = date('Y-m-d');
$dateEnd = date('Y-m-d', time() + 60 * 60 * 24 * 31);


$data = []; $data = [];


// création d'un tableau sans index car chart.js n'accepte pas les index // création d'un tableau sans index car chart.js n'accepte pas les index
$dataNoIndex = []; $dataNoIndex = [];
foreach ($data as $key => $val) { foreach ($data as $key => $val) {
$dataNoIndex[] = $val;
$dataNoIndex[] = round($val, 2);
} }


return $this->render('index', [ return $this->render('index', [

+ 5
- 2
backend/views/product/_form.php View File



<div class="product-form"> <div class="product-form">


<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
'options' => ['enctype' => 'multipart/form-data']
]); ?>


<div> <div>
<div class="col-md-8"> <div class="col-md-8">
if(!$model->isNewRecord) { if(!$model->isNewRecord) {
echo $form->field($model, 'apply_distributions') echo $form->field($model, 'apply_distributions')
->checkbox() ->checkbox()
->hint('Sélectionnez cette option si vous souhaitez que ces modifications soient répercutées dans les distributions à venir déjà initialisées.');
->hint('Sélectionnez cette option si vous souhaitez que ces modifications (actif / non actif, quantité max) soient répercutées dans les distributions à venir déjà initialisées.');
} }
?> ?>
</div> </div>

+ 2
- 0
common/models/Distribution.php View File

} }


$productDistribution->save(); $productDistribution->save();
return $productDistribution ;
} }
/** /**

+ 2
- 2
common/models/Product.php View File

class Product extends ActiveRecordCommon class Product extends ActiveRecordCommon
{ {
var $total = 0; var $total = 0;
var $apply_distributions = false ;
var $apply_distributions = true ;
public static $unitsArray = [ public static $unitsArray = [
'piece' => [ 'piece' => [
[['name', 'description', 'photo', 'unit'], 'string', 'max' => 255], [['name', 'description', 'photo', 'unit'], 'string', 'max' => 255],
[['recipe'], 'string', 'max' => 1000], [['recipe'], 'string', 'max' => 1000],
['step', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) { ['step', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
if($model->unit == 'piece') {
if($model->unit != 'piece') {
return true ; return true ;
} }
return false ; return false ;

+ 2
- 0
common/models/User.php View File

'id' => 'ID', 'id' => 'ID',
'name' => 'Prénom', 'name' => 'Prénom',
'lastname' => 'Nom', 'lastname' => 'Nom',
'phone' => 'Téléphone',
'address' => 'Adresse',
'username' => 'Identifiant', 'username' => 'Identifiant',
'password' => 'Mot de passe', 'password' => 'Mot de passe',
'rememberMe' => 'Se souvenir de moi', 'rememberMe' => 'Se souvenir de moi',

Loading…
Cancel
Save