Преглед на файлове

Merge branch 'dev'

master
Guillaume Bourgeois преди 5 години
родител
ревизия
701f0cef42
променени са 3 файла, в които са добавени 45 реда и са изтрити 4 реда
  1. +14
    -1
      backend/controllers/UserController.php
  2. +10
    -1
      backend/views/user/emails.php
  3. +21
    -2
      common/models/User.php

+ 14
- 1
backend/controllers/UserController.php Целия файл

@@ -288,11 +288,22 @@ class UserController extends BackendController
* @param integer $idPointSale
* @return mixed
*/
public function actionMail($idPointSale = 0, $sectionSubscribers = 0, $sectionInactiveUsers = 0)
public function actionMail(
$idPointSale = 0,
$sectionSubscribers = 0,
$sectionInactiveUsers = 0,
$usersPointSaleLink = 0,
$usersPointSaleHasOrder = 0)
{
if($idPointSale && !$usersPointSaleLink && !$usersPointSaleHasOrder) {
$usersPointSaleLink = 1 ;
}
$users = User::findBy([
'id_producer' => Producer::getId(),
'id_point_sale' => $idPointSale,
'users_point_sale_link' => $usersPointSaleLink,
'users_point_sale_has_order' => $usersPointSaleHasOrder,
'subscribers' => $sectionSubscribers,
'inactive' => $sectionInactiveUsers,
])->all() ;
@@ -338,6 +349,8 @@ class UserController extends BackendController
'incomingDistributionsArray' => $incomingDistributionsArray,
'sectionSubscribers' => $sectionSubscribers,
'sectionInactiveUsers' => $sectionInactiveUsers,
'usersPointSaleLink' => $usersPointSaleLink,
'usersPointSaleHasOrder' => $usersPointSaleHasOrder,
]);
}


+ 10
- 1
backend/views/user/emails.php Целия файл

@@ -79,9 +79,18 @@ $this->render('_menu',[
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Liste des emails <span class="label label-default"><?= count($usersArray); ?></span></h3>
<h3 class="panel-title">
Liste des emails <span class="label label-default"><?= count($usersArray); ?></span>
</h3>
</div>
<div class="panel-body">
<?php if($idPointSaleActive): ?>
<a class="btn btn-xs <?php if($usersPointSaleLink): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/mail','idPointSale' => $idPointSaleActive, 'usersPointSaleLink' => 1]); ?>">Liés au point de vente</a>
<a class="btn btn-xs <?php if($usersPointSaleHasOrder): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/mail','idPointSale' => $idPointSaleActive, 'usersPointSaleHasOrder' => 1]); ?>">Déjà commandés dans ce point de vente</a>
<br /><br />
<?php endif; ?>
<?= implode(', ', $usersArray); ?>
</div>
</div>

+ 21
- 2
common/models/User.php Целия файл

@@ -309,10 +309,29 @@ class User extends ActiveRecordCommon implements IdentityInterface
if(isset($params['id_point_sale']) && $params['id_point_sale']) {
$point_sale = PointSale::findOne(['id' => $params['id_point_sale']]) ;
if($point_sale->restricted_access) {
$query->innerJoin('user_point_sale','user.id = user_point_sale.id_user AND user_point_sale.id_point_sale = :id_point_sale',[':id_point_sale' => $params['id_point_sale']]) ;
$conditionLinkUserPointSale = 'user.id = user_point_sale.id_user AND user_point_sale.id_point_sale = :id_point_sale' ;
$usersPointSaleLink = false;
$usersPointSaleHasOrder = false;
if(isset($params['users_point_sale_link']) && $params['users_point_sale_link']) {
$usersPointSaleLink = true ;
}
elseif(isset($params['users_point_sale_has_order']) && $params['users_point_sale_has_order']) {
$usersPointSaleHasOrder = true ;
}
elseif($point_sale->restricted_access) {
$usersPointSaleLink = true ;
}
else {
$usersPointSaleHasOrder = true ;
}
if($usersPointSaleLink) {
$query->innerJoin('user_point_sale', 'user.id = user_point_sale.id_user AND user_point_sale.id_point_sale = :id_point_sale',[':id_point_sale' => $params['id_point_sale']]) ;
}
elseif($usersPointSaleHasOrder) {
$query->innerJoin(
'order',
'user.id = order.id_user AND order.id_point_sale = :id_point_sale',

Loading…
Отказ
Запис