@@ -64,7 +64,7 @@ class AccessController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], | |||
@@ -78,15 +78,15 @@ class AccessController extends BackendController | |||
*/ | |||
public function actionIndex() | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$producer = $this->getProducerCurrent(); | |||
$userSearch = new UserSearch(); | |||
$usersArray = $userSearch->search()->query->all(); | |||
$modelAccessUserProducerForm = new AccessUserProducerForm; | |||
if ($modelAccessUserProducerForm->load(\Yii::$app->request->post()) && $modelAccessUserProducerForm->validate()) { | |||
$user = $userManager->findOneUserById($modelAccessUserProducerForm->id_user); | |||
if($user && $userManager->grantAccess($user)) { | |||
$user = $userModule->findOneUserById($modelAccessUserProducerForm->id_user); | |||
if($user && $userModule->grantAccess($user)) { | |||
$this->setFlash('success', 'Droits ajoutés à l\'utilisateur'); | |||
} | |||
else { | |||
@@ -96,7 +96,7 @@ class AccessController extends BackendController | |||
return $this->render('index', [ | |||
'usersArray' => $usersArray, | |||
'usersAccessArray' => $userManager->findUsersByProducer($producer), | |||
'usersAccessArray' => $userModule->findUsersByProducer($producer), | |||
'producer' => $producer, | |||
'modelAccessUserProducerForm' => $modelAccessUserProducerForm, | |||
]); | |||
@@ -104,10 +104,10 @@ class AccessController extends BackendController | |||
public function actionDelete($idUser) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$user = $userManager->findOneUserById($idUser); | |||
$userModule = $this->getUserModule(); | |||
$user = $userModule->findOneUserById($idUser); | |||
if ($user && $userManager->deleteAccess($user)) { | |||
if ($user && $userModule->deleteAccess($user)) { | |||
$this->addFlash('success', 'Droits de l\'utilisateur supprimé.'); | |||
} | |||
else { |
@@ -66,7 +66,7 @@ class CommunicateAdminController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->isCurrentAdmin(); | |||
return $this->getUserModule()->isCurrentAdmin(); | |||
} | |||
] | |||
], | |||
@@ -77,7 +77,7 @@ class CommunicateAdminController extends BackendController | |||
public function actionIndex($section = 'producers') | |||
{ | |||
$producerManager = $this->getProducerManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
if ($section == 'producers') { | |||
$producers = $producerManager->findProducersActive(); | |||
@@ -96,7 +96,7 @@ class CommunicateAdminController extends BackendController | |||
} | |||
} | |||
} elseif ($section == 'users') { | |||
$users = $userManager->findUsersByStatus(User::STATUS_ACTIVE); | |||
$users = $userModule->findUsersByStatus(User::STATUS_ACTIVE); | |||
$usersArray = []; | |||
foreach ($users as $user) { | |||
if (isset($user['email']) && strlen($user['email'])) { |
@@ -64,7 +64,7 @@ class CommunicateController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], |
@@ -56,7 +56,7 @@ class CreditController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], | |||
@@ -66,11 +66,11 @@ class CreditController extends BackendController | |||
public function actionIndex() | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$userProducerManager = $this->getUserProducerManager(); | |||
$dataProviderUsersWithNegativeCredit = new ActiveDataProvider([ | |||
'query' => $userManager->queryUsersWithNegativeCredit(), | |||
'query' => $userModule->queryUsersWithNegativeCredit(), | |||
'sort' => false, | |||
'pagination' => [ | |||
'pageSize' => 30, | |||
@@ -85,6 +85,6 @@ class CreditController extends BackendController | |||
public function actionExportUsers(string $type) | |||
{ | |||
$this->getUserManager()->exportUsersCreditAsCsv($type); | |||
$this->getUserModule()->exportUsersCreditAsCsv($type); | |||
} | |||
} |
@@ -112,7 +112,7 @@ class CronController extends BackendController | |||
$distributionManager = $this->getDistributionManager(); | |||
$orderManager = $this->getOrderManager(); | |||
$paymentManager = $this->getPaymentManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
if ($key == '64ac0bdab7e9f5e48c4d991ec5201d57') { | |||
ini_set('memory_limit', '-1'); | |||
@@ -164,7 +164,7 @@ class CronController extends BackendController | |||
$orderManager->initOrder($order); | |||
if ($order->auto_payment && $configCredit) { | |||
if ($orderManager->isCreditAutoPayment($order) && $orderManager->getOrderAmount($order, Order::AMOUNT_REMAINING) > 0) { | |||
$paymentManager->payOrder($order, MeanPayment::CREDIT, $userManager->findOneUserById(User::ID_USER_SYSTEM), false); | |||
$paymentManager->payOrder($order, MeanPayment::CREDIT, $userModule->findOneUserById(User::ID_USER_SYSTEM), false); | |||
$countOrders++; | |||
} | |||
} |
@@ -59,7 +59,7 @@ class DashboardController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
], | |||
], |
@@ -60,7 +60,7 @@ class DeliveryNoteController extends DocumentController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], |
@@ -59,7 +59,7 @@ class DevelopmentController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], |
@@ -75,8 +75,8 @@ class DistributionController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
$userManager = $this->getUserManager(); | |||
return $userManager->isCurrentAdmin() || $userManager->isCurrentProducer(); | |||
$userModule = $this->getUserModule(); | |||
return $userModule->isCurrentAdmin() || $userModule->isCurrentProducer(); | |||
} | |||
] | |||
], | |||
@@ -116,7 +116,7 @@ class DistributionController extends BackendController | |||
$distributionManager = $this->getDistributionManager(); | |||
$orderManager = $this->getOrderManager(); | |||
$productManager = $this->getProductManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$producer = $this->getProducerCurrent(); | |||
$format = 'Y-m-d'; | |||
@@ -140,7 +140,7 @@ class DistributionController extends BackendController | |||
$json['points_sale'] = $this->buildAjaxInfosResponsePointsSale($distribution); | |||
$json['delivery_notes'] = $this->buildAjaxInfosResponseDeliveryNotes($date); | |||
$json['order_create'] = $this->buildAjaxInfosResponseOrderCreate($distribution, $productsArray); | |||
$json['users'] = $userManager->findUsers(); | |||
$json['users'] = $userModule->findUsers(); | |||
$json['one_distribution_week_active'] = $distributionManager->isOneDistributionWeekActive($date); | |||
$json['tiller_is_synchro'] = $this->buildAjaxInfosResponseTiller($producer, $date); | |||
$json['missing_subscriptions'] = $this->buildAjaxInfosResponseMissingSubscriptions($date, $distribution, $ordersArrayObject); | |||
@@ -304,7 +304,7 @@ class DistributionController extends BackendController | |||
public function buildAjaxInfosResponseOrders(array $ordersArray, array $productsArray) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$orderManager = $this->getOrderManager(); | |||
$paymentManager = $this->getPaymentManager(); | |||
@@ -344,7 +344,7 @@ class DistributionController extends BackendController | |||
'mean_payment' => $payment->mean_payment, | |||
'wording_mean_payment' => $paymentManager->getStrMeanPayment($payment), | |||
'date' => date('d/m/Y H:i:s', strtotime($payment->date)), | |||
'user' => $payment->getUserObject() ? $userManager->getUsername($payment->getUserObject()) : '', | |||
'user' => $payment->getUserObject() ? $userModule->getUsername($payment->getUserObject()) : '', | |||
'user_action' => $paymentManager->getStrUserAction($payment), | |||
'wording' => $paymentManager->getStrWording($payment, $order), | |||
'amount' => $paymentManager->getAmount($payment, Order::AMOUNT_TOTAL, true), | |||
@@ -353,8 +353,8 @@ class DistributionController extends BackendController | |||
$arrayCreditUser = []; | |||
if(isset($order->user)) { | |||
$arrayCreditUser['credit'] = $userManager->getCredit($order->user); | |||
$arrayCreditUser['credit_active'] = $userManager->getCreditActive($order->user); | |||
$arrayCreditUser['credit'] = $userModule->getCredit($order->user); | |||
$arrayCreditUser['credit_active'] = $userModule->getCreditActive($order->user); | |||
} | |||
$oneProductUnactivated = false; | |||
@@ -472,10 +472,10 @@ class DistributionController extends BackendController | |||
public function actionAjaxPointSaleFavorite($idUser) | |||
{ | |||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$orderManager = $this->getOrderManager(); | |||
$user = $userManager->findOneUserById($idUser); | |||
$user = $userModule->findOneUserById($idUser); | |||
$idFavoritePointSale = 0; | |||
if($user) { | |||
@@ -501,13 +501,13 @@ class DistributionController extends BackendController | |||
$distributionManager = $this->getDistributionManager(); | |||
$orderManager = $this->getOrderManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$productManager = $this->getProductManager(); | |||
$order = $orderManager->findOneOrderById($idOrder); | |||
$distribution = $distributionManager->findOneDistributionById($idDistribution); | |||
$user = $userManager->findOneUserById($idUser); | |||
$user = $userModule->findOneUserById($idUser); | |||
$pointSale = $pointSaleManager->findOnePointSaleById($idPointSale); | |||
$productsArray = Product::find() |
@@ -76,7 +76,7 @@ class DocumentController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], | |||
@@ -415,7 +415,7 @@ class DocumentController extends BackendController | |||
public function actionAjaxUserInfos($typeAction, $idUser, $classDocument, $idDocument = false) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$documentManager = $this->getDocumentManager(); | |||
$orderManager = $this->getOrderManager(); | |||
$producerManager = $this->getProducerManager(); | |||
@@ -424,7 +424,7 @@ class DocumentController extends BackendController | |||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |||
if ($idUser > 0) { | |||
$user = $userManager->findOneUserById($idUser); | |||
$user = $userModule->findOneUserById($idUser); | |||
if ($user) { | |||
$document = null; | |||
@@ -435,7 +435,7 @@ class DocumentController extends BackendController | |||
if ($document && $document->id_user == $user->id) { | |||
$address = $document->address; | |||
} else { | |||
$address = $userManager->getFullAddress($user); | |||
$address = $userModule->getFullAddress($user); | |||
} | |||
$json = [ |
@@ -69,8 +69,8 @@ class OrderController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->isCurrentProducer() | |||
|| $this->getUserManager()->isCurrentAdmin(); | |||
return $this->getUserModule()->isCurrentProducer() | |||
|| $this->getUserModule()->isCurrentAdmin(); | |||
} | |||
] | |||
], | |||
@@ -773,7 +773,7 @@ class OrderController extends BackendController | |||
$distributionManager = $this->getDistributionManager(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$userPointSaleManager = $this->getUserPointSaleManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$userProducerManager = $this->getUserProducerManager(); | |||
$producerManager = $this->getProducerManager(); | |||
$productManager = $this->getProductManager(); | |||
@@ -803,7 +803,7 @@ class OrderController extends BackendController | |||
$order->id_user = $idUser; | |||
// commentaire du point de vente | |||
$userPointSale = $userPointSaleManager->findOneUserPointSale($userManager->findOneUserById($idUser), $pointSale); | |||
$userPointSale = $userPointSaleManager->findOneUserPointSale($userModule->findOneUserById($idUser), $pointSale); | |||
if ($userPointSale && strlen($userPointSale->comment)) { | |||
$order->comment_point_sale = $userPointSale->comment; | |||
@@ -885,7 +885,7 @@ class OrderController extends BackendController | |||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |||
$orderManager = $this->getOrderManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$userPointSaleManager = $this->getUserPointSaleManager(); | |||
$paymentManager = $this->getPaymentManager(); | |||
@@ -905,7 +905,7 @@ class OrderController extends BackendController | |||
$order = $orderManager->findOneOrderById($idOrder); | |||
$orderManager->initOrder($order); | |||
$user = $userManager->findOneUserById($idUser); | |||
$user = $userModule->findOneUserById($idUser); | |||
$pointSale = $pointSaleManager->findOnePointSaleById($idPointSale); | |||
if ($order |
@@ -67,7 +67,7 @@ class PointSaleController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
], | |||
], | |||
@@ -153,9 +153,9 @@ class PointSaleController extends BackendController | |||
*/ | |||
public function initForm(int $id = 0) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$users = $userManager->queryUsersBy() | |||
$users = $userModule->queryUsersBy() | |||
->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(); |
@@ -68,7 +68,7 @@ class ProducerAdminController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->isCurrentAdmin(); | |||
return $this->getUserModule()->isCurrentAdmin(); | |||
} | |||
] | |||
], | |||
@@ -183,12 +183,12 @@ class ProducerAdminController extends BackendController | |||
public function actionUserTransfer($fromProducerId, $toProducerId, $withOrders = 1) | |||
{ | |||
$producerManager = $this->getProducerManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$fromProducerId = (int)$fromProducerId; | |||
$toProducerId = (int)$toProducerId; | |||
$count = 0; | |||
$usersArray = $userManager->queryUsersBy(['id_producer' => $fromProducerId])->all(); | |||
$usersArray = $userModule->queryUsersBy(['id_producer' => $fromProducerId])->all(); | |||
foreach ($usersArray as $user) { | |||
$idUser = $user['user_id']; | |||
@@ -203,7 +203,7 @@ class ProducerAdminController extends BackendController | |||
if (($withOrders && $countOrders) || !$withOrders) { | |||
$producerManager->addUser( | |||
$userManager->findOneUserById($idUser), | |||
$userModule->findOneUserById($idUser), | |||
$producerManager->findOneProducerById($toProducerId) | |||
); | |||
$count++; |
@@ -72,7 +72,7 @@ class ProducerController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], |
@@ -65,7 +65,7 @@ class ProducerPriceRangeAdminController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->isCurrentAdmin(); | |||
return $this->getUserModule()->isCurrentAdmin(); | |||
} | |||
] | |||
], |
@@ -67,7 +67,7 @@ class ProductCategoryController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
], | |||
], |
@@ -80,7 +80,7 @@ class ProductController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], | |||
@@ -380,7 +380,7 @@ class ProductController extends BackendController | |||
$productPriceManager = $this->getProductPriceManager(); | |||
$userGroupManager = $this->getUserGroupManager(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$model = new ProductPriceUploadForm(); | |||
@@ -416,7 +416,7 @@ class ProductController extends BackendController | |||
$price = (float) str_replace(',', '.', $productPriceCsv[5]); | |||
$product = $productName ? $productManager->findOneProductByName($productName) : null; | |||
$user = (count($userArray) > 1) ? $userManager->findOneUserById((int)$userArray[1]) : null; | |||
$user = (count($userArray) > 1) ? $userModule->findOneUserById((int)$userArray[1]) : null; | |||
$userGroup = $userGroupName ? $userGroupManager->findOneUserGroupByName($userGroupName) : null; | |||
$pointSale = $pointSaleName ? $pointSaleManager->findOnePointSaleByName($pointSaleName) : null; | |||
@@ -484,7 +484,7 @@ class ProductController extends BackendController | |||
{ | |||
$productManager = $this->getProductManager(); | |||
$productPriceManager = $this->getProductPriceManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$data = []; | |||
@@ -517,7 +517,7 @@ class ProductController extends BackendController | |||
if($productPrice->user || $productPrice->userGroup || $productPrice->pointSale || $productPrice->from_quantity) { | |||
$data[] = [ | |||
$product->name, | |||
$productPrice->user ? str_replace('#', '', $userManager->getUsername($productPrice->user)).' #'.$productPrice->user->id : '', | |||
$productPrice->user ? str_replace('#', '', $userModule->getUsername($productPrice->user)).' #'.$productPrice->user->id : '', | |||
$productPrice->userGroup ? $productPrice->userGroup->name : '', | |||
$productPrice->pointSale ? $productPrice->pointSale->name : '', | |||
$productPrice->from_quantity ?? '', |
@@ -64,7 +64,7 @@ class QuotationController extends DocumentController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], |
@@ -57,7 +57,7 @@ class ReportController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], | |||
@@ -75,11 +75,11 @@ class ReportController extends BackendController | |||
{ | |||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$distributionManager = $this->getDistributionManager(); | |||
$usersArray = $userManager->findUsers(); | |||
$usersArray = $userModule->findUsers(); | |||
$pointsSaleArray = $pointSaleManager->findPointSales(); | |||
$firstDistribution = $distributionManager->findOneFirstDistribution(); | |||
$lastDistribution = $distributionManager->findOneLastDistribution(); |
@@ -67,7 +67,7 @@ class SiteController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
], | |||
[ | |||
@@ -75,7 +75,7 @@ class SiteController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->getCurrentStatus() == User::STATUS_ADMIN; | |||
return $this->getUserModule()->getCurrentStatus() == User::STATUS_ADMIN; | |||
} | |||
], | |||
], | |||
@@ -139,7 +139,7 @@ class SiteController extends BackendController | |||
$producer = $this->getProducerContainer()->getRepository()->findOneProducerById($id); | |||
if($producer) { | |||
$this->getUserContainer()->getBuilder()->switchProducer($user, $producer); | |||
$this->getUserModule()->getServices()->getBuilder()->switchProducer($user, $producer); | |||
} | |||
else { | |||
$this->addFlash('error', 'Producteur introuvable.'); |
@@ -57,7 +57,7 @@ class StatsController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], |
@@ -58,7 +58,7 @@ class SubscriptionController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], |
@@ -62,7 +62,7 @@ class SupportAdminController extends SupportController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->isCurrentAdmin(); | |||
return $this->getUserModule()->isCurrentAdmin(); | |||
} | |||
] | |||
], |
@@ -62,7 +62,7 @@ class SupportController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], |
@@ -49,6 +49,7 @@ use common\logic\PointSale\UserPointSale\Model\UserPointSale; | |||
use common\logic\Payment\Model\Payment; | |||
use common\logic\User\User\Model\User; | |||
use common\logic\User\User\Model\UserSearch; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use common\logic\User\UserProducer\Model\UserProducer; | |||
use common\logic\User\UserUserGroup\Model\UserUserGroup; | |||
use yii\base\UserException; | |||
@@ -72,7 +73,7 @@ class UserController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
] | |||
], | |||
@@ -120,15 +121,15 @@ class UserController extends BackendController | |||
public function actionCreate() | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$producerManager = $this->getProducerManager(); | |||
$producerCurrent = $this->getProducerCurrent(); | |||
$model = $userManager->instanciateUser(); | |||
$model = $userModule->instanciateUser(); | |||
$posts = Yii::$app->request->post(); | |||
$userExist = false; | |||
if ($posts && isset($posts['User']['email']) && strlen($posts['User']['email']) > 0) { | |||
$userExist = $userManager->findOneUserByEmail($posts['User']['email']); | |||
$userExist = $userModule->findOneUserByEmail($posts['User']['email']); | |||
} | |||
if ($userExist) { | |||
@@ -140,8 +141,8 @@ class UserController extends BackendController | |||
if ($model->load(\Yii::$app->request->post()) && $model->validate() && YII_ENV != 'demo') { | |||
$model->id_producer = 0; | |||
$password = Password::generate(); | |||
$userManager->setPassword($model, $password); | |||
$userManager->generateAuthKey($model); | |||
$userModule->setPassword($model, $password); | |||
$userModule->generateAuthKey($model); | |||
$model->username = $model->email; | |||
if (!strlen($model->email)) { | |||
$model->username = 'inconnu@opendistrib.net'; | |||
@@ -158,13 +159,13 @@ class UserController extends BackendController | |||
$useProducer->newsletter = $model->newsletter; | |||
$useProducer->save(); | |||
$userManager->sendMailWelcome($model, $password); | |||
$userModule->sendMailWelcome($model, $password); | |||
$this->processLinkPointSale($model); | |||
$this->processLinkUserGroup($model); | |||
$this->processProductPricePercent($model); | |||
$this->setFlash('success', 'Utilisateur créé.'); | |||
$model = $userManager->instanciateUser(); | |||
$model = $userModule->instanciateUser(); | |||
} | |||
} | |||
@@ -176,7 +177,7 @@ class UserController extends BackendController | |||
public function actionUpdate($id) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$model = $this->findModel($id); | |||
@@ -190,22 +191,22 @@ class UserController extends BackendController | |||
// on envoie le mail de bienvenue si le mail vient d'être défini | |||
if (!strlen($previousMail) && strlen($model->email)) { | |||
$password = Password::generate(); | |||
$userManager->setPassword($model, $password); | |||
$userModule->setPassword($model, $password); | |||
$model->username = $model->email; | |||
$userManager->sendMailWelcome($model, $password); | |||
$userModule->sendMailWelcome($model, $password); | |||
} | |||
$this->processLinkPointSale($model); | |||
$this->processLinkUserGroup($model); | |||
$this->processProductPricePercent($model); | |||
if($model->newsletter) { | |||
$userManager->subscribeUserNewsletter($model); | |||
$userModule->subscribeUserNewsletter($model); | |||
} | |||
else { | |||
$userManager->unsubscribeUserNewsletter($model); | |||
$userModule->unsubscribeUserNewsletter($model); | |||
} | |||
$this->setFlash('success', 'Utilisateur <strong>'.Html::encode($userManager->getUsername($model)).'</strong> modifié.'); | |||
$this->setFlash('success', 'Utilisateur <strong>'.Html::encode($userModule->getUsername($model)).'</strong> modifié.'); | |||
return $this->redirect(['index']); | |||
} | |||
@@ -217,7 +218,7 @@ class UserController extends BackendController | |||
$newPassword = Yii::$app->request->post('submit_new_password'); | |||
if ($newPassword) { | |||
$password = Password::generate(); | |||
$userManager->setPassword($model, $password); | |||
$userModule->setPassword($model, $password); | |||
$model->save(); | |||
$producer = $this->getProducerCurrent(); | |||
@@ -234,7 +235,7 @@ class UserController extends BackendController | |||
$producer | |||
); | |||
$this->setFlash('success', 'Nouveau mot de passe envoyé à <strong>'.Html::encode($userManager->getUsername($model)).'</strong>.'); | |||
$this->setFlash('success', 'Nouveau mot de passe envoyé à <strong>'.Html::encode($userModule->getUsername($model)).'</strong>.'); | |||
return $this->redirect(['index']); | |||
} | |||
@@ -361,10 +362,10 @@ class UserController extends BackendController | |||
*/ | |||
public function actionDelete(int $id) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$userProducerManager = $this->getUserProducerManager(); | |||
$user = $userManager->findOneUserById($id); | |||
$user = $userModule->findOneUserById($id); | |||
$userProducer = $userProducerManager->findOneUserProducer($user); | |||
if ($userProducer) { | |||
@@ -390,11 +391,11 @@ class UserController extends BackendController | |||
*/ | |||
public function actionCredit(int $id) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$paymentContainer = $this->getPaymentContainer(); | |||
$userProducerContainer = $this->getUserProducerContainer(); | |||
$user = $userManager->findOneUserById($id); | |||
$user = $userModule->findOneUserById($id); | |||
$userProducer = $userProducerContainer->getRepository()->findOneUserProducer($user); | |||
if ($userProducer) { | |||
@@ -435,10 +436,10 @@ class UserController extends BackendController | |||
*/ | |||
public function actionStateCredit($idUser, $state) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$userProducerManager = $this->getUserProducerManager(); | |||
$user = $userManager->findOneUserById($idUser); | |||
$user = $userModule->findOneUserById($idUser); | |||
$userProducer = $userProducerManager->findOneUserProducer($user); | |||
if ($userProducer) { | |||
@@ -457,9 +458,9 @@ class UserController extends BackendController | |||
*/ | |||
public function actionOrders($id) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$user = $userManager->findOneUserById($id); | |||
$user = $userModule->findOneUserById($id); | |||
$searchModel = new OrderSearch(); | |||
$dataProvider = $searchModel->search(array_merge(\Yii::$app->request->queryParams, ['id_user' => $id])); | |||
@@ -476,9 +477,9 @@ class UserController extends BackendController | |||
*/ | |||
protected function findModel($id) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
if (($user = $userManager->findOneUserById($id)) !== null) { | |||
if (($user = $userModule->findOneUserById($id)) !== null) { | |||
return $user; | |||
} else { | |||
throw new NotFoundHttpException("Utilisateur introuvable"); | |||
@@ -495,14 +496,14 @@ class UserController extends BackendController | |||
$usersPointSaleLink = 0, | |||
$usersPointSaleHasOrder = 0) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$distributionManager = $this->getDistributionManager(); | |||
if ($idPointSale && !$usersPointSaleLink && !$usersPointSaleHasOrder) { | |||
$usersPointSaleLink = 1; | |||
} | |||
$users = $userManager->queryUsersBy([ | |||
$users = $userModule->queryUsersBy([ | |||
'id_producer' => GlobalParam::getCurrentProducerId(), | |||
'id_point_sale' => $idPointSale, | |||
'users_point_sale_link' => $usersPointSaleLink, | |||
@@ -578,11 +579,11 @@ class UserController extends BackendController | |||
public function actionSwitchIdentity(int $id) | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
if($this->isUserCurrentAdmin()) { | |||
$initialId = Yii::$app->user->getId(); | |||
if($initialId != $id) { | |||
$user = $userManager->findOneUserById($id); | |||
$user = $userModule->findOneUserById($id); | |||
$duration = 0; | |||
Yii::$app->user->switchIdentity($user, $duration); | |||
Yii::$app->session->set('user.idbeforeswitch',$initialId); |
@@ -68,7 +68,7 @@ class UserGroupController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return $this->getUserManager()->hasAccessBackend(); | |||
return $this->getUserModule()->hasAccessBackend(); | |||
} | |||
], | |||
], |
@@ -40,7 +40,7 @@ namespace backend\models; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Payment\Wrapper\PaymentManager; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use common\logic\User\UserProducer\Wrapper\UserProducerManager; | |||
use yii\base\Model; | |||
@@ -97,13 +97,13 @@ class CreditForm extends Model | |||
*/ | |||
public function save() | |||
{ | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$userProducerManager = UserProducerManager::getInstance(); | |||
$paymentManager = PaymentManager::getInstance(); | |||
if ($this->validate()) { | |||
$user = $userManager->findOneUserById($this->id_user); | |||
$paymentManager->creditOrDebitUser($this->type, $user, $this->amount, $this->mean_payment, $userManager->getCurrent(), $this->comment); | |||
$user = $userModule->findOneUserById($this->id_user); | |||
$paymentManager->creditOrDebitUser($this->type, $user, $this->amount, $this->mean_payment, $userModule->getCurrent(), $this->comment); | |||
// on prévient l'utilisateur que son compte vient d'être crédité | |||
if($this->send_mail) { |
@@ -40,7 +40,7 @@ use yii\helpers\Html ; | |||
use yii\widgets\ActiveForm; | |||
use yii\helpers\ArrayHelper ; | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$this->setTitle('Accès') ; | |||
@@ -55,7 +55,7 @@ $this->setTitle('Accès') ; | |||
</div> | |||
<div class="panel-body"> | |||
<?php $form = ActiveForm::begin(); ?> | |||
<?= $form->field($modelAccessUserProducerForm, 'id_user')->dropDownList( $userManager->populateUserDropdownList(), ['class' => 'select2'])->label(''); ?> | |||
<?= $form->field($modelAccessUserProducerForm, 'id_user')->dropDownList( $userModule->populateUserDropdownList(), ['class' => 'select2'])->label(''); ?> | |||
<?= Html::submitButton('Ajouter', ['class' => 'btn btn-success']) ?> | |||
<?php ActiveForm::end(); ?> | |||
</div> |
@@ -3,7 +3,7 @@ | |||
use common\helpers\Price; | |||
use yii\grid\GridView; | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$this->setTitle('Crédit'); | |||
@@ -43,8 +43,8 @@ GridView::widget([ | |||
'columns' => [ | |||
[ | |||
'label' => 'Client', | |||
'value' => function ($user) use ($userManager) { | |||
return $userManager->getUsernameFromArray($user, true); | |||
'value' => function ($user) use ($userModule) { | |||
return $userModule->getUsernameFromArray($user, true); | |||
} | |||
], | |||
[ |
@@ -41,10 +41,10 @@ use common\logic\Order\Order\Model\Order; | |||
use common\logic\Order\Order\Wrapper\OrderManager; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
use common\logic\Subscription\Subscription\Wrapper\SubscriptionManager; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\helpers\Html ; | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$orderManager = OrderManager::getInstance(); | |||
$subscriptionManager = SubscriptionManager::getInstance(); | |||
$producerManager = ProducerManager::getInstance(); | |||
@@ -158,7 +158,7 @@ $this->setTitle('Tableau de bord'); | |||
<?php foreach($subscriptionsLatestAddedArray as $subscription): ?> | |||
<tr> | |||
<td><?= date('d/m/Y à H:i', strtotime($subscription->created_at)); ?></td> | |||
<td><?= $userManager->getUsername($subscription->user); ?></td> | |||
<td><?= $userModule->getUsername($subscription->user); ?></td> | |||
<td><?= Html::encode($subscription->pointSale->name); ?></td> | |||
<td><?= $subscriptionManager->getProductsListAsHtml($subscription); ?></td> | |||
<td><?= $subscriptionManager->getDaysAsHtml($subscription); ?></td> |
@@ -126,7 +126,7 @@ $this->addBreadcrumb($this->getTitle()); | |||
]; | |||
if ($this->getUserManager()->hasAccessBackend()) { | |||
if ($this->getUserModule()->hasAccessBackend()) { | |||
$columns[] = [ | |||
'header' => 'Priorité', |
@@ -38,7 +38,7 @@ | |||
use common\helpers\MeanPayment;use common\helpers\Price;use common\logic\Document\Document\Wrapper\DocumentManager; | |||
use common\logic\Document\Invoice\Wrapper\InvoiceManager;use common\logic\Payment\Wrapper\PaymentManager;use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\helpers\Html; | |||
use yii\widgets\ActiveForm; | |||
@@ -47,7 +47,7 @@ use yii\widgets\ActiveForm; | |||
$producerManager = ProducerManager::getInstance(); | |||
$documentManager = DocumentManager::getInstance(); | |||
$invoiceManager = InvoiceManager::getInstance(); | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$paymentManager = PaymentManager::getInstance(); | |||
$documentClass = $documentManager->getClass($model); | |||
@@ -73,14 +73,14 @@ $documentClass = $documentManager->getClass($model); | |||
<?php if ($action == 'update'): ?> | |||
<?= $form->field($model, 'id_user', [ | |||
'template' => '{label} <div>{input}</div>' . $userManager->getUsername($model->user), | |||
'template' => '{label} <div>{input}</div>' . $userModule->getUsername($model->user), | |||
])->hiddenInput(); ?> | |||
<?php else: ?> | |||
<?= $form->field($model, 'id_user', [ | |||
'template' => '{label} <a href="' . Yii::$app->urlManager->createUrl(['user/create']) . '" class="btn btn-xs btn-default">Nouvel utilisateur <span class="glyphicon glyphicon-plus"></span></a><div>{input}</div>{hint}', | |||
]) | |||
->dropDownList( | |||
$userManager->populateUserDropdownList(), | |||
$userModule->populateUserDropdownList(), | |||
[ | |||
'@change' => 'changeUser', | |||
'v-model' => 'idUser', |
@@ -5,7 +5,7 @@ use common\logic\Order\Order\Model\Order; | |||
use common\helpers\Price; | |||
$producerManager = $this->getProducerManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$documentManager = $this->getDocumentManager(); | |||
$orderManager = $this->getOrderManager(); | |||
@@ -37,7 +37,7 @@ $documentPriceDecimals = (int) $producerManager->getConfig('option_document_pric | |||
<?php if ($document->address && strlen($document->address) > 0): ?> | |||
<?= nl2br($document->address) ?> | |||
<?php else: ?> | |||
<?= $userManager->getFullAddress($document->user, true); ?> | |||
<?= $userModule->getFullAddress($document->user, true); ?> | |||
<?php endif; ?> | |||
</div> | |||
</div> |
@@ -44,7 +44,7 @@ use common\logic\Order\Order\Model\Order; | |||
$producerManager = $this->getProducerManager(); | |||
$invoiceManager = $this->getInvoiceManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$this->setTitle('Factures'); | |||
$this->addBreadcrumb($this->getTitle()); | |||
@@ -87,8 +87,8 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon- | |||
'headerOptions' => ['class' => 'column-hide-on-mobile'], | |||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | |||
'contentOptions' => ['class' => 'column-hide-on-mobile'], | |||
'value' => function ($invoice) use ($userManager) { | |||
return $userManager->getUsername($invoice->user); | |||
'value' => function ($invoice) use ($userModule) { | |||
return $userModule->getUsername($invoice->user); | |||
} | |||
], | |||
[ |
@@ -38,14 +38,14 @@ | |||
use common\helpers\Price; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\helpers\Html; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$producerManager = ProducerManager::getInstance(); | |||
$producer = GlobalParam::getCurrentProducer(); | |||
@@ -82,7 +82,7 @@ $producer = GlobalParam::getCurrentProducer(); | |||
<div class="navbar-custom-menu"> | |||
<?php | |||
$usersArray = $userManager->queryUsersBy(['id_producer' => GlobalParam::getCurrentProducerId()]) | |||
$usersArray = $userModule->queryUsersBy(['id_producer' => GlobalParam::getCurrentProducerId()]) | |||
->andWhere('CAST(FROM_UNIXTIME(user.created_at) AS date) > \'' . date("Y-m-d", strtotime("-7 days")) . '\'') | |||
->orderBy('created_at DESC') | |||
->all(); | |||
@@ -91,7 +91,7 @@ $producer = GlobalParam::getCurrentProducer(); | |||
<ul class="nav navbar-nav"> | |||
<?php if ($userManager->isCurrentAdmin()): ?> | |||
<?php if ($userModule->isCurrentAdmin()): ?> | |||
<li class="dropdown producer-menu"> | |||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |||
<span class="glyphicon glyphicon-grain"></span> | |||
@@ -232,7 +232,7 @@ $producer = GlobalParam::getCurrentProducer(); | |||
<?php | |||
$usersNegativeCreditArray = $userManager->findUsersWithNegativeCredit(); | |||
$usersNegativeCreditArray = $userModule->findUsersWithNegativeCredit(); | |||
?> | |||
@@ -252,7 +252,7 @@ $producer = GlobalParam::getCurrentProducer(); | |||
<?php foreach ($usersNegativeCreditArray as $user): ?> | |||
<li> | |||
<a href="<?= Yii::$app->urlManagerBackend->createUrl(['user/credit', 'id' => $user['user_id']]); ?>"> | |||
<h5><?= $userManager->getUsernameFromArray($user); ?> | |||
<h5><?= $userModule->getUsernameFromArray($user); ?> | |||
<small> | |||
<i class="fa fa-euro"></i> <?= Price::format($user['credit']); ?> | |||
</small> | |||
@@ -268,7 +268,7 @@ $producer = GlobalParam::getCurrentProducer(); | |||
</ul> | |||
</li> | |||
<?php if ($userManager->isCurrentProducer() || $userManager->isCurrentAdmin()): ?> | |||
<?php if ($userModule->isCurrentProducer() || $userModule->isCurrentAdmin()): ?> | |||
<li> | |||
<a href="<?= Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index', 'slug_producer' => GlobalParam::getCurrentProducer()->slug]); ?>"> | |||
<span class="glyphicon glyphicon-eye-open"></span> |
@@ -42,7 +42,7 @@ use yii\helpers\Html; | |||
use common\logic\Ticket\Ticket\Wrapper\TicketManager; | |||
$producerManager = $this->getProducerManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$userProducerManager = $this->getUserProducerManager(); | |||
$ticketManager = $this->getTicketManager(); | |||
$producer = GlobalParam::getCurrentProducer(); | |||
@@ -61,13 +61,13 @@ $producer = GlobalParam::getCurrentProducer(); | |||
$countTicketsProducerUnreadLabel = ''; | |||
$countTicketsProducerUnread = $ticketManager->countTicketsUnreadByUser($this->getUserCurrent()); | |||
if($countTicketsProducerUnread && !$userManager->isCurrentAdmin()) { | |||
if($countTicketsProducerUnread && !$userModule->isCurrentAdmin()) { | |||
$countTicketsProducerUnreadLabel = '<span class="pull-right-container"><small class="label pull-right bg-green">'.$countTicketsProducerUnread.'</small></span>'; | |||
} | |||
$countTicketsAdminUnreadLabel = ''; | |||
$countTicketsAdminUnread = $ticketManager->countTicketsAdminUnreadByUser($this->getUserCurrent()); | |||
if($countTicketsAdminUnread && $userManager->isCurrentAdmin()) { | |||
if($countTicketsAdminUnread && $userModule->isCurrentAdmin()) { | |||
$countTicketsAdminUnreadLabel = '<span class="pull-right-container"><small class="label pull-right bg-green">'.$countTicketsAdminUnread.'</small></span>'; | |||
} | |||
@@ -81,56 +81,56 @@ $producer = GlobalParam::getCurrentProducer(); | |||
[ | |||
'options' => ['class' => 'sidebar-menu tree', 'data-widget' => 'tree'], | |||
'items' => [ | |||
['label' => "Besoin d'aide ?", 'options' => ['class' => 'header'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => "Besoin d'aide ?", 'options' => ['class' => 'header'], 'visible' => $userModule->isCurrentProducer()], | |||
[ | |||
'label' => 'Support', | |||
'icon' => 'comments', | |||
'url' => ['support/index'], | |||
'visible' => $userManager->isCurrentProducer(), | |||
'visible' => $userModule->isCurrentProducer(), | |||
'template' => '<a href="{url}">{icon} {label}' . $countTicketsProducerUnreadLabel . '</a>' | |||
], | |||
['label' => $producer->name, 'options' => ['class' => 'header'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Tableau de bord', 'icon' => 'dashboard', 'url' => ['/dashboard/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Distributions', 'icon' => 'calendar', 'url' => ['/distribution/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => $producer->name, 'options' => ['class' => 'header'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => 'Tableau de bord', 'icon' => 'dashboard', 'url' => ['/dashboard/index'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => 'Distributions', 'icon' => 'calendar', 'url' => ['/distribution/index'], 'visible' => $userModule->isCurrentProducer()], | |||
[ | |||
'label' => 'Produits', | |||
'icon' => 'clone', | |||
'url' => ['/product/index'], | |||
'visible' => $userManager->isCurrentProducer(), | |||
'visible' => $userModule->isCurrentProducer(), | |||
'active' => Yii::$app->controller->id == 'product', | |||
'items' => [ | |||
['label' => 'Liste', 'icon' => 'th-list', 'url' => ['/product/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Catégories', 'icon' => 'book', 'url' => ['/product-category/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Import prix', 'icon' => 'upload', 'url' => ['/product/price-import'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Liste', 'icon' => 'th-list', 'url' => ['/product/index'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => 'Catégories', 'icon' => 'book', 'url' => ['/product-category/index'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => 'Import prix', 'icon' => 'upload', 'url' => ['/product/price-import'], 'visible' => $userModule->isCurrentProducer()], | |||
] | |||
], | |||
['label' => 'Points de vente', 'icon' => 'map-marker', 'url' => ['/point-sale/index'], 'visible' => $userManager->isCurrentProducer(), 'active' => Yii::$app->controller->id == 'point-sale'], | |||
['label' => 'Points de vente', 'icon' => 'map-marker', 'url' => ['/point-sale/index'], 'visible' => $userModule->isCurrentProducer(), 'active' => Yii::$app->controller->id == 'point-sale'], | |||
[ | |||
'label' => 'Utilisateurs', | |||
'icon' => 'users', | |||
'url' => ['/user/index'], | |||
'items' => [ | |||
['label' => 'Liste', 'icon' => 'th-list', 'url' => ['/user/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Liste', 'icon' => 'th-list', 'url' => ['/user/index'], 'visible' => $userModule->isCurrentProducer()], | |||
[ | |||
'label' => 'Crédit', | |||
'icon' => 'euro', | |||
'url' => ['/credit/index'], | |||
'template' => '<a href="{url}">{icon} {label}' . $sumUserProducerCreditsLabel . '</a>', | |||
'visible' => $userManager->isCurrentProducer() && $producerManager->getConfig('credit') | |||
'visible' => $userModule->isCurrentProducer() && $producerManager->getConfig('credit') | |||
], | |||
['label' => 'Groupes', 'icon' => 'users', 'url' => ['/user-group/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Groupes', 'icon' => 'users', 'url' => ['/user-group/index'], 'visible' => $userModule->isCurrentProducer()], | |||
], | |||
], | |||
['label' => 'Abonnements', 'icon' => 'repeat', 'url' => ['/subscription/index'], 'visible' => $userManager->isCurrentProducer(), 'active' => Yii::$app->controller->id == 'subscription'], | |||
['label' => 'Communiquer', 'icon' => 'bullhorn', 'url' => ['/communicate/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Abonnements', 'icon' => 'repeat', 'url' => ['/subscription/index'], 'visible' => $userModule->isCurrentProducer(), 'active' => Yii::$app->controller->id == 'subscription'], | |||
['label' => 'Communiquer', 'icon' => 'bullhorn', 'url' => ['/communicate/index'], 'visible' => $userModule->isCurrentProducer()], | |||
[ | |||
'label' => 'Documents', | |||
'icon' => 'clone', | |||
'url' => ['/delivery-note/index'], | |||
'items' => [ | |||
['label' => 'Bons de livraison', 'icon' => 'sticky-note-o', 'url' => ['/delivery-note/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Factures', 'icon' => 'sticky-note-o', 'url' => ['/invoice/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Devis', 'icon' => 'sticky-note-o', 'url' => ['/quotation/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Bons de livraison', 'icon' => 'sticky-note-o', 'url' => ['/delivery-note/index'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => 'Factures', 'icon' => 'sticky-note-o', 'url' => ['/invoice/index'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => 'Devis', 'icon' => 'sticky-note-o', 'url' => ['/quotation/index'], 'visible' => $userModule->isCurrentProducer()], | |||
], | |||
], | |||
[ | |||
@@ -138,53 +138,53 @@ $producer = GlobalParam::getCurrentProducer(); | |||
'icon' => 'line-chart', | |||
'url' => ['/stats/index'], | |||
'items' => [ | |||
['label' => 'Chiffre d\'affaire', 'icon' => 'line-chart', 'url' => ['/stats/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Rapports', 'icon' => 'pencil-square-o', 'url' => ['/report/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Produits', 'icon' => 'table', 'url' => ['/stats/products'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Chiffre d\'affaire', 'icon' => 'line-chart', 'url' => ['/stats/index'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => 'Rapports', 'icon' => 'pencil-square-o', 'url' => ['/report/index'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => 'Produits', 'icon' => 'table', 'url' => ['/stats/products'], 'visible' => $userModule->isCurrentProducer()], | |||
], | |||
], | |||
['label' => 'Paramètres', 'icon' => 'cog', 'url' => ['/producer/update'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Accès', 'icon' => 'lock', 'url' => ['/access/index'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => "Opendistrib", 'options' => ['class' => 'header'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Paramètres', 'icon' => 'cog', 'url' => ['/producer/update'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => 'Accès', 'icon' => 'lock', 'url' => ['/access/index'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => "Opendistrib", 'options' => ['class' => 'header'], 'visible' => $userModule->isCurrentProducer()], | |||
[ | |||
'label' => 'Développement', | |||
'icon' => 'code', | |||
'url' => ['/development/index'], | |||
'visible' => $userManager->isCurrentProducer(), | |||
'visible' => $userModule->isCurrentProducer(), | |||
'active' => Yii::$app->controller->id == 'development', | |||
'template' => '<a href="{url}">{icon} {label}' . $newVersionOpendistribLabel . '</a>' | |||
], | |||
['label' => 'Tarifs', 'icon' => 'euro', 'url' => ['/producer/billing'], 'visible' => $userManager->isCurrentProducer()], | |||
['label' => 'Tarifs', 'icon' => 'euro', 'url' => ['/producer/billing'], 'visible' => $userModule->isCurrentProducer()], | |||
['label' => 'Administration', 'options' => ['class' => 'header'], 'visible' => $userManager->isCurrentAdmin()], | |||
['label' => 'Administration', 'options' => ['class' => 'header'], 'visible' => $userModule->isCurrentAdmin()], | |||
[ | |||
'label' => 'Tickets', | |||
'icon' => 'comments', | |||
'url' => ['support-admin/index'], | |||
'visible' => $userManager->isCurrentAdmin(), | |||
'visible' => $userModule->isCurrentAdmin(), | |||
'template' => '<a href="{url}">{icon} {label}' . $countTicketsAdminUnreadLabel . '</a>' | |||
], | |||
['label' => 'Producteurs', 'icon' => 'th-list', 'url' => ['/producer-admin/index'], 'visible' => $userManager->isCurrentAdmin()], | |||
['label' => 'Producteurs', 'icon' => 'th-list', 'url' => ['/producer-admin/index'], 'visible' => $userModule->isCurrentAdmin()], | |||
[ | |||
'label' => 'Statistiques', | |||
'icon' => 'line-chart', | |||
'url' => ['/stats-admin/matomo'], | |||
'visible' => $userManager->isCurrentAdmin(), | |||
'visible' => $userModule->isCurrentAdmin(), | |||
'items' => [ | |||
['label' => 'Matomo', 'icon' => 'line-chart', 'url' => ['/stats-admin/matomo'], 'visible' => $userManager->isCurrentAdmin()], | |||
['label' => 'Chiffre d\'affaire', 'icon' => 'line-chart', 'url' => ['/stats-admin/turnover'], 'visible' => $userManager->isCurrentAdmin()], | |||
['label' => 'Commandes clients', 'icon' => 'calendar', 'url' => ['/stats-admin/customer-orders'], 'visible' => $userManager->isCurrentAdmin()], | |||
['label' => 'Matomo', 'icon' => 'line-chart', 'url' => ['/stats-admin/matomo'], 'visible' => $userModule->isCurrentAdmin()], | |||
['label' => 'Chiffre d\'affaire', 'icon' => 'line-chart', 'url' => ['/stats-admin/turnover'], 'visible' => $userModule->isCurrentAdmin()], | |||
['label' => 'Commandes clients', 'icon' => 'calendar', 'url' => ['/stats-admin/customer-orders'], 'visible' => $userModule->isCurrentAdmin()], | |||
], | |||
], | |||
['label' => 'Tranches de prix', 'icon' => 'eur', 'url' => ['/producer-price-range-admin/index'], 'visible' => $userManager->isCurrentAdmin()], | |||
['label' => 'Taxes', 'icon' => 'eur', 'url' => ['/tax-rate-admin/index'], 'visible' => $userManager->isCurrentAdmin()], | |||
['label' => 'Communiquer', 'icon' => 'bullhorn', 'url' => ['/communicate-admin/index'], 'visible' => $userManager->isCurrentAdmin()], | |||
['label' => 'Tranches de prix', 'icon' => 'eur', 'url' => ['/producer-price-range-admin/index'], 'visible' => $userModule->isCurrentAdmin()], | |||
['label' => 'Taxes', 'icon' => 'eur', 'url' => ['/tax-rate-admin/index'], 'visible' => $userModule->isCurrentAdmin()], | |||
['label' => 'Communiquer', 'icon' => 'bullhorn', 'url' => ['/communicate-admin/index'], 'visible' => $userModule->isCurrentAdmin()], | |||
//['label' => 'Outils', 'options' => ['class' => 'header'], 'visible' => $userManager->isCurrentAdmin()], | |||
//['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii'], 'visible' => $userManager->isCurrentAdmin()], | |||
//['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug'], 'visible' => $userManager->isCurrentAdmin()], | |||
['label' => 'Login', 'url' => ['site/login'], 'visible' => !$userManager->isCurrentConnected()], | |||
//['label' => 'Outils', 'options' => ['class' => 'header'], 'visible' => $userModule->isCurrentAdmin()], | |||
//['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii'], 'visible' => $userModule->isCurrentAdmin()], | |||
//['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug'], 'visible' => $userModule->isCurrentAdmin()], | |||
['label' => 'Login', 'url' => ['site/login'], 'visible' => !$userModule->isCurrentConnected()], | |||
], | |||
] | |||
) ?> |
@@ -40,10 +40,10 @@ use yii\helpers\Html; | |||
use yii\widgets\ActiveForm; | |||
use yii\helpers\ArrayHelper; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
$producerManager = $this->getProducerManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
?> | |||
@@ -58,7 +58,7 @@ $userManager = $this->getUserManager(); | |||
<?= $form->field($model, 'id_user', [ | |||
'template' => '{label} <a href="' . Yii::$app->urlManager->createUrl(['user/create']) . '" class="btn btn-xs btn-default">Nouvel utilisateur <span class="glyphicon glyphicon-plus"></span></a><div>{input}</div>{hint}', | |||
]) | |||
->dropDownList($userManager->populateUserDropdownList(), ['class' => 'select2']) | |||
->dropDownList($userModule->populateUserDropdownList(), ['class' => 'select2']) | |||
->hint('Utilisé lors de la facturation'); ?> | |||
<?php | |||
$addHintCredit = ''; | |||
@@ -126,8 +126,8 @@ $userManager = $this->getUserManager(); | |||
. 'Dans le cas des boîtes à pain, il vous est possible de spécifier un commentaire pour chaque utilisateur sélectionné afin de lui renseigner son numéro de boîte ou son code.') ?> | |||
<div id="users"> | |||
<?= Html::activeCheckboxList($model, 'users', ArrayHelper::map($users, 'user_id', function ($model_user, $defaultValue) use ($model) { | |||
$userManager = UserManager::getInstance(); | |||
return Html::encode($userManager->getUsernameFromArray($model_user)) . '<br />' | |||
$userModule = UserModule::getInstance(); | |||
return Html::encode($userModule->getUsernameFromArray($model_user)) . '<br />' | |||
. Html::activeTextInput( | |||
$model, | |||
'users_comment[' . $model_user['user_id'] . ']', |
@@ -43,7 +43,7 @@ use common\logic\Config\TaxRate\Model\TaxRate; | |||
use common\logic\Document\Document\Model\Document; | |||
use yii\helpers\ArrayHelper; | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
\backend\assets\VuejsProducerUpdateAsset::register($this); | |||
$this->setTitle('Paramètres'); | |||
@@ -53,7 +53,7 @@ $this->addBreadcrumb($this->getTitle()); | |||
<script> | |||
var appInitValues = { | |||
isAdmin: <?= (int) $userManager->isCurrentAdmin() ?> | |||
isAdmin: <?= (int) $userModule->isCurrentAdmin() ?> | |||
}; | |||
</script> | |||
@@ -4,7 +4,7 @@ use yii\helpers\Html; | |||
use yii\bootstrap\ActiveForm; | |||
use common\helpers\GlobalParam; | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$userGroupManager = $this->getUserGroupManager(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$productManager = $this->getProductManager(); | |||
@@ -24,7 +24,7 @@ $productManager = $this->getProductManager(); | |||
'options' => ['enctype' => 'multipart/form-data'] | |||
]); ?> | |||
<?= $form->field($model, 'id_user')->dropDownList($userManager->populateUserDropdownList()); ?> | |||
<?= $form->field($model, 'id_user')->dropDownList($userModule->populateUserDropdownList()); ?> | |||
<?= $form->field($model, 'id_user_group')->dropDownList($userGroupManager->populateUserGroupDropdownList()); ?> | |||
<?= $form->field($model, 'id_point_sale')->dropDownList($pointSaleManager->populatePointSaleDropdownList()); ?> | |||
<?= $form->field($model, 'from_quantity')->label('À partir de la quantité ('. $productManager->strUnit($productManager->getRefUnit($modelProduct->unit), 'wording').')'); ?> |
@@ -36,14 +36,14 @@ | |||
* termes. | |||
*/ | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\helpers\Html; | |||
use common\helpers\Price; | |||
use yii\grid\GridView; | |||
use common\logic\Product\Product\Wrapper\ProductManager; | |||
$productManager = ProductManager::getInstance(); | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$this->setTitle('Liste des prix (' . Html::encode($model->name) . ')'); | |||
$this->addBreadcrumb(['label' => 'Produits', 'url' => ['index']]); | |||
@@ -81,9 +81,9 @@ $this->render('../_nav', [ | |||
[ | |||
'attribute' => 'id_user', | |||
'format' => 'raw', | |||
'value' => function ($model) use ($userManager) { | |||
'value' => function ($model) use ($userModule) { | |||
if ($model->user) { | |||
return $userManager->getUsername($model->user); | |||
return $userModule->getUsername($model->user); | |||
} | |||
return '<span class="label label-success">Tous</span>'; | |||
} |
@@ -42,7 +42,7 @@ use common\logic\Order\Order\Model\Order; | |||
use yii\helpers\Html; | |||
$quotationManager = $this->getQuotationManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$this->setTitle('Devis'); | |||
$this->addBreadcrumb($this->getTitle()); | |||
@@ -84,8 +84,8 @@ $this->addButton(['label' => 'Nouveau devis <span class="glyphicon glyphicon-plu | |||
'headerOptions' => ['class' => 'column-hide-on-mobile'], | |||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | |||
'contentOptions' => ['class' => 'column-hide-on-mobile'], | |||
'value' => function ($quotation) use ($userManager) { | |||
return $userManager->getUsername($quotation->user); | |||
'value' => function ($quotation) use ($userModule) { | |||
return $userModule->getUsername($quotation->user); | |||
} | |||
], | |||
[ |
@@ -43,7 +43,7 @@ use common\logic\Subscription\Subscription\Model\Subscription; | |||
\backend\assets\VuejsSubscriptionFormAsset::register($this); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
?> | |||
@@ -54,7 +54,7 @@ $pointSaleManager = $this->getPointSaleManager(); | |||
<?= $form->field($model, 'id')->hiddenInput() ?> | |||
<?php endif; ?> | |||
<div class="col-md-5" id="bloc-select-user"> | |||
<?= $form->field($model, 'id_user')->dropDownList($userManager->populateUserDropdownList(), ['class' => 'select2']); ?> | |||
<?= $form->field($model, 'id_user')->dropDownList($userModule->populateUserDropdownList(), ['class' => 'select2']); ?> | |||
</div> | |||
<div class="col-md-1" id="or-user"> | |||
<span>OU</span> |
@@ -1,12 +1,12 @@ | |||
<?php | |||
use common\logic\Ticket\Ticket\Wrapper\TicketManager; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\helpers\Html; | |||
use yii\widgets\ActiveForm; | |||
$ticketManager = TicketManager::getInstance(); | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$this->setTitle('Voir un ticket'); | |||
$this->addBreadcrumb(['label' => 'Support', 'url' => ['index']]); | |||
$this->addBreadcrumb('Voir un ticket'); | |||
@@ -29,7 +29,7 @@ $this->addBreadcrumb('Voir un ticket'); | |||
<td><strong>Statut</strong></td> | |||
<td><?= $ticketManager->getTicketStatusLabelAsHtml($ticket); ?></td> | |||
</tr> | |||
<?php if($userManager->isCurrentAdmin()): ?> | |||
<?php if($userModule->isCurrentAdmin()): ?> | |||
<tr> | |||
<td><strong>Producteur</strong></td> | |||
<td><?= $ticketManager->isTicketUnread($ticket, $ticket->user) ? | |||
@@ -50,10 +50,10 @@ $this->addBreadcrumb('Voir un ticket'); | |||
<a name="bottom"></a> | |||
<?php endif; ?> | |||
<a name="<?= $ticketMessage->id ?>"></a> | |||
<i class="fa fa-user <?= $userManager->isAdmin($ticketMessage->user) ? 'bg-orange' : 'bg-aqua'; ?>"></i> | |||
<i class="fa fa-user <?= $userModule->isAdmin($ticketMessage->user) ? 'bg-orange' : 'bg-aqua'; ?>"></i> | |||
<div class="timeline-item"> | |||
<span class="time"><i class="fa fa-clock-o"></i> <?= date('d/m/Y à H:i', strtotime($ticketMessage->created_at)) ?></span> | |||
<h3 class="timeline-header"><?= Html::encode($userManager->getUsername($ticketMessage->user)); ?></h3> | |||
<h3 class="timeline-header"><?= Html::encode($userModule->getUsername($ticketMessage->user)); ?></h3> | |||
<div class="timeline-body"> | |||
<?= nl2br($ticketMessage->message); ?> | |||
</div> |
@@ -42,7 +42,7 @@ use yii\helpers\ArrayHelper; | |||
\backend\assets\VuejsUserFormAsset::register($this); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$producerManager = $this->getProducerManager(); | |||
?> | |||
@@ -55,7 +55,7 @@ $producerManager = $this->getProducerManager(); | |||
]); ?> | |||
<?= $form->field($model, 'type') | |||
->dropDownList($userManager->getTypeChoicesArray(), [ | |||
->dropDownList($userModule->getTypeChoicesArray(), [ | |||
'v-model' => 'type' | |||
]); ?> | |||
<?= $form->field($model, 'name_legal_person', ['options' => ['v-show' => "type == 'legal-person'"]])->textInput() ?> |
@@ -45,7 +45,7 @@ use common\helpers\MeanPayment; | |||
$paymentManager = $this->getPaymentManager(); | |||
$producerManager = $this->getProducerManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$this->setTitle('Créditer <small>'.Html::encode($user->lastname.' '.$user->name).'</small>', 'Créditer '.Html::encode($user->lastname.' '.$user->name)) ; | |||
$this->addBreadcrumb(['label' => 'Utilisateurs', 'url' => ['index']]) ; | |||
@@ -113,7 +113,7 @@ $this->addBreadcrumb('Créditer') ; | |||
</div> | |||
<div class="col-md-8"> | |||
<h2>Historique <span class="the-credit"><?= number_format($userManager->getCredit($user), 2); ?> €</span></h2> | |||
<h2>Historique <span class="the-credit"><?= number_format($userModule->getCredit($user), 2); ?> €</span></h2> | |||
<?= GridView::widget([ | |||
'dataProvider' => $dataProvider, |
@@ -40,12 +40,12 @@ use common\components\PageSizer; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
use yii\helpers\Html; | |||
use yii\grid\GridView; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\User\UserProducer\Model\UserProducer; | |||
use common\logic\User\User\Model\User; | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$producerManager = ProducerManager::getInstance(); | |||
$this->setTitle('Utilisateurs'); | |||
@@ -76,8 +76,8 @@ $this->render('_menu', [ | |||
'attribute' => 'username', | |||
'label' => 'Nom', | |||
'value' => function ($model) { | |||
$userManager = UserManager::getInstance(); | |||
return $userManager->getUsername($model); | |||
$userModule = UserModule::getInstance(); | |||
return $userModule->getUsername($model); | |||
} | |||
], | |||
[ | |||
@@ -86,10 +86,10 @@ $this->render('_menu', [ | |||
'headerOptions' => ['class' => 'column-hide-on-mobile'], | |||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | |||
'contentOptions' => ['class' => 'column-hide-on-mobile'], | |||
'filter' => $userManager->getTypeChoicesArray(), | |||
'filter' => $userModule->getTypeChoicesArray(), | |||
'value' => function ($model) { | |||
$userManager = UserManager::getInstance(); | |||
$typeArray = $userManager->getTypeChoicesArray(); | |||
$userModule = UserModule::getInstance(); | |||
$typeArray = $userModule->getTypeChoicesArray(); | |||
if(isset($typeArray[$model['type']])) { | |||
return $typeArray[$model['type']]; | |||
} | |||
@@ -125,8 +125,8 @@ $this->render('_menu', [ | |||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | |||
'contentOptions' => ['class' => 'column-hide-on-mobile'], | |||
'value' => function ($model) { | |||
$userManager = UserManager::getInstance(); | |||
if($userManager->isUserSubscribedNewsletter($model)) { | |||
$userModule = UserModule::getInstance(); | |||
if($userModule->isUserSubscribedNewsletter($model)) { | |||
return '<span class="label label-success">Oui</span>'; | |||
} | |||
@@ -206,8 +206,8 @@ $this->render('_menu', [ | |||
]); | |||
}, | |||
'switch' => function($url, $model) { | |||
$userManager = UserManager::getInstance(); | |||
if($userManager->isCurrentAdmin()) { | |||
$userModule = UserModule::getInstance(); | |||
if($userModule->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' | |||
]); |
@@ -39,10 +39,10 @@ | |||
use yii\grid\GridView; | |||
use yii\helpers\Html; | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$orderManager = $this->getOrderManager(); | |||
$this->setTitle('Commandes <small>' . Html::encode($userManager->getUsername($user)) . '</small>', 'Commandes de ' . Html::encode($userManager->getUsername($user))); | |||
$this->setTitle('Commandes <small>' . Html::encode($userModule->getUsername($user)) . '</small>', 'Commandes de ' . Html::encode($userModule->getUsername($user))); | |||
$this->addBreadcrumb(['label' => 'Utilisateurs', 'url' => ['index']]); | |||
$this->addBreadcrumb(['label' => Html::encode($user->lastname . ' ' . $user->name)]); | |||
$this->addBreadcrumb('Commandes'); |
@@ -53,6 +53,7 @@ use common\logic\Ticket\TicketUser\Wrapper\TicketUserContainer; | |||
use common\logic\Ticket\TicketUser\Wrapper\TicketUserManager; | |||
use common\logic\User\User\Wrapper\UserContainer; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use common\logic\User\UserGroup\Wrapper\UserGroupContainer; | |||
use common\logic\User\UserGroup\Wrapper\UserGroupManager; | |||
use common\logic\User\UserProducer\Wrapper\UserProducerContainer; | |||
@@ -177,9 +178,14 @@ trait BusinessLogicTrait | |||
return PaymentManager::getInstance(); | |||
} | |||
public function getUserManager(): UserManager | |||
public function getUserModule(): UserModule | |||
{ | |||
return UserManager::getInstance(); | |||
return UserModule::getInstance(); | |||
} | |||
public function getUserContainer(): UserContainer | |||
{ | |||
return UserContainer::getInstance(); | |||
} | |||
public function getUserGroupManager(): UserGroupManager | |||
@@ -207,11 +213,6 @@ trait BusinessLogicTrait | |||
return TicketUserManager::getInstance(); | |||
} | |||
public function getUserContainer(): UserContainer | |||
{ | |||
return UserContainer::getInstance(); | |||
} | |||
public function getProducerContainer(): ProducerContainer | |||
{ | |||
return ProducerContainer::getInstance(); |
@@ -51,7 +51,7 @@ class CommonController extends \yii\web\Controller | |||
public function beforeAction($event) | |||
{ | |||
if (!Yii::$app->user->isGuest) { | |||
$this->getUserManager()->updateUserLastConnection(Yii::$app->user->identity); | |||
$this->getUserModule()->updateUserLastConnection(Yii::$app->user->identity); | |||
} | |||
return parent::beforeAction($event); | |||
@@ -89,7 +89,7 @@ class CommonController extends \yii\web\Controller | |||
public function isUserCurrentAdmin() | |||
{ | |||
return $this->getUserManager()->isAdmin($this->getUserCurrent()); | |||
return $this->getUserModule()->isAdmin($this->getUserCurrent()); | |||
} | |||
public function getRequest() |
@@ -42,7 +42,7 @@ use common\logic\Product\Product\Model\Product; | |||
use common\logic\Subscription\ProductSubscription\Model\ProductSubscription; | |||
use common\logic\Subscription\Subscription\Model\Subscription; | |||
use common\logic\Subscription\Subscription\Wrapper\SubscriptionManager; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use Yii; | |||
use yii\base\Model; | |||
@@ -117,15 +117,15 @@ class SubscriptionForm extends Model | |||
*/ | |||
public function save() | |||
{ | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$subscriptionManager = SubscriptionManager::getInstance(); | |||
if ($this->id) { | |||
$subscription = Subscription::searchOne(['id' => $this->id]) ; | |||
$subscription->populateUpdatedBy($userManager->getCurrent()); | |||
$subscription->populateUpdatedBy($userModule->getCurrent()); | |||
} | |||
else { | |||
$subscription = $subscriptionManager->instanciateSubscription($userManager->getCurrent()) ; | |||
$subscription = $subscriptionManager->instanciateSubscription($userModule->getCurrent()) ; | |||
} | |||
if ($subscription) { |
@@ -0,0 +1,40 @@ | |||
<?php | |||
namespace common\logic; | |||
use yii\base\ErrorException; | |||
abstract class AbstractModule extends AbstractSingleton implements ModuleInterface | |||
{ | |||
protected ContainerInterface $container; | |||
public function __call($method, $args) | |||
{ | |||
foreach($this->getContainer()->getServices() as $serviceClass) { | |||
if(method_exists($serviceClass, $method)) { | |||
return call_user_func_array( | |||
[$serviceClass::getInstance(), $method], | |||
$args | |||
); | |||
} | |||
} | |||
throw new ErrorException('La méthode '.$method.' est introuvable dans les services du container '.get_class($this->container)); | |||
} | |||
protected function setContainer(ContainerInterface $container): void | |||
{ | |||
$this->container = $container; | |||
} | |||
public function getContainer(): ContainerInterface | |||
{ | |||
return $this->container; | |||
} | |||
public function initContainer(): void | |||
{ | |||
$containerFqcn = $this->getContainerFqcn(); | |||
$this->setContainer($containerFqcn::getInstance()); | |||
} | |||
} |
@@ -22,7 +22,8 @@ abstract class AbstractSingleton | |||
if (!isset(self::$instances[$c])) { | |||
self::$instances[$c] = new $c; | |||
if(in_array(ManagerInterface::class, class_implements(self::$instances[$c]))) { | |||
if(in_array(ManagerInterface::class, class_implements(self::$instances[$c])) | |||
|| in_array(ModuleInterface::class, class_implements(self::$instances[$c]))) { | |||
self::$instances[$c]->initContainer(); | |||
} | |||
@@ -0,0 +1,9 @@ | |||
<?php | |||
namespace common\logic; | |||
interface ModuleInterface | |||
{ | |||
public function getContainerFqcn(): string; | |||
public function getServices(): ContainerInterface; | |||
} |
@@ -5,7 +5,7 @@ namespace common\logic\Payment\Event; | |||
use common\logic\Order\Order\Event\OrderDeleteEvent; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Payment\Wrapper\PaymentManager; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use justcoded\yii2\eventlistener\observers\Observer; | |||
class OrderObserver extends Observer | |||
@@ -21,8 +21,8 @@ class OrderObserver extends Observer | |||
{ | |||
$order = $event->order; | |||
$paymentManager = PaymentManager::getInstance(); | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$paymentManager->refundOrderCredit($order, $userManager->getCurrent()); | |||
$paymentManager->refundOrderCredit($order, $userModule->getCurrent()); | |||
} | |||
} |
@@ -1,7 +1,7 @@ | |||
<?php | |||
namespace common\logic\User\User\Event; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use justcoded\yii2\eventlistener\observers\ActiveRecordObserver; | |||
use yii\db\AfterSaveEvent; | |||
@@ -10,8 +10,8 @@ class TicketObserver extends ActiveRecordObserver | |||
public function inserted(AfterSaveEvent $event) | |||
{ | |||
$ticket = $event->sender; | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$userManager->sendMailNewTicketAdmin($ticket); | |||
$userModule->sendMailNewTicketAdmin($ticket); | |||
} | |||
} |
@@ -42,7 +42,7 @@ use common\helpers\GlobalParam; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
use common\logic\User\User\Repository\UserRepository; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\data\ActiveDataProvider; | |||
class UserSearch extends User | |||
@@ -64,7 +64,7 @@ class UserSearch extends User | |||
public function search($params = []) | |||
{ | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$producerManager = ProducerManager::getInstance(); | |||
$producer = GlobalParam::getCurrentProducer(); | |||
@@ -145,7 +145,7 @@ class UserSearch extends User | |||
]); | |||
} | |||
if ($userManager->isTypeValid($this->type)) { | |||
if ($userModule->isTypeValid($this->type)) { | |||
$query->andWhere(['user.type' => $this->type]); | |||
} | |||
@@ -8,7 +8,7 @@ use common\logic\User\UserProducer\Repository\UserProducerRepository; | |||
use common\logic\User\UserProducer\Service\UserProducerBuilder; | |||
use common\logic\UtilsInterface; | |||
class NewsletterUtils extends AbstractService implements UtilsInterface | |||
class NewsletterManager extends AbstractService implements UtilsInterface | |||
{ | |||
protected UserProducerRepository $userProducerRepository; | |||
protected UserProducerBuilder $userProducerBuilder; |
@@ -3,25 +3,25 @@ | |||
namespace common\logic\User\User\Service; | |||
use common\helpers\GlobalParam; | |||
use common\helpers\Mailjet; | |||
use common\logic\AbstractService; | |||
use common\logic\AbstractNotifier; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Ticket\Ticket\Model\Ticket; | |||
use common\logic\User\User\Model\User; | |||
use common\logic\UtilsInterface; | |||
class UserUtils extends AbstractService implements UtilsInterface | |||
class UserNotifier extends AbstractNotifier implements UtilsInterface | |||
{ | |||
protected UserSolver $userSolver; | |||
public function loadDependencies(): void | |||
{ | |||
parent::loadDependencies(); | |||
$this->userSolver = $this->loadService(UserSolver::class); | |||
} | |||
public function sendEmailSignup(User $user, Producer $producer) | |||
{ | |||
\Yii::$app->mailerService->sendFromSite( | |||
$this->mailer->sendFromSite( | |||
'Inscription', | |||
'signup', | |||
[ | |||
@@ -40,7 +40,7 @@ class UserUtils extends AbstractService implements UtilsInterface | |||
{ | |||
if (strlen($user->email)) { | |||
$producer = Producer::findOne(GlobalParam::getCurrentProducerId()); | |||
\Yii::$app->mailerService->sendFromProducer( | |||
$this->mailer->sendFromProducer( | |||
'Inscription', | |||
'createUserAdmin', | |||
[ | |||
@@ -56,7 +56,7 @@ class UserUtils extends AbstractService implements UtilsInterface | |||
public function sendMailNewTicketAdmin(Ticket $ticket) | |||
{ | |||
\Yii::$app->mailerService->sendAdmin( | |||
$this->mailer->sendAdmin( | |||
'Nouveau ticket', | |||
'newTicketAdmin', | |||
[ |
@@ -5,9 +5,11 @@ namespace common\logic\User\User\Wrapper; | |||
use common\logic\AbstractContainer; | |||
use common\logic\User\User\Repository\UserRepository; | |||
use common\logic\User\User\Repository\UserRepositoryQuery; | |||
use common\logic\User\User\Service\NewsletterManager; | |||
use common\logic\User\User\Service\NewsletterUtils; | |||
use common\logic\User\User\Service\UserBuilder; | |||
use common\logic\User\User\Service\UserDefinition; | |||
use common\logic\User\User\Service\UserNotifier; | |||
use common\logic\User\User\Service\UsersCreditCsvGenerator; | |||
use common\logic\User\User\Service\UserSolver; | |||
use common\logic\User\User\Service\UserUtils; | |||
@@ -22,9 +24,9 @@ class UserContainer extends AbstractContainer | |||
UserRepositoryQuery::class, | |||
UserRepository::class, | |||
UserBuilder::class, | |||
UserNotifier::class, | |||
UsersCreditCsvGenerator::class, | |||
UserUtils::class, | |||
NewsletterUtils::class, | |||
NewsletterManager::class, | |||
]; | |||
} | |||
@@ -48,8 +50,13 @@ class UserContainer extends AbstractContainer | |||
return UserBuilder::getInstance(); | |||
} | |||
public function getUtils(): UserUtils | |||
public function getNotifier(): UserNotifier | |||
{ | |||
return UserUtils::getInstance(); | |||
return UserNotifier::getInstance(); | |||
} | |||
public function getNewsletterManager(): NewsletterManager | |||
{ | |||
return NewsletterManager::getInstance(); | |||
} | |||
} |
@@ -2,28 +2,33 @@ | |||
namespace common\logic\User\User\Wrapper; | |||
use common\logic\AbstractManager; | |||
use common\logic\AbstractModule; | |||
use common\logic\User\User\Repository\UserRepository; | |||
use common\logic\User\User\Service\NewsletterUtils; | |||
use common\logic\User\User\Service\NewsletterManager; | |||
use common\logic\User\User\Service\UserBuilder; | |||
use common\logic\User\User\Service\UserDefinition; | |||
use common\logic\User\User\Service\UserNotifier; | |||
use common\logic\User\User\Service\UsersCreditCsvGenerator; | |||
use common\logic\User\User\Service\UserSolver; | |||
use common\logic\User\User\Service\UserUtils; | |||
/** | |||
* @mixin UserDefinition | |||
* @mixin UserSolver | |||
* @mixin UserRepository | |||
* @mixin UserBuilder | |||
* @mixin UserUtils | |||
* @mixin UserNotifier | |||
* @mixin UsersCreditCsvGenerator | |||
* @mixin NewsletterUtils | |||
* @mixin NewsletterManager | |||
*/ | |||
class UserManager extends AbstractManager | |||
class UserModule extends AbstractModule | |||
{ | |||
public function getContainerFqcn(): string | |||
{ | |||
return UserContainer::class; | |||
} | |||
public function getServices(): UserContainer | |||
{ | |||
return $this->container; | |||
} | |||
} |
@@ -36,15 +36,15 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||
termes. | |||
*/ | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\helpers\Html; | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
?> | |||
<p>Bonjour,</p> | |||
<p>Le client <strong><?= $userManager->getUsername($user) ?></strong> vient de passer une commande pour le <strong><?= date('d/m/Y',strtotime($distribution->date)) ?></strong> mais le paiement par carte bancaire n'a pas abouti.<br /> | |||
<p>Le client <strong><?= $userModule->getUsername($user) ?></strong> vient de passer une commande pour le <strong><?= date('d/m/Y',strtotime($distribution->date)) ?></strong> mais le paiement par carte bancaire n'a pas abouti.<br /> | |||
Il vient de recevoir un message pour régulariser le paiement par virement bancaire.</p> | |||
<p>Sa commande a été enregistrée avec l'état "non payé".</p> |
@@ -36,16 +36,16 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||
termes. | |||
*/ | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\helpers\Html; | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
?> | |||
Bonjour, | |||
Le client <?= $userManager->getUsername() ?> vient de passer une commande pour le <?= date('d/m/Y',strtotime($distribution->date)) ?> mais le paiement par carte bancaire n'a pas abouti. | |||
Le client <?= $userModule->getUsername() ?> vient de passer une commande pour le <?= date('d/m/Y',strtotime($distribution->date)) ?> mais le paiement par carte bancaire n'a pas abouti. | |||
Il vient de recevoir un message pour régulariser le paiement par virement bancaire. | |||
Sa commande a été enregistrée avec l'état "non payé". |
@@ -1,6 +1,6 @@ | |||
<?php | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
function version(string $date, array $featuresMaintenanceArray, array $featuresMaintenanceAdminArray = []) { | |||
release_date($date); | |||
@@ -17,7 +17,7 @@ function release_date(string $date) { | |||
} | |||
function features(array $featuresArray, array $featuresAdminArray) { | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
if(count($featuresArray) > 0 || count($featuresAdminArray) > 0) { | |||
$html = '<div class="block block-features">'; | |||
$html .= '<h4><span class="glyphicon glyphicon-flash"></span> Évolutions</h4>'; | |||
@@ -25,7 +25,7 @@ function features(array $featuresArray, array $featuresAdminArray) { | |||
foreach($featuresArray as $feature) { | |||
$html .= '<li>'.$feature.'</li>'; | |||
} | |||
if($userManager->isCurrentAdmin()) { | |||
if($userModule->isCurrentAdmin()) { | |||
foreach($featuresAdminArray as $feature) { | |||
$html .= '<li class="admin">'.$feature.'</li>'; | |||
} | |||
@@ -37,7 +37,7 @@ function features(array $featuresArray, array $featuresAdminArray) { | |||
} | |||
function maintenance(array $maintenanceArray, array $maintenanceAdminArray) { | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
if(count($maintenanceArray) > 0 || count($maintenanceAdminArray) > 0) { | |||
$html = '<div class="block block-maintenance">'; | |||
$html .= '<h4><span class="glyphicon glyphicon-wrench"></span> Maintenance</h4>'; | |||
@@ -45,7 +45,7 @@ function maintenance(array $maintenanceArray, array $maintenanceAdminArray) { | |||
foreach($maintenanceArray as $maintenance) { | |||
$html .= '<li>'.$maintenance.'</li>'; | |||
} | |||
if($userManager->isCurrentAdmin()) { | |||
if($userModule->isCurrentAdmin()) { | |||
foreach ($maintenanceAdminArray as $maintenance) { | |||
$html .= '<li class="admin">' . $maintenance . '</li>'; | |||
} |
@@ -2,14 +2,14 @@ | |||
use common\helpers\GlobalParam; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\bootstrap\Nav; | |||
use yii\helpers\Html; | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$producer = null; | |||
if ($userManager->isCurrentProducer()) { | |||
if ($userModule->isCurrentProducer()) { | |||
$producer = Producer::searchOne(['id' => \Yii::$app->user->identity->id_producer]); | |||
} | |||
@@ -59,13 +59,13 @@ if ($userManager->isCurrentProducer()) { | |||
$itemAdministration = [ | |||
'label' => '<span class="glyphicon glyphicon-cog"></span> <span class="link-text">Administration</span>', | |||
'url' => $this->getUrlManagerBackend()->createAbsoluteUrl(['dashboard/index']), | |||
'visible' => $userManager->isCurrentProducer(), | |||
'visible' => $userModule->isCurrentProducer(), | |||
'linkOptions' => ['class' => 'btn btn-default navbar-btn'] | |||
]; | |||
$itemProducerSpace = [ | |||
'label' => '<span class="glyphicon glyphicon-eye-open"></span> <span class="link-text">Mon espace producteur</span>', | |||
'url' => $this->getUrlManagerProducer()->createAbsoluteUrl(['site/index', 'slug_producer' => $producer ? $producer->slug : '']), | |||
'visible' => $userManager->isCurrentProducer(), | |||
'visible' => $userModule->isCurrentProducer(), | |||
'linkOptions' => ['class' => 'btn btn-default navbar-btn'] | |||
]; | |||
$itemProducers = [ |
@@ -177,14 +177,14 @@ class SiteController extends FrontendController | |||
$aboutFewNumbers = Yii::$app->cache->getOrSet('about_few_numbers7', function () { | |||
$producerManager = $this->getProducerManager(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$orderManager = $this->getOrderManager(); | |||
$countProducersActive = $producerManager->countProducersActiveWithTurnover(); | |||
$timeSavedByProducersAverage = $producerManager->getTimeSavedByProducersAverage(); | |||
$countProducersWithOptionTimeSaved = $producerManager->countProducersWithTimeSaved(); | |||
$countPointSalesActive = $pointSaleManager->countPointSalesActiveLastThreeMonths(); | |||
$countUsersActive = $userManager->countUsersActiveLastThreeMonths(); | |||
$countUsersActive = $userModule->countUsersActiveLastThreeMonths(); | |||
$averageOrdersPerDay = $orderManager->countGlobalUserOrdersAverageLastSevenDays(); | |||
$averageTurnover = $orderManager->getAverageTurnoverLastThreeMonths(); | |||
$resultMatomoApiVisitSummary = json_decode(file_get_contents(Yii::$app->parameterBag->get('matomoApiVisitSummaryUrl'))); |
@@ -122,7 +122,7 @@ class UserController extends FrontendController | |||
*/ | |||
protected function findModel($id) | |||
{ | |||
$userRepository = $this->getUserManager(); | |||
$userRepository = $this->getUserModule(); | |||
if (($model = $userRepository->findOneUserById($id)) !== null) { | |||
return $model; |
@@ -38,7 +38,7 @@ termes. | |||
namespace frontend\forms; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use Yii; | |||
use yii\base\Model; | |||
@@ -58,16 +58,16 @@ class OpinionForm extends Model | |||
*/ | |||
public function rules() | |||
{ | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
return [ | |||
[['message'], 'required', 'message' => 'Champs obligatoire'], | |||
[['name', 'email'], 'required', 'message' => 'Champs obligatoire', 'when' => function($model) use($userManager) { | |||
return $userManager->isCurrentGuest(); | |||
[['name', 'email'], 'required', 'message' => 'Champs obligatoire', 'when' => function($model) use($userModule) { | |||
return $userModule->isCurrentGuest(); | |||
}], | |||
['email', 'email', 'message' => 'Email incorrect'], | |||
['isTest', 'string'], | |||
['verifyCode', 'captcha', 'message' => 'Veuillez recopier le code de vérification', 'when' => function($model) use($userManager) { | |||
return $model->isTest != 'isTest' && $userManager->isCurrentGuest(); | |||
['verifyCode', 'captcha', 'message' => 'Veuillez recopier le code de vérification', 'when' => function($model) use($userModule) { | |||
return $model->isTest != 'isTest' && $userModule->isCurrentGuest(); | |||
}], | |||
]; | |||
} |
@@ -40,7 +40,7 @@ namespace frontend\forms; | |||
use common\logic\User\User\Model\User; | |||
use common\logic\User\User\Service\UserSolver; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\base\Model; | |||
use yii; | |||
@@ -74,14 +74,14 @@ class PasswordResetRequestForm extends Model | |||
*/ | |||
public function sendEmail() | |||
{ | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$user = User::findOne([ | |||
'email' => $this->email, | |||
]); | |||
if ($user) { | |||
if (!$userManager->isPasswordResetTokenValid($user->password_reset_token)) { | |||
$userManager->generatePasswordResetToken($user); | |||
if (!$userModule->isPasswordResetTokenValid($user->password_reset_token)) { | |||
$userModule->generatePasswordResetToken($user); | |||
} | |||
if ($user->save()) { |
@@ -38,7 +38,7 @@ termes. | |||
namespace frontend\forms; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\base\InvalidParamException; | |||
use yii\base\Model; | |||
use Yii; | |||
@@ -64,11 +64,11 @@ class ResetPasswordForm extends Model | |||
*/ | |||
public function __construct($token, $config = []) | |||
{ | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
if (empty($token) || !is_string($token)) { | |||
throw new InvalidParamException('Password reset token cannot be blank.'); | |||
} | |||
$this->_user = $userManager->findOneUserByPasswordResetToken($token); | |||
$this->_user = $userModule->findOneUserByPasswordResetToken($token); | |||
if (!$this->_user) { | |||
throw new InvalidParamException('Wrong password reset token.'); | |||
} | |||
@@ -93,11 +93,11 @@ class ResetPasswordForm extends Model | |||
*/ | |||
public function resetPassword() | |||
{ | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$user = $this->_user; | |||
$userManager->setPassword($user, $this->password); | |||
$userManager->removePasswordResetToken($user); | |||
$userModule->setPassword($user, $this->password); | |||
$userModule->removePasswordResetToken($user); | |||
return $user->save(); | |||
} |
@@ -42,7 +42,7 @@ use common\logic\Config\TaxRate\Model\TaxRate; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
use common\logic\User\User\Model\User; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\base\Model; | |||
/** | |||
@@ -234,12 +234,12 @@ class SignupForm extends Model | |||
*/ | |||
public function signup() | |||
{ | |||
$userManager = \Yii::$app->logic->getUserManager(); | |||
$userModule = \Yii::$app->logic->getUserModule(); | |||
$producerManager = \Yii::$app->logic->getProducerManager(); | |||
if ($this->validate()) { | |||
$user = $userManager->instanciateUser(); | |||
$user = $userModule->instanciateUser(); | |||
$this->populateUser($user); | |||
if ($this->isProducer()) { | |||
@@ -256,7 +256,7 @@ class SignupForm extends Model | |||
\Yii::$app->logic->setProducerContext($producer); | |||
$producerManager->addUser($user, $producer, true, $this->newsletter); | |||
$userManager->sendEmailSignup($user, $producer); | |||
$userModule->sendEmailSignup($user, $producer); | |||
return $user; | |||
} | |||
@@ -277,7 +277,7 @@ class SignupForm extends Model | |||
public function processFormProducer($user) | |||
{ | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$producerManager = ProducerManager::getInstance(); | |||
// Création du producteur | |||
@@ -293,15 +293,15 @@ class SignupForm extends Model | |||
$producerManager->sendEmailNewProducer($producer); | |||
// Initialisation de l'utilisateur (statut et liaison au producteur) | |||
$userManager->initProducer($user, $producer); | |||
$userModule->initProducer($user, $producer); | |||
return $producer; | |||
} | |||
public function populateUser($user) | |||
{ | |||
$userManager = UserManager::getInstance(); | |||
$userManager->initPassword($user, $this->password); | |||
$userModule = UserModule::getInstance(); | |||
$userModule->initPassword($user, $this->password); | |||
$user->username = $this->email; | |||
$user->email = $this->email; |
@@ -36,7 +36,7 @@ | |||
* termes. | |||
*/ | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\helpers\Html; | |||
use yii\bootstrap\Nav; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
@@ -44,10 +44,10 @@ use common\logic\Producer\Producer\Model\Producer; | |||
\common\assets\CommonAsset::register($this); | |||
\frontend\assets\AppAsset::register($this); | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$isHome = (Yii::$app->controller->id == 'site' && \Yii::$app->controller->action->id == 'index'); | |||
$producer = null; | |||
if ($userManager->isCurrentProducer()) { | |||
if ($userModule->isCurrentProducer()) { | |||
$producer = Producer::searchOne(['id' => \Yii::$app->user->identity->id_producer]); | |||
} | |||
@@ -37,7 +37,7 @@ termes. | |||
*/ | |||
use common\logic\Config\TaxRate\Model\TaxRate; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\helpers\Html; | |||
use yii\bootstrap\ActiveForm; | |||
use yii\helpers\ArrayHelper; | |||
@@ -46,9 +46,9 @@ $this->setTitle('Inscription') ; | |||
$this->setMeta('description', 'Inscrivez-vous afin de profiter des fonctionnalités de la plateforme.'); | |||
$this->params['breadcrumbs'][] = $this->title; | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$urlRedirect = null; | |||
if($userManager->isProducer($user)) { | |||
if($userModule->isProducer($user)) { | |||
$urlRedirect = $this->getUrlManagerBackend()->createAbsoluteUrl(['dashboard/index']); | |||
$redirectLabel = "Redirection vers votre tableau de bord ..."; | |||
} |
@@ -87,7 +87,7 @@ class CreditController extends ProducerBaseController | |||
return $this->redirect($this->getUrlManagerFrontend()->createAbsoluteUrl(['site/producer', 'id' => $producer->id])); | |||
} | |||
$userContainer = $this->getUserContainer(); | |||
$userModule = $this->getUserModule(); | |||
$paymentContainer = $this->getPaymentContainer(); | |||
$userCurrent = $this->getUserCurrent(); | |||
@@ -103,7 +103,7 @@ class CreditController extends ProducerBaseController | |||
return $this->render('history', [ | |||
'dataProvider' => $paymentContainer->getRepository() | |||
->queryPaymentsCreditHistoryByUser($userCurrent)->getDataProvider(20), | |||
'creditUser' => $userContainer->getRepository()->getCredit($userCurrent) | |||
'creditUser' => $userModule->getCredit($userCurrent) | |||
]); | |||
} | |||
@@ -180,7 +180,7 @@ class CreditController extends ProducerBaseController | |||
$orderManager = $this->getOrderManager(); | |||
$paymentManager = $this->getPaymentManager(); | |||
$producerManager = $this->getProducerManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$producer = $this->getProducerCurrent(); | |||
$contactProducer = $producerManager->getMainContact($producer); | |||
@@ -209,7 +209,7 @@ class CreditController extends ProducerBaseController | |||
$idUser = $paymentIntentMetadata->user_id; | |||
if($idUser) { | |||
$user = $userManager->findOneUserById($idUser); | |||
$user = $userModule->findOneUserById($idUser); | |||
if (isset($paymentIntentMetadata->order_id)) { | |||
$order = $this->getOrderManager()->findOneOrderById($paymentIntentMetadata->order_id); |
@@ -71,9 +71,9 @@ class NewsletterController extends ProducerBaseController | |||
return $this->redirectProducerLoginFrontend('subscribe'); | |||
} | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$userCurrent = $this->getUserCurrent(); | |||
$userManager->subscribeUserNewsletter($userCurrent); | |||
$userModule->subscribeUserNewsletter($userCurrent); | |||
$this->setFlash('success', "Votre inscription au bulletin d'information a bien été prise en compte."); | |||
return $this->redirect('index'); | |||
} | |||
@@ -84,9 +84,9 @@ class NewsletterController extends ProducerBaseController | |||
return $this->redirectProducerLoginFrontend('unsubscribe'); | |||
} | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$userCurrent = $this->getUserCurrent(); | |||
$userManager->unsubscribeUserNewsletter($userCurrent); | |||
$userModule->unsubscribeUserNewsletter($userCurrent); | |||
$this->setFlash('success', "À partir de maintenant, vous ne recevrez plus d'email de la part de ce producteur."); | |||
return $this->redirect('index'); | |||
} |
@@ -157,7 +157,7 @@ class OrderController extends ProducerBaseController | |||
$orderManager = $this->getOrderManager(); | |||
$producerManager = $this->getProducerManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$producer = $this->getProducerCurrent(); | |||
$redirect = null; | |||
@@ -211,8 +211,8 @@ class OrderController extends ProducerBaseController | |||
$user = new User; | |||
$user->id_producer = 0; | |||
$user->type = User::TYPE_GUEST; | |||
$userManager->setPassword($user, Password::generate()); | |||
$userManager->generateAuthKey($user); | |||
$userModule->setPassword($user, Password::generate()); | |||
$userModule->generateAuthKey($user); | |||
$user->username = $posts['user']['email']; | |||
$user->email = $posts['user']['email']; | |||
$user->name = $posts['user']['firstname']; | |||
@@ -328,7 +328,7 @@ class OrderController extends ProducerBaseController | |||
$orderManager = $this->getOrderManager(); | |||
$producerManager = $this->getProducerManager(); | |||
$productOrderManager = $this->getProductOrderManager(); | |||
$userManager = $this->getUserManager(); | |||
$userModule = $this->getUserModule(); | |||
$paymentManager = $this->getPaymentManager(); | |||
$posts = \Yii::$app->request->post(); |
@@ -39,7 +39,7 @@ | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use common\logic\User\UserProducer\Model\UserProducer; | |||
use yii\bootstrap\Nav; | |||
use common\helpers\GlobalParam; | |||
@@ -48,11 +48,11 @@ use yii\helpers\Html; | |||
\common\assets\CommonAsset::register($this); | |||
\producer\assets\AppAsset::register($this); | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$userCurrent = GlobalParam::getCurrentUser(); | |||
$producerManager = ProducerManager::getInstance(); | |||
$producerUser = null; | |||
if($userManager->isCurrentProducer()) { | |||
if($userModule->isCurrentProducer()) { | |||
$producerUser = $producerManager->findOneProducerById($userCurrent->id_producer); | |||
} | |||
$producer = $this->context->getProducerCurrent(); | |||
@@ -128,7 +128,7 @@ if (!Yii::$app->user->isGuest) { | |||
->count(); | |||
$labelOrders = $countOrders > 0 ? 'success' : 'default'; | |||
$isUserSubscribedNewsletter = $userManager->isUserSubscribedNewsletter($userCurrent); | |||
$isUserSubscribedNewsletter = $userModule->isUserSubscribedNewsletter($userCurrent); | |||
echo Nav::widget([ | |||
'encodeLabels' => false, |
@@ -36,16 +36,16 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||
termes. | |||
*/ | |||
use common\logic\User\User\Wrapper\UserManager; | |||
use common\logic\User\User\Wrapper\UserModule; | |||
use yii\helpers\Html; | |||
$userManager = UserManager::getInstance(); | |||
$userModule = UserModule::getInstance(); | |||
$this->setTitle("Bulletin d'information"); | |||
?> | |||
<div class="newsletter-index"> | |||
<?php if($userManager->isUserSubscribedNewsletter($user)): ?> | |||
<?php if($userModule->isUserSubscribedNewsletter($user)): ?> | |||
<div class="panel panel-default"> | |||
<div class="panel-body"> | |||
Vous êtes inscrit au bulletin d'information <strong><?= Html::encode($producer->name) ?></strong>. |