Quellcode durchsuchen

Merge branch 'dev'

prodstable
Guillaume Bourgeois vor 5 Jahren
Ursprung
Commit
dfd939f7a6
4 geänderte Dateien mit 19 neuen und 8 gelöschten Zeilen
  1. +1
    -0
      backend/controllers/CronController.php
  2. +11
    -4
      backend/controllers/PointSaleController.php
  3. +4
    -2
      backend/views/point-sale/index.php
  4. +3
    -2
      common/models/Producer.php

+ 1
- 0
backend/controllers/CronController.php Datei anzeigen

@@ -220,6 +220,7 @@ class CronController extends BackendController

if ($hour == '00') {
$date = date('Y-m-d');
$hour = 24 ;
} else {
$date = date('Y-m-d', time() + 24 * 60 * 60);
}

+ 11
- 4
backend/controllers/PointSaleController.php Datei anzeigen

@@ -157,8 +157,10 @@ class PointSaleController extends BackendController
public function initForm($id = 0)
{
$users = User::findBy()
->orderBy('name ASC')
->leftJoin('user_point_sale', 'user_point_sale.id_user = user.id AND user_point_sale.id_point_sale = :id_point_sale',[':id_point_sale' => $id])
->orderBy('user_point_sale.id_point_sale DESC, lastname ASC, name ASC')
->all();
return [
'users' => $users
];
@@ -199,9 +201,14 @@ class PointSaleController extends BackendController
$pointSale = $this->findModel($id) ;
if($pointSale) {
PointSale::updateAll(['default' => 0], 'id_producer = :id_producer', [':id_producer' => Producer::getId()]) ;
$pointSale->default = 1 ;
$pointSale->save() ;
Yii::$app->getSession()->setFlash('success', 'Point de vente <strong>'.Html::encode($pointSale->name).'</strong> défini par défaut.') ;
if(!$pointSale->default) {
$pointSale->default = 1 ;
$pointSale->save() ;
Yii::$app->getSession()->setFlash('success', 'Point de vente <strong>'.Html::encode($pointSale->name).'</strong> défini par défaut.') ;
}
else {
Yii::$app->getSession()->setFlash('success', 'Aucun point de vente défini par défaut') ;
}
}
return $this->redirect(['index']);

+ 4
- 2
backend/views/point-sale/index.php Datei anzeigen

@@ -122,12 +122,14 @@ $this->addButton(['label' => '+', 'url' => 'point-sale/create', 'class' => 'btn
'contentOptions' => ['class' => 'td-default'],
'value' => function($model) {
if($model->default) {
return '<span class="glyphicon glyphicon-star"></span>' ;
return Html::a('<span class="glyphicon glyphicon-star"></span>', ['point-sale/default','id' => $model->id], [
'title' => Yii::t('app', 'Point de vente par défaut'), 'class' => 'btn btn-default'
]);
}
else
{
return Html::a('<span class="glyphicon glyphicon-star-empty"></span>', ['point-sale/default','id' => $model->id], [
'title' => Yii::t('app', 'Point de vente par défaut'), 'class' => 'btn btn-default'
'title' => Yii::t('app', 'Point de vente par défaut'), 'class' => 'btn btn-default'
]);
}

+ 3
- 2
common/models/Producer.php Datei anzeigen

@@ -496,11 +496,12 @@ class Producer extends ActiveRecordCommon
$apiKeysArray = explode(':', $apiKeys) ;
if(count($apiKeysArray) == 2) {
if($type == 'private') {
return $apiKeysArray[1] ;
$key = $apiKeysArray[1] ;
}
else {
return $apiKeysArray[0] ;
$key = $apiKeysArray[0] ;
}
return trim($key) ;
}
}
}

Laden…
Abbrechen
Speichern