Browse Source

Merge branch 'dev'

prodstable
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

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

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

@@ -839,7 +839,7 @@ class OrderController extends BackendController
$distribution) {
$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_distribution = $distribution->id;
$order->origin = Order::ORIGIN_ADMIN;

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

@@ -121,7 +121,8 @@ class ProductController extends BackendController
Yii::$app->getSession()->setFlash('success', 'Produit <strong>'.Html::encode($model->name).'</strong> ajouté');

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

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

@@ -80,7 +80,7 @@ class StatsController extends BackendController
*/

$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 = [];

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

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

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

@@ -48,7 +48,10 @@ use yii\helpers\ArrayHelper ;

<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 class="col-md-8">
@@ -73,7 +76,7 @@ use yii\helpers\ArrayHelper ;
if(!$model->isNewRecord) {
echo $form->field($model, 'apply_distributions')
->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>

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

@@ -265,6 +265,8 @@ class Distribution extends ActiveRecordCommon
}

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

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

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

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

@@ -116,6 +116,8 @@ class User extends ActiveRecordCommon implements IdentityInterface
'id' => 'ID',
'name' => 'Prénom',
'lastname' => 'Nom',
'phone' => 'Téléphone',
'address' => 'Adresse',
'username' => 'Identifiant',
'password' => 'Mot de passe',
'rememberMe' => 'Se souvenir de moi',

Loading…
Cancel
Save