Pārlūkot izejas kodu

[Espace producteur] Mes commandes : correctif ordre des commandes

feature/souke
Guillaume Bourgeois pirms 1 gada
vecāks
revīzija
abd2952ac8
4 mainītis faili ar 32 papildinājumiem un 4 dzēšanām
  1. +18
    -0
      backend/controllers/UserController.php
  2. +9
    -1
      backend/views/user/index.php
  3. +4
    -2
      common/logic/Order/Order/Repository/OrderRepository.php
  4. +1
    -1
      common/logic/Order/Order/Repository/OrderRepositoryQuery.php

+ 18
- 0
backend/controllers/UserController.php Parādīt failu

@@ -571,4 +571,22 @@ class UserController extends BackendController
'usersPointSaleHasOrder' => $usersPointSaleHasOrder,
]);
}

public function actionSwitchIdentity(int $id)
{
$userManager = $this->getUserManager();
if($this->isUserCurrentAdmin()) {
$initialId = Yii::$app->user->getId();
if($initialId != $id) {
$user = $userManager->findOneUserById($id);
$duration = 0;
Yii::$app->user->switchIdentity($user, $duration);
Yii::$app->session->set('user.idbeforeswitch',$initialId);
return $this->redirect(['index']);
}
}
else {
throw new NotFoundHttpException('Page introuvable');
}
}
}

+ 9
- 1
backend/views/user/index.php Parādīt failu

@@ -181,7 +181,7 @@ $this->render('_menu', [
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'template' => '{update} {delete} {switch}',
'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'],
'buttons' => [
@@ -196,6 +196,14 @@ $this->render('_menu', [
return Html::a('<span class="glyphicon glyphicon-trash"></span>', Yii::$app->urlManager->createUrl(array_merge(['user/delete', 'id' => $model->id], Yii::$app->getRequest()->getQueryParams())), [
'title' => 'Supprimer', 'class' => 'btn btn-default btn-confirm-delete'
]);
},
'switch' => function($url, $model) {
$userManager = UserManager::getInstance();
if($userManager->isCurrentAdmin()) {
return Html::a('<span class="glyphicon glyphicon-user"></span>', Yii::$app->urlManager->createUrl(['user/switch-identity', 'id' => $model->id]), [
'title' => 'Prendre la main', 'class' => 'btn btn-default'
]);
}
}
],
],

+ 4
- 2
common/logic/Order/Order/Repository/OrderRepository.php Parādīt failu

@@ -142,11 +142,13 @@ class OrderRepository extends AbstractRepository
{
$queryIncoming = clone $this->createDefaultQuery()
->filterByUser($user)
->filterIsIncoming();
->filterIsIncoming()
->orderByDistributionDate('ASC');

$queryPassed = clone $this->createDefaultQuery()
->filterByUser($user)
->filterIsPassed();
->filterIsPassed()
->orderByDistributionDate('DESC');

return [
'incoming' => $queryIncoming,

+ 1
- 1
common/logic/Order/Order/Repository/OrderRepositoryQuery.php Parādīt failu

@@ -100,7 +100,7 @@ class OrderRepositoryQuery extends AbstractRepositoryQuery

public function orderByDistributionDate(string $order = 'ASC'): self
{
$this->orderBy(['distribution.date' => $order]);
$this->orderBy('distribution.date '.$order );

return $this;
}

Notiek ielāde…
Atcelt
Saglabāt