소스 검색

[Espace producteur] Mes commandes : correctif ordre des commandes

feature/souke
Guillaume Bourgeois 1 년 전
부모
커밋
abd2952ac8
4개의 변경된 파일32개의 추가작업 그리고 4개의 파일을 삭제
  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 파일 보기

@@ -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 파일 보기

@@ -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 파일 보기

@@ -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 파일 보기

@@ -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;
}

Loading…
취소
저장