瀏覽代碼

Merge branch 'develop'

master
Guillaume Bourgeois 10 月之前
父節點
當前提交
112592368f
共有 100 個文件被更改,包括 1355 次插入839 次删除
  1. +1
    -2
      backend/controllers/AccessController.php
  2. +3
    -3
      backend/controllers/BackendController.php
  3. +1
    -1
      backend/controllers/CommunicateAdminController.php
  4. +124
    -9
      backend/controllers/CommunicateController.php
  5. +4
    -5
      backend/controllers/CronController.php
  6. +1
    -3
      backend/controllers/DeliveryNoteController.php
  7. +26
    -6
      backend/controllers/DistributionController.php
  8. +25
    -13
      backend/controllers/DocumentController.php
  9. +1
    -2
      backend/controllers/InvoiceController.php
  10. +79
    -0
      backend/controllers/OnlineAdminController.php
  11. +10
    -10
      backend/controllers/OrderController.php
  12. +6
    -8
      backend/controllers/PointSaleController.php
  13. +6
    -15
      backend/controllers/ProducerAdminController.php
  14. +6
    -7
      backend/controllers/ProducerController.php
  15. +3
    -5
      backend/controllers/ProducerPriceRangeAdminController.php
  16. +3
    -4
      backend/controllers/ProductCategoryController.php
  17. +9
    -9
      backend/controllers/ProductController.php
  18. +2
    -2
      backend/controllers/QuotationController.php
  19. +1
    -2
      backend/controllers/SiteController.php
  20. +23
    -18
      backend/controllers/SubscriptionController.php
  21. +2
    -3
      backend/controllers/SupportAdminController.php
  22. +2
    -2
      backend/controllers/SupportController.php
  23. +4
    -4
      backend/controllers/TaxRateAdminController.php
  24. +91
    -0
      backend/controllers/TillerController.php
  25. +16
    -101
      backend/controllers/UserController.php
  26. +3
    -3
      backend/controllers/UserGroupController.php
  27. +1
    -1
      backend/forms/AdminSettingsForm.php
  28. +1
    -1
      backend/models/AccessUserProducerForm.php
  29. +3
    -42
      backend/models/CreditForm.php
  30. +7
    -7
      backend/models/MailForm.php
  31. +9
    -6
      backend/views/communicate/email.php
  32. +0
    -77
      backend/views/communicate/index.php
  33. +56
    -0
      backend/views/communicate/paper.php
  34. +8
    -9
      backend/views/dashboard/index.php
  35. +4
    -5
      backend/views/delivery-note/index.php
  36. +15
    -5
      backend/views/distribution/index.php
  37. +6
    -6
      backend/views/distribution/report-bourlingue.php
  38. +3
    -3
      backend/views/distribution/report-grid.php
  39. +1
    -1
      backend/views/distribution/shopping-cart-labels.php
  40. +4
    -4
      backend/views/document/_download_product_line.php
  41. +28
    -20
      backend/views/document/_form.php
  42. +2
    -2
      backend/views/document/download.php
  43. +3
    -3
      backend/views/document/form/_payment.php
  44. +3
    -4
      backend/views/invoice/index.php
  45. +5
    -6
      backend/views/layouts/header.php
  46. +58
    -19
      backend/views/layouts/left.php
  47. +3
    -0
      backend/views/layouts/main.php
  48. +128
    -0
      backend/views/online-admin/index.php
  49. +2
    -2
      backend/views/order/report.php
  50. +6
    -6
      backend/views/point-sale/_form.php
  51. +3
    -3
      backend/views/point-sale/index.php
  52. +1
    -1
      backend/views/producer-admin/_form.php
  53. +1
    -1
      backend/views/producer-admin/billing.php
  54. +4
    -4
      backend/views/producer-admin/index.php
  55. +0
    -85
      backend/views/producer-admin/online.php
  56. +29
    -10
      backend/views/producer/update.php
  57. +4
    -4
      backend/views/product/_form.php
  58. +4
    -5
      backend/views/product/index.php
  59. +4
    -4
      backend/views/product/update/prices/_form.php
  60. +3
    -3
      backend/views/product/update/prices/list.php
  61. +2
    -2
      backend/views/quotation/index.php
  62. +1
    -1
      backend/views/setting-admin/index.php
  63. +2
    -2
      backend/views/subscription/_form.php
  64. +7
    -7
      backend/views/subscription/index.php
  65. +2
    -4
      backend/views/support/index.php
  66. +2
    -2
      backend/views/support/view.php
  67. +5
    -5
      backend/views/user/_form.php
  68. +60
    -27
      backend/views/user/_menu.php
  69. +20
    -4
      backend/views/user/credit.php
  70. +7
    -6
      backend/views/user/index.php
  71. +37
    -11
      backend/web/css/screen.css
  72. +22
    -2
      backend/web/js/vuejs/distribution-index.js
  73. +27
    -1
      backend/web/js/vuejs/document-form.js
  74. +1
    -1
      backend/web/js/vuejs/producer-update.js
  75. +62
    -40
      backend/web/sass/document/_form.scss
  76. +24
    -0
      backend/web/sass/online-admin/_index.scss
  77. +0
    -12
      backend/web/sass/producer-admin/_online.scss
  78. +1
    -1
      backend/web/sass/screen.scss
  79. +1
    -1
      common/components/AlwaysdataClient.php
  80. +1
    -2
      common/components/BusinessLogic.php
  81. +33
    -33
      common/components/BusinessLogicTrait.php
  82. +1
    -1
      common/components/MailerService.php
  83. +10
    -0
      common/components/Tiller/TillerClientInterface.php
  84. +12
    -2
      common/components/Tiller/TillerClientV2.php
  85. +110
    -0
      common/components/Tiller/TillerClientV3.php
  86. +7
    -1
      common/components/View.php
  87. +15
    -15
      common/config/main.php
  88. +1
    -1
      common/config/params.php
  89. +1
    -1
      common/controllers/CommonController.php
  90. +1
    -1
      common/forms/ContactForm.php
  91. +2
    -2
      common/forms/LoginForm.php
  92. +6
    -7
      common/forms/SubscriptionForm.php
  93. +7
    -6
      common/helpers/Ajax.php
  94. +1
    -1
      common/helpers/CSV.php
  95. +2
    -3
      common/helpers/GlobalParam.php
  96. +1
    -1
      common/helpers/Price.php
  97. +0
    -11
      common/logic/Distribution/Distribution/Event/DistributionActiveEvent.php
  98. +0
    -14
      common/logic/Distribution/PointSaleDistribution/Service/PointSaleDistributionDefinition.php
  99. +0
    -14
      common/logic/Distribution/ProductDistribution/Service/ProductDistributionDefinition.php
  100. +0
    -8
      common/logic/Document/Document/Model/DocumentInterface.php

+ 1
- 2
backend/controllers/AccessController.php 查看文件

@@ -39,9 +39,8 @@
namespace backend\controllers;

use backend\models\AccessUserProducerForm;
use common\logic\User\User\Model\UserSearch;
use domain\User\User\UserSearch;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;

/**
* UserController implements the CRUD actions for User model.

+ 3
- 3
backend/controllers/BackendController.php 查看文件

@@ -39,9 +39,9 @@
namespace backend\controllers;

use common\controllers\CommonController;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Product\Product\Model\Product;
use domain\PointSale\PointSale\PointSale;
use domain\Producer\Producer\Producer;
use domain\Product\Product\Product;

class BackendController extends CommonController
{

+ 1
- 1
backend/controllers/CommunicateAdminController.php 查看文件

@@ -39,7 +39,7 @@
namespace backend\controllers;

use backend\models\MailForm;
use common\logic\User\User\Model\User;
use domain\User\User\User;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\web\NotFoundHttpException;

+ 124
- 9
backend/controllers/CommunicateController.php 查看文件

@@ -38,7 +38,10 @@

namespace backend\controllers;

use backend\models\MailForm;
use common\helpers\GlobalParam;
use kartik\mpdf\Pdf;
use domain\PointSale\PointSale\PointSale;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;

@@ -73,18 +76,131 @@ class CommunicateController extends BackendController
];
}

/**
* Affiche la page d'accueil de la section avec un aperçu du mode d'emploi
* à imprimer.
*/
public function actionIndex()
public function actionEmail(
$idPointSale = 0,
$sectionSubscribers = 0,
$sectionInactiveUsers = 0,
$usersPointSaleLink = 0,
$usersPointSaleHasOrder = 0,
$idDistribution = 0)
{
$producerCurrent = $this->getProducerCurrent();
$userModule = $this->getUserModule();
$distributionModule = $this->getDistributionModule();
$mailForm = new MailForm();

if ($idPointSale && !$usersPointSaleLink && !$usersPointSaleHasOrder) {
$usersPointSaleLink = 1;
}
if ($idDistribution && !$usersPointSaleLink && !$usersPointSaleHasOrder) {
$usersPointSaleLink = 1;
}

if($idDistribution) {
$users = [];
$distribution = $distributionModule->getRepository()->findOneDistributionById($idDistribution);
if($distribution) {
$mailForm->id_distribution = $idDistribution;
foreach($distribution->pointSaleDistribution as $pointSaleDistribution) {
if($pointSaleDistribution->delivery) {
$usersPointSaleArray = $userModule->getRepository()->queryUsersBy([
'id_producer' => $producerCurrent->id,
'id_point_sale' => $pointSaleDistribution->id_point_sale,
'users_point_sale_link' => $usersPointSaleLink,
'users_point_sale_has_order' => $usersPointSaleHasOrder,
'newsletter' => true
])->all();

foreach($usersPointSaleArray as $user) {
$users[$user['id']] = $user;
}
}
}
}
}
else {
$users = $userModule->queryUsersBy([
'id_producer' => GlobalParam::getCurrentProducerId(),
'id_point_sale' => $idPointSale,
'users_point_sale_link' => $usersPointSaleLink,
'users_point_sale_has_order' => $usersPointSaleHasOrder,
'subscribers' => $sectionSubscribers,
'inactive' => $sectionInactiveUsers,
'newsletter' => true
])->all();
}

$usersArray = [];
foreach ($users as $key => $user) {
if (isset($user['email']) && strlen($user['email']) > 0) {
$usersArray[] = $user['email'];
} else {
unset($users[$key]);
}
}

$pointsSaleArray = PointSale::find()->where(['id_producer' => GlobalParam::getCurrentProducerId(), 'status' => 1])->all();

$pointSale = null;
if ($idPointSale) {
$pointSale = PointSale::findOne(['id' => $idPointSale]);
}


if ($mailForm->load(\Yii::$app->request->post()) && $mailForm->validate()) {
$responseSendMail = $mailForm->sendEmail($users);
if ($responseSendMail->success()) {
$this->setFlash('success', 'Votre email a bien été envoyé.');
} else {
$bodyResponseSendMail = $responseSendMail->getBody();
$emailsErrorArray = [];

if (isset($bodyResponseSendMail['Messages'])) {
foreach ($bodyResponseSendMail['Messages'] as $message) {
if ($message['Status'] != 'success') {
$emailsErrorArray[] = $message['Errors'][0]['ErrorMessage'];
}
}
}

$messageError = 'Un problème est survenu lors de l\'envoi de votre email.';
if (count($emailsErrorArray) > 0) {
$messageError .= '<br />Problème détecté : ' . implode(',', $emailsErrorArray);
}
$this->setFlash('error', $messageError);
}

return $this->redirect(['mail', 'idPointSale' => $idPointSale]);
}

$incomingDistributionsArray = $distributionModule->findDistributionsIncoming();
$incomingDistributionsDatesArray = ['0' => '--'];
foreach ($incomingDistributionsArray as $distribution) {
$incomingDistributionsDatesArray[$distribution->id] = strftime('%A %d %B %Y', strtotime($distribution->date));
}

return $this->render('email', [
'usersArray' => $usersArray,
'pointsSaleArray' => $pointsSaleArray,
'pointSale' => $pointSale,
'mailForm' => $mailForm,
'idPointSaleActive' => $idPointSale,
'idDistributionActive' => $idDistribution,
'incomingDistributionsArray' => $incomingDistributionsArray,
'incomingDistributionsDatesArray' => $incomingDistributionsDatesArray,
'sectionSubscribers' => $sectionSubscribers,
'sectionInactiveUsers' => $sectionInactiveUsers,
'usersPointSaleLink' => $usersPointSaleLink,
'usersPointSaleHasOrder' => $usersPointSaleHasOrder,
]);
}

public function actionPaper()
{
$producer = $this->getProducerCurrent();
$pointsSaleArray = $this->getPointSaleModule()->findPointSales();

return $this->render('index', [
return $this->render('paper', [
'producer' => $producer,
'pointsSaleArray' => $pointsSaleArray,
]);
}

@@ -138,5 +254,4 @@ class CommunicateController extends BackendController
// return the pdf output as per the destination setting
return $pdf->render();
}

}

+ 4
- 5
backend/controllers/CronController.php 查看文件

@@ -38,14 +38,13 @@

namespace backend\controllers;

use common\helpers\GlobalParam;
use common\helpers\MeanPayment;
use common\logic\Distribution\Distribution\Service\ExportManager;
use common\logic\Order\Order\Model\Order;
use common\logic\User\User\Model\User;
use domain\Distribution\Distribution\ExportManager;
use domain\Order\Order\Order;
use domain\User\User\User;
use Yii;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;

/**
* UserController implements the CRUD actions for User model.

+ 1
- 3
backend/controllers/DeliveryNoteController.php 查看文件

@@ -38,10 +38,8 @@

namespace backend\controllers;

use common\logic\Document\DeliveryNote\Model\DeliveryNoteSearch;
use Yii;
use domain\Document\DeliveryNote\DeliveryNoteSearch;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;

class DeliveryNoteController extends DocumentController
{

+ 26
- 6
backend/controllers/DistributionController.php 查看文件

@@ -42,13 +42,12 @@ use common\helpers\Ajax;
use common\helpers\GlobalParam;
use common\helpers\MeanPayment;
use common\helpers\Price;
use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Distribution\Distribution\Service\ExportManager;
use common\logic\Document\DeliveryNote\Model\DeliveryNote;
use common\logic\Order\Order\Model\Order;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Product\Product\Model\Product;
use domain\Distribution\Distribution\Distribution;
use domain\Document\DeliveryNote\DeliveryNote;
use domain\Order\Order\Order;
use domain\Producer\Producer\Producer;
use DateTime;
use domain\Product\Product\Product;
use yii\base\ErrorException;
use yii\base\Exception;
use yii\filters\AccessControl;
@@ -108,6 +107,7 @@ class DistributionController extends BackendController
$orderModule = $this->getOrderModule();
$productModule = $this->getProductModule();
$userModule = $this->getUserModule();
$producerModule = $this->getProducerModule();

$producer = $this->getProducerCurrent();
$dateObject = DateTime::createFromFormat('Y-m-d', $date);
@@ -115,6 +115,7 @@ class DistributionController extends BackendController
$json['means_payment'] = MeanPayment::getAll();
$json['producer'] = $this->buildAjaxInfosResponseProducer($producer);
$json['distributions'] = $this->buildAjaxInfosResponseDistributions($dateObject);
$json['leave_period_dates'] = $this->buildAjaxInfosResponseLeavePeriod($producer);
$json['units'] = Product::$unitsArray;

if ($distributionModule->getSolver()->validateDistributionDate($date)) {
@@ -132,12 +133,29 @@ class DistributionController extends BackendController
$json['users'] = $userModule->findUsers();
$json['one_distribution_week_active'] = $distributionModule->isOneDistributionWeekActive($date);
$json['tiller_is_synchro'] = $this->buildAjaxInfosResponseTiller($producer, $date);
$json['tiller_is_authenticated'] = $this->getOrderModule()->getTillerManager()->isAuthenticated();
$json['tiller_url_authorize_code'] = $this->getOrderModule()->getTillerManager()->getUrlAuthorizeCode();
$json['missing_subscriptions'] = $this->buildAjaxInfosResponseMissingSubscriptions($date, $distribution, $ordersArrayObject);
}

return $json;
}

public function buildAjaxInfosResponseLeavePeriod(Producer $producer)
{
$producerModule = $this->getProducerModule();
$leavePeriodDatesArray = [];
if($producerModule->getSolver()->hasLeavePeriodDefined($producer)) {
$leavePeriodStart = $producerModule->getSolver()->getLeavePeriodStartDateTime($producer);
$leavePeriodEnd = $producerModule->getSolver()->getLeavePeriodEndDateTime($producer);
for($date = $leavePeriodStart; $date <= $leavePeriodEnd; $date->modify('+1 day')) {
$leavePeriodDatesArray[] = $date->format('Y-m-d');
}
}

return $leavePeriodDatesArray;
}

public function buildAjaxInfosResponsePointsSale(Distribution $distribution)
{
$producerModule = $this->getProducerModule();
@@ -255,6 +273,7 @@ class DistributionController extends BackendController

public function buildAjaxInfosResponseDistribution(Distribution $distribution, array $ordersArray, array $productsArray)
{
$producerModule = $this->getProducerModule();
$productModule = $this->getProductModule();
$orderModule = $this->getOrderModule();
$distributionModule = $this-> getDistributionModule();
@@ -264,6 +283,7 @@ class DistributionController extends BackendController
'active' => $distribution->active,
'exports' => $distributionModule->getExportManager()->getAjaxArray($distribution),
'url_order' => $distributionModule->getLinkOrder($distribution),
'is_leave_period' => $producerModule->getSolver()->isOnLeavePeriod($distribution->producer, DateTime::createFromFormat('Y-m-d', $distribution->date))
];

// montant et poids des commandes

+ 25
- 13
backend/controllers/DocumentController.php 查看文件

@@ -43,21 +43,20 @@ use common\helpers\CSV;
use common\helpers\GlobalParam;
use common\helpers\MeanPayment;
use common\helpers\Price;
use common\logic\Document\DeliveryNote\Model\DeliveryNote;
use common\logic\Document\Document\Model\Document;
use common\logic\Document\Invoice\Model\Invoice;
use common\logic\Document\Quotation\Model\Quotation;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\ProductOrder\Model\ProductOrder;
use common\logic\Product\Product\Model\Product;
use domain\Document\DeliveryNote\DeliveryNote;
use domain\Document\Document\Document;
use domain\Document\Invoice\Invoice;
use domain\Document\Quotation\Quotation;
use domain\Order\Order\Order;
use domain\Order\ProductOrder\ProductOrder;
use domain\Payment\Payment;
use kartik\mpdf\Pdf;
use yii\base\UserException;
use domain\Product\Product\Product;
use yii;
use yii\filters\VerbFilter;
use yii\base\UserException;
use yii\filters\AccessControl;
use yii\web\NotFoundHttpException;
use yii\helpers\Html;
use common\logic\Payment\Model\Payment;
use yii\web\NotFoundHttpException;

class DocumentController extends BackendController
{
@@ -591,6 +590,7 @@ class DocumentController extends BackendController

foreach ($order->productOrder as $productOrder) {
$productsOrderArray[$productOrder->id] = array_merge($productOrder->getAttributes(), [
'url_product' => $this->getUrlManagerBackend()->createUrl(['product/update', 'id' => $productOrder->id_product]),
'url_order' => $this->getUrlManagerBackend()->createUrl(['distribution/index', 'idOrderUpdate' => $productOrder->id_order])
]);
}
@@ -701,12 +701,10 @@ class DocumentController extends BackendController
public function actionAjaxDeleteProductOrder($idProductOrder)
{
$productOrderModule = $this->getProductOrderModule();

$productOrder = $productOrderModule->findOneProductOrderById($idProductOrder);

if ($productOrder) {
$productOrderModule->delete($productOrder);

return Ajax::responseSuccess('Produit supprimé');
}

@@ -771,6 +769,20 @@ class DocumentController extends BackendController
}
}

public function actionAjaxUpdateProductOrderInvoicePrice($idProductOrder, $invoicePrice)
{
$productOrderModule = $this->getProductOrderModule();
$productOrder = $productOrderModule->getRepository()->findOneProductOrderById((int) $idProductOrder);
if($productOrder) {
$productOrderModule->getBuilder()->updateProductOrderInvoicePriceByValue($productOrder, (float) $invoicePrice);
return Ajax::responseSuccess("Prix mis à jour", [
'invoice_price' => $productOrder->invoice_price
]);
}

return Ajax::responseError("Une erreur est survenue.");
}

public function getClass()
{
$class = get_class($this);

+ 1
- 2
backend/controllers/InvoiceController.php 查看文件

@@ -39,8 +39,7 @@
namespace backend\controllers;

use common\helpers\Ajax;
use common\logic\Document\Invoice\Model\InvoiceSearch;
use common\logic\Order\Order\Model\Order;
use domain\Document\Invoice\InvoiceSearch;

class InvoiceController extends DocumentController
{

+ 79
- 0
backend/controllers/OnlineAdminController.php 查看文件

@@ -0,0 +1,79 @@
<?php

/**
* Copyright distrib (2018)
*
* contact@opendistrib.net
*
* Ce logiciel est un programme informatique servant à aider les producteurs
* à distribuer leur production en circuits courts.
*
* Ce logiciel est régi par la licence CeCILL soumise au droit français et
* respectant les principes de diffusion des logiciels libres. Vous pouvez
* utiliser, modifier et/ou redistribuer ce programme sous les conditions
* de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
* sur le site "http://www.cecill.info".
*
* En contrepartie de l'accessibilité au code source et des droits de copie,
* de modification et de redistribution accordés par cette licence, il n'est
* offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
* seule une responsabilité restreinte pèse sur l'auteur du programme, le
* titulaire des droits patrimoniaux et les concédants successifs.
*
* A cet égard l'attention de l'utilisateur est attirée sur les risques
* associés au chargement, à l'utilisation, à la modification et/ou au
* développement et à la reproduction du logiciel par l'utilisateur étant
* donné sa spécificité de logiciel libre, qui peut le rendre complexe à
* manipuler et qui le réserve donc à des développeurs et des professionnels
* avertis possédant des connaissances informatiques approfondies. Les
* utilisateurs sont donc invités à charger et tester l'adéquation du
* logiciel à leurs besoins dans des conditions permettant d'assurer la
* sécurité de leurs systèmes et ou de leurs données et, plus généralement,
* à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
*
* Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
* pris connaissance de la licence CeCILL, et que vous en avez accepté les
* termes.
*/

namespace backend\controllers;

use yii\filters\VerbFilter;
use yii\filters\AccessControl;

class OnlineAdminController extends BackendController
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::class,
],
'access' => [
'class' => AccessControl::class,
'rules' => [
[
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
return $this->getUserModule()
->getAuthorizationChecker()
->isGrantedAsAdministrator($this->getUserCurrent());
}
]
],
],
];
}

public function actionIndex()
{
$usersWithStatusProducerOnlineArray = $this->getUserModule()->getRepository()->findUsersWithStatusProducerAndOnline();
$usersWithStatusUserOnlineArray = $this->getUserModule()->getRepository()->findUsersWithStatusUserAndOnline();

return $this->render('index', [
'usersWithStatusProducerOnlineArray' => $usersWithStatusProducerOnlineArray,
'usersWithStatusUserOnlineArray' => $usersWithStatusUserOnlineArray,
]);
}
}

+ 10
- 10
backend/controllers/OrderController.php 查看文件

@@ -42,16 +42,16 @@ use common\forms\SubscriptionForm;
use common\helpers\CSV;
use common\helpers\GlobalParam;
use common\helpers\Price;
use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Distribution\PointSaleDistribution\Model\PointSaleDistribution;
use common\logic\Distribution\ProductDistribution\Model\ProductDistribution;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\ProductOrder\Model\ProductOrder;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\Product\Product\Model\Product;
use common\logic\Payment\Model\Payment;
use common\logic\User\User\Model\User;
use common\logic\User\UserProducer\Model\UserProducer;
use domain\Distribution\Distribution\Distribution;
use domain\Distribution\PointSaleDistribution\PointSaleDistribution;
use domain\Distribution\ProductDistribution\ProductDistribution;
use domain\Order\Order\Order;
use domain\Order\ProductOrder\ProductOrder;
use domain\Payment\Payment;
use domain\PointSale\PointSale\PointSale;
use domain\Product\Product\Product;
use domain\User\User\User;
use domain\User\UserProducer\UserProducer;
use yii\filters\AccessControl;
use yii\helpers\Html;


+ 6
- 8
backend/controllers/PointSaleController.php 查看文件

@@ -39,16 +39,14 @@
namespace backend\controllers;

use common\helpers\GlobalParam;
use common\logic\Distribution\PointSaleDistribution\Model\PointSaleDistribution;
use common\logic\Order\Order\Model\Order;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\PointSale\PointSale\Model\PointSaleSearch;
use common\logic\PointSale\UserPointSale\Model\UserPointSale;
use Yii;
use domain\Distribution\PointSaleDistribution\PointSaleDistribution;
use domain\Order\Order\Order;
use domain\PointSale\PointSale\PointSale;
use domain\PointSale\PointSale\PointSaleSearch;
use domain\PointSale\UserPointSale\UserPointSale;
use yii\filters\AccessControl;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\helpers\Html;
use yii\web\NotFoundHttpException;

class PointSaleController extends BackendController
{

+ 6
- 15
backend/controllers/ProducerAdminController.php 查看文件

@@ -40,15 +40,15 @@ namespace backend\controllers;

use common\helpers\Ajax;
use common\helpers\Alwaysdata;
use common\logic\Order\Order\Model\Order;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Product\Product\Model\Product;
use domain\Order\Order\Order;
use domain\Producer\Producer\Producer;
use domain\Product\Product\Product;
use Yii;
use yii\data\ActiveDataProvider;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\helpers\Html;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use yii\data\ActiveDataProvider;

class ProducerAdminController extends BackendController
{
@@ -78,15 +78,6 @@ class ProducerAdminController extends BackendController
];
}

public function actionOnline()
{
$usersWithStatusProducerOnlineArray = $this->getUserModule()->getRepository()->findUsersStatusProducerOnline();

return $this->render('@backend/views/producer-admin/online', [
'usersWithStatusProducerOnlineArray' => $usersWithStatusProducerOnlineArray,
]);
}

/**
* Liste les producteurs.
*

+ 6
- 7
backend/controllers/ProducerController.php 查看文件

@@ -39,14 +39,13 @@
namespace backend\controllers;

use common\helpers\GlobalParam;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Producer\ProducerPriceRange\Model\ProducerPriceRange;
use domain\Producer\ProducerPriceRange\ProducerPriceRange;
use domain\Producer\Producer\Producer;
use Yii;
use yii\data\ActiveDataProvider;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use common\helpers\Upload;
use yii\filters\VerbFilter;
use yii\web\NotFoundHttpException;
use yii\web\UploadedFile;

/**
@@ -95,7 +94,7 @@ class ProducerController extends BackendController
$logoFilenameOld = $model->logo;
$photoFilenameOld = $model->photo;
$documentImageBottomFilenameOld = $model->document_image_bottom;
$producerBuilder->initOptionDashboardDatesDisplay($model);
$producerBuilder->initOptionsDatesDisplay($model);

if ($model->load(\Yii::$app->request->post())) {

@@ -105,10 +104,10 @@ class ProducerController extends BackendController

if($model->validate()) {

$producerBuilder->initOptionsDatesBeforeSave($model);
$producerBuilder->processUploadImage($model, 'logo', $logoFilenameOld, $request->post('delete_logo', 0));
$producerBuilder->processUploadImage($model, 'photo', $photoFilenameOld, $request->post('delete_photo', 0));
$producerBuilder->processUploadImage($model, 'document_image_bottom', $documentImageBottomFilenameOld, $request->post('delete_document_image_bottom', 0));
$producerBuilder->initOptionDashboardDatesBeforeSave($model);
$producerBuilder->savePrivateKeysStripe($model);
$model->save();


+ 3
- 5
backend/controllers/ProducerPriceRangeAdminController.php 查看文件

@@ -38,12 +38,10 @@

namespace backend\controllers;

use common\logic\Producer\ProducerPriceRange\Model\ProducerPriceRange;
use Yii;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use domain\Producer\ProducerPriceRange\ProducerPriceRange;
use yii\data\ActiveDataProvider;
use yii\filters\AccessControl;
use yii\web\NotFoundHttpException;

/**
* ProducerPriceRangeAdminController implements the CRUD actions for ProducerPriceRange model.

+ 3
- 4
backend/controllers/ProductCategoryController.php 查看文件

@@ -39,13 +39,12 @@
namespace backend\controllers;

use common\helpers\GlobalParam;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\ProductCategory\Model\ProductCategorySearch;
use domain\Product\Product\Product;
use domain\Product\ProductCategory\ProductCategorySearch;
use Yii;
use yii\filters\AccessControl;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\helpers\Html;
use yii\web\NotFoundHttpException;

/**
* ProductCategoryController implements the CRUD actions for ProductCategory model.

+ 9
- 9
backend/controllers/ProductController.php 查看文件

@@ -41,19 +41,19 @@ namespace backend\controllers;
use backend\forms\ProductPriceUploadForm;
use common\helpers\CSV;
use common\helpers\GlobalParam;
use common\logic\Feature\Feature\Feature;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Model\ProductSearch;
use common\logic\Product\ProductPointSale\Model\ProductPointSale;
use common\logic\Product\ProductPrice\Model\ProductPrice;
use common\logic\Product\ProductPrice\Model\ProductPriceSearch;
use common\logic\User\UserProducer\Model\UserProducer;
use common\helpers\Upload;
use domain\Feature\Feature\Feature;
use domain\PointSale\PointSale\PointSale;
use domain\Product\Product\Product;
use domain\Product\Product\ProductSearch;
use domain\Product\ProductPointSale\ProductPointSale;
use domain\Product\ProductPrice\Model\ProductPrice;
use domain\Product\ProductPrice\Model\ProductPriceSearch;
use domain\User\UserProducer\UserProducer;
use Yii;
use yii\filters\AccessControl;
use yii\helpers\Html;
use yii\web\NotFoundHttpException;
use common\helpers\Upload;
use yii\web\UploadedFile;

/**

+ 2
- 2
backend/controllers/QuotationController.php 查看文件

@@ -39,8 +39,8 @@
namespace backend\controllers;

use common\helpers\GlobalParam;
use common\logic\Document\Quotation\Model\QuotationSearch;
use common\logic\Order\Order\Model\Order;
use domain\Document\Quotation\QuotationSearch;
use domain\Order\Order\Order;
use yii\base\UserException;
use yii\filters\AccessControl;
use yii\helpers\Html;

+ 1
- 2
backend/controllers/SiteController.php 查看文件

@@ -38,10 +38,9 @@

namespace backend\controllers;

use common\logic\User\User\Model\User;
use common\forms\LoginForm;
use Yii;
use yii\filters\AccessControl;
use common\forms\LoginForm;
use yii\filters\VerbFilter;

/**

+ 23
- 18
backend/controllers/SubscriptionController.php 查看文件

@@ -39,9 +39,8 @@ namespace backend\controllers;

use common\forms\SubscriptionForm;
use common\helpers\GlobalParam;
use common\logic\Config\Unit\Service\UnitDefinition;
use common\logic\Product\Product\Model\Product;
use common\logic\Subscription\Subscription\Model\SubscriptionSearch;
use domain\Product\Product\Product;
use domain\Subscription\Subscription\SubscriptionSearch;
use yii\filters\AccessControl;
use yii\web\NotFoundHttpException;

@@ -261,25 +260,31 @@ class SubscriptionController extends BackendController
$subscriptionModule = $this->getSubscriptionModule();
$distributionModule = $this-> getDistributionModule();
$subscription = $subscriptionModule->findOneSubscriptionById($idSubscription);
$matchedDistributionsArray = $distributionModule->findDistributionsIncomingMatchWithSubscrtiption($subscription, true);
if($subscription) {
$matchedDistributionsArray = $distributionModule->findDistributionsIncomingMatchWithSubscrtiption($subscription, true);

if ($generate) {
if ($update) {
$subscriptionModule->getOrderManager()
->deleteOrdersIncomingDistributionsFromSubscription($subscription);
}
foreach ($matchedDistributionsArray as $distribution) {
$subscriptionModule->createOrderFromSubscription($subscription, $distribution->date);
if ($generate) {
if ($update) {
$subscriptionModule->getOrderManager()
->deleteOrdersIncomingDistributionsFromSubscription($subscription);
}
foreach ($matchedDistributionsArray as $distribution) {
$subscriptionModule->createOrderFromSubscription($subscription, $distribution->date);
}
$this->setFlash('success', 'Commandes ' . ($update ? 're-' : '') . 'générées dans les distributions futures.');
return $this->redirect(['subscription/index']);
}
$this->setFlash('success', 'Commandes ' . ($update ? 're-' : '') . 'générées dans les distributions futures.');

return $this->render('update_distributions', [
'matchedDistributionsArray' => $matchedDistributionsArray,
'idSubscription' => $idSubscription,
'update' => $update
]);
}
else {
$this->setFlash('error', 'Abonnement introuvable');
return $this->redirect(['subscription/index']);
}

return $this->render('update_distributions', [
'matchedDistributionsArray' => $matchedDistributionsArray,
'idSubscription' => $idSubscription,
'update' => $update
]);
}

public function actionAjaxInfos(int $idSubscription = 0)

+ 2
- 3
backend/controllers/SupportAdminController.php 查看文件

@@ -38,9 +38,8 @@

namespace backend\controllers;

use common\logic\Ticket\Ticket\Model\Ticket;
use common\logic\Ticket\Ticket\Model\TicketSearch;
use yii\filters\VerbFilter;
use domain\Ticket\Ticket\Ticket;
use domain\Ticket\Ticket\TicketSearch;
use yii\filters\AccessControl;

/**

+ 2
- 2
backend/controllers/SupportController.php 查看文件

@@ -38,8 +38,8 @@

namespace backend\controllers;

use common\logic\Ticket\Ticket\Model\Ticket;
use common\logic\Ticket\Ticket\Model\TicketSearch;
use domain\Ticket\Ticket\Ticket;
use domain\Ticket\Ticket\TicketSearch;
use yii\filters\AccessControl;
use yii\helpers\Html;
use yii\web\NotFoundHttpException;

+ 4
- 4
backend/controllers/TaxRateAdminController.php 查看文件

@@ -38,11 +38,11 @@

namespace backend\controllers;

use common\logic\Config\TaxRate\Model\TaxRate;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use domain\Config\TaxRate\TaxRate;
use yii\data\ActiveDataProvider;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\web\NotFoundHttpException;

/**
* TaxRateAdminController implements the CRUD actions for TaxRate model.

+ 91
- 0
backend/controllers/TillerController.php 查看文件

@@ -0,0 +1,91 @@
<?php

/**
* Copyright distrib (2018)
*
* contact@opendistrib.net
*
* Ce logiciel est un programme informatique servant à aider les producteurs
* à distribuer leur production en circuits courts.
*
* Ce logiciel est régi par la licence CeCILL soumise au droit français et
* respectant les principes de diffusion des logiciels libres. Vous pouvez
* utiliser, modifier et/ou redistribuer ce programme sous les conditions
* de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
* sur le site "http://www.cecill.info".
*
* En contrepartie de l'accessibilité au code source et des droits de copie,
* de modification et de redistribution accordés par cette licence, il n'est
* offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
* seule une responsabilité restreinte pèse sur l'auteur du programme, le
* titulaire des droits patrimoniaux et les concédants successifs.
*
* A cet égard l'attention de l'utilisateur est attirée sur les risques
* associés au chargement, à l'utilisation, à la modification et/ou au
* développement et à la reproduction du logiciel par l'utilisateur étant
* donné sa spécificité de logiciel libre, qui peut le rendre complexe à
* manipuler et qui le réserve donc à des développeurs et des professionnels
* avertis possédant des connaissances informatiques approfondies. Les
* utilisateurs sont donc invités à charger et tester l'adéquation du
* logiciel à leurs besoins dans des conditions permettant d'assurer la
* sécurité de leurs systèmes et ou de leurs données et, plus généralement,
* à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
*
* Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
* pris connaissance de la licence CeCILL, et que vous en avez accepté les
* termes.
*/

namespace backend\controllers;

use yii\filters\AccessControl;
use linslin\yii2\curl;

class TillerController extends BackendController
{
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::class,
'rules' => [
[
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
return $this->getUserModule()
->getAuthorizationChecker()
->isGrantedAsProducer($this->getUserCurrent());
}
]
],
],
];
}

public function actionOauth(string $code)
{
$producerModule = $this->getProducerModule();
$curl = new curl\Curl();

$redirectUri = $producerModule->getSolver()->getConfig('tiller_redirect_uri');
$clientId = $producerModule->getSolver()->getConfig('tiller_client_id');
$clientSecret = $producerModule->getSolver()->getConfig('tiller_client_secret');
$url = "https://oauth.api.tiller.systems/oauth2/token?grant_type=authorization_code&redirect_uri=$redirectUri&client_id=$clientId&client_secret=$clientSecret&code=$code";

$response = $curl
->setHeaders(['Content-type' => 'application/x-www-form-urlencoded'])
->post($url);

$datasResponse = json_decode($response);
$accessToken = $datasResponse->access_token;
$refreshToken = $datasResponse->refresh_token;

$producer = $this->getProducerCurrent();
$producer->tiller_access_token = $accessToken;
$producer->tiller_refresh_token = $refreshToken;
$producer->save();

return $this->redirectDashboard();
}
}

+ 16
- 101
backend/controllers/UserController.php 查看文件

@@ -40,18 +40,17 @@ namespace backend\controllers;

use backend\models\CreditForm;
use common\helpers\GlobalParam;
use backend\models\MailForm;
use common\helpers\Password;
use common\logic\Order\Order\Model\OrderSearch;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\PointSale\UserPointSale\Model\UserPointSale;
use common\logic\User\User\Model\User;
use common\logic\User\User\Model\UserSearch;
use common\logic\User\UserProducer\Model\UserProducer;
use common\logic\User\UserUserGroup\Model\UserUserGroup;
use domain\Order\Order\OrderSearch;
use domain\PointSale\PointSale\PointSale;
use domain\PointSale\UserPointSale\UserPointSale;
use domain\User\User\User;
use domain\User\User\UserSearch;
use domain\User\UserProducer\UserProducer;
use domain\User\UserUserGroup\UserUserGroup;
use Yii;
use yii\base\UserException;
use yii\filters\AccessControl;
use \Yii;
use yii\helpers\Html;
use yii\web\NotFoundHttpException;

@@ -386,6 +385,11 @@ class UserController extends BackendController

if ($creditForm->load(\Yii::$app->request->post()) && $creditForm->validate()) {

$dateTransaction = null;
if($creditForm->date_transaction) {
$dateTransaction = date('Y-m-d', strtotime(str_replace('/', '-', $creditForm->date_transaction)));
}

$paymentModule->getManager()
->creditOrDebitUser(
$creditForm->type,
@@ -393,7 +397,8 @@ class UserController extends BackendController
$creditForm->amount,
$creditForm->mean_payment,
$this->getUserCurrent(),
$creditForm->comment
$creditForm->comment,
$dateTransaction
);

if ($creditForm->send_mail) {
@@ -481,96 +486,6 @@ class UserController extends BackendController
}
}

/**
* Affiche la liste des emails des utilisateurs liés à un point de vente donné.
*/
public function actionMail(
$idPointSale = 0,
$sectionSubscribers = 0,
$sectionInactiveUsers = 0,
$usersPointSaleLink = 0,
$usersPointSaleHasOrder = 0)
{
$userModule = $this->getUserModule();
$distributionModule = $this->getDistributionModule();

if ($idPointSale && !$usersPointSaleLink && !$usersPointSaleHasOrder) {
$usersPointSaleLink = 1;
}

$users = $userModule->queryUsersBy([
'id_producer' => GlobalParam::getCurrentProducerId(),
'id_point_sale' => $idPointSale,
'users_point_sale_link' => $usersPointSaleLink,
'users_point_sale_has_order' => $usersPointSaleHasOrder,
'subscribers' => $sectionSubscribers,
'inactive' => $sectionInactiveUsers,
'newsletter' => true
])->all();

$usersArray = [];
foreach ($users as $key => $user) {
if (isset($user['email']) && strlen($user['email']) > 0) {
$usersArray[] = $user['email'];
} else {
unset($users[$key]);
}
}

$pointsSaleArray = PointSale::find()->where(['id_producer' => GlobalParam::getCurrentProducerId(), 'status' => 1])->all();

$pointSale = null;
if ($idPointSale) {
$pointSale = PointSale::findOne(['id' => $idPointSale]);
}

$mailForm = new MailForm();
if ($mailForm->load(\Yii::$app->request->post()) && $mailForm->validate()) {
$responseSendMail = $mailForm->sendEmail($users);
if ($responseSendMail->success()) {
$this->setFlash('success', 'Votre email a bien été envoyé.');
} else {
$bodyResponseSendMail = $responseSendMail->getBody();
$emailsErrorArray = [];

if (isset($bodyResponseSendMail['Messages'])) {
foreach ($bodyResponseSendMail['Messages'] as $message) {
if ($message['Status'] != 'success') {
$emailsErrorArray[] = $message['Errors'][0]['ErrorMessage'];
}
}
}

$messageError = 'Un problème est survenu lors de l\'envoi de votre email.';
if (count($emailsErrorArray) > 0) {
$messageError .= '<br />Problème détecté : ' . implode(',', $emailsErrorArray);
}
$this->setFlash('error', $messageError);
}

return $this->redirect(['mail', 'idPointSale' => $idPointSale]);
}

$incomingDistributions = $distributionModule->findDistributionsIncoming();
$incomingDistributionsArray = ['0' => '--'];
foreach ($incomingDistributions as $distribution) {
$incomingDistributionsArray[$distribution->id] = strftime('%A %d %B %Y', strtotime($distribution->date));
}

return $this->render('emails', [
'usersArray' => $usersArray,
'pointsSaleArray' => $pointsSaleArray,
'pointSale' => $pointSale,
'mailForm' => $mailForm,
'idPointSaleActive' => $idPointSale,
'incomingDistributionsArray' => $incomingDistributionsArray,
'sectionSubscribers' => $sectionSubscribers,
'sectionInactiveUsers' => $sectionInactiveUsers,
'usersPointSaleLink' => $usersPointSaleLink,
'usersPointSaleHasOrder' => $usersPointSaleHasOrder,
]);
}

public function actionSwitchIdentity(int $id)
{
$userModule = $this->getUserModule();
@@ -581,7 +496,7 @@ class UserController extends BackendController
$duration = 0;
Yii::$app->user->switchIdentity($user, $duration);
Yii::$app->session->set('user.idbeforeswitch', $initialId);
return $this->redirect(['index']);
return $this->redirect($this->getUrlManagerFrontend()->createUrl(['site/index']));
}
} else {
throw new NotFoundHttpException('Page introuvable');

+ 3
- 3
backend/controllers/UserGroupController.php 查看文件

@@ -39,11 +39,11 @@
namespace backend\controllers;

use common\helpers\GlobalParam;
use common\logic\User\UserGroup\Model\UserGroupSearch;
use common\logic\User\UserUserGroup\Model\UserUserGroup;
use domain\User\UserGroup\UserGroupSearch;
use domain\User\UserUserGroup\UserUserGroup;
use yii\filters\AccessControl;
use yii\web\NotFoundHttpException;
use yii\helpers\Html;
use yii\web\NotFoundHttpException;

/**
* PointVenteController implements the CRUD actions for PointVente model.

+ 1
- 1
backend/forms/AdminSettingsForm.php 查看文件

@@ -2,7 +2,7 @@

namespace backend\forms;

use common\logic\Setting\SettingModule;
use domain\Setting\SettingModule;
use yii\base\Model;

class AdminSettingsForm extends Model

+ 1
- 1
backend/models/AccessUserProducerForm.php 查看文件

@@ -39,7 +39,7 @@ termes.
namespace backend\models;

use common\helpers\GlobalParam;
use common\logic\User\User\Model\User;
use domain\User\User\User;
use yii\base\Model;

/**

+ 3
- 42
backend/models/CreditForm.php 查看文件

@@ -38,11 +38,6 @@ termes.

namespace backend\models;

use common\helpers\GlobalParam;
use common\logic\Payment\Module\PaymentModule;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\User\User\Module\UserModule;
use common\logic\User\UserProducer\Module\UserProducerModule;
use yii\base\Model;

/**
@@ -50,7 +45,6 @@ use yii\base\Model;
*/
class CreditForm extends Model
{

public $id_user ;
public $id_user_action ;
public $id_producer ;
@@ -59,6 +53,7 @@ class CreditForm extends Model
public $mean_payment ;
public $comment ;
public $send_mail = 1;
public $date_transaction;

/**
* @inheritdoc
@@ -68,7 +63,7 @@ class CreditForm extends Model
return [
[['amount'], 'required'],
[['id_user', 'id_user_action', 'id_producer'], 'integer'],
[['date','send_mail'], 'safe'],
[['date', 'send_mail', 'date_transaction'], 'safe'],
[['amount'], 'double'],
[['type', 'mean_payment'], 'string', 'max' => 255],
[['comment'], 'string', 'max' => 2048],
@@ -90,41 +85,7 @@ class CreditForm extends Model
'mean_payment' => 'Moyen de paiement',
'comment' => 'Commentaire',
'send_mail' => 'Prévenir l\'utilisateur',
'date_transaction' => 'Date de transaction'
];
}
/**
* Enregistre un modèle CreditHistorique.
*/
public function save()
{
$userModule = UserModule::getInstance();
$userProducerModule = UserProducerModule::getInstance();
$paymentManager = PaymentModule::getInstance();

if ($this->validate()) {
$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) {
$producer = GlobalParam::getCurrentProducer() ;
$userProducer = $userProducerModule->findOneUserProducer($user);

\Yii::$app->mailerService->sendFromProducer(
'Mouvement de crédit',
'creditUser',
[
'user' => $user,
'producer' => $producer,
'userProducer' => $userProducer,
'creditForm' => $this
],
$user->email,
$producer
);
}
}
}

}

+ 7
- 7
backend/models/MailForm.php 查看文件

@@ -40,15 +40,15 @@ namespace backend\models;

use common\helpers\GlobalParam;
use common\helpers\Mailjet;
use common\logic\Config\Unit\Service\UnitDefinition;
use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Distribution\Distribution\Module\DistributionModule;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Module\ProductModule;
use common\helpers\Price;
use domain\Config\Unit\UnitDefinition;
use domain\Distribution\Distribution\Distribution;
use domain\Distribution\Distribution\DistributionModule;
use domain\Producer\Producer\ProducerModule;
use domain\Product\Product\Product;
use domain\Product\Product\ProductModule;
use Yii;
use yii\base\Model;
use common\helpers\Price ;
use yii\helpers\Html;

/**

backend/views/user/emails.php → backend/views/communicate/email.php 查看文件

@@ -47,12 +47,15 @@ $this->addBreadcrumb($this->getTitle()) ;

<?=

$this->render('_menu',[
$this->render('@backend/views/user/_menu.php',[
'section' => 'email',
'idPointSaleActive' => $idPointSaleActive,
'sectionInactiveUsers' => isset($sectionInactiveUsers) ? $sectionInactiveUsers : null,
'sectionSubscribers' => isset($sectionSubscribers) ? $sectionSubscribers: null,
'pointsSaleArray' => $pointsSaleArray,
'section' => 'mail'
'idDistributionActive' => $idDistributionActive,
'incomingDistributionsArray' => $incomingDistributionsArray,
'incomingDistributionsDatesArray' => $incomingDistributionsDatesArray,
]) ;

?>
@@ -61,11 +64,11 @@ $this->render('_menu',[
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Envoyer un message</h3>
<h3 class="panel-title">Envoyer un email</h3>
</div>
<div class="panel-body">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($mailForm, 'id_distribution')->dropDownList($incomingDistributionsArray)
<?= $form->field($mailForm, 'id_distribution')->dropDownList($incomingDistributionsDatesArray)
->hint("Sélectionnez une distribution pour ajouter automatiquement au message un lien vers la prise de commande de cette distribution"); ?>
<?= $form->field($mailForm, 'integrate_product_list')->checkbox() ; ?>
<?= $form->field($mailForm, 'subject')->textInput() ; ?>
@@ -87,8 +90,8 @@ $this->render('_menu',[
<div class="panel-body">
<?php if($idPointSaleActive): ?>
<a class="btn btn-xs <?php if($usersPointSaleLink): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/mail','idPointSale' => $idPointSaleActive, 'usersPointSaleLink' => 1]); ?>">Liés au point de vente</a>
<a class="btn btn-xs <?php if($usersPointSaleHasOrder): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/mail','idPointSale' => $idPointSaleActive, 'usersPointSaleHasOrder' => 1]); ?>">Déjà commandés dans ce point de vente</a>
<a class="btn btn-xs <?php if($usersPointSaleLink): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['communicate/email','idPointSale' => $idPointSaleActive, 'idDistribution' => $idDistributionActive, 'usersPointSaleLink' => 1]); ?>">Liés au point de vente</a>
<a class="btn btn-xs <?php if($usersPointSaleHasOrder): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['communicate/email','idPointSale' => $idPointSaleActive, 'idDistribution' => $idDistributionActive, 'usersPointSaleHasOrder' => 1]); ?>">Déjà commandés dans ce point de vente</a>
<br /><br />
<?php endif; ?>

+ 0
- 77
backend/views/communicate/index.php 查看文件

@@ -1,77 +0,0 @@
<?php

/**
Copyright distrib (2018)

contact@opendistrib.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use yii\helpers\Html ;

$this->setTitle('Communiquer') ;
$this->addBreadcrumb('Communiquer') ;

?>

<div class="col-md-6">
<div id="email" class="panel panel-default" v-if="date">
<div class="panel-heading">
<h3 class="panel-title">Envoyer un email</h3>
</div>
<div class="panel-body">
<p>Choisissez à quels utilisateurs vous souhaitez envoyer un email :</p>
<div>
<?= Html::a('<span class="glyphicon glyphicon-th-list"></span> Tous',['user/mail', 'idPointSale' => 0], ['class' => 'btn btn-default btn-point-sale']); ?>
<?= Html::a('<span class="glyphicon glyphicon-repeat"></span> Abonnés',['user/mail', 'sectionSubscribers' => 1], ['class' => 'btn btn-default btn-point-sale']); ?>
<?= Html::a('<span class="glyphicon glyphicon-time"></span> Inactifs',['user/mail', 'sectionInactiveUsers' => 1], ['class' => 'btn btn-default btn-point-sale']); ?>
<?php foreach($pointsSaleArray as $pointSale): ?>
<?= Html::a('<span class="glyphicon glyphicon-map-marker"></span> '.Html::encode($pointSale->name), ['user/mail', 'idPointSale' => $pointSale->id], ['class' => 'btn btn-default btn-point-sale']); ?>
<?php endforeach; ?>
</div>
</div>
</div>
</div>

<div class="col-md-6">
<div id="paper" class="panel panel-default" v-if="date">
<div class="panel-heading">
<h3 class="panel-title">Communiquer par papier</h3>
</div>
<div class="panel-body">
<p>Imprimez ce petit encart pour indiquer à vos clients l'adresse internet leur permettant de passer leurs commandes.</p>
<?php echo $this->render('instructions', ['producer' => $producer]) ; ?>
<p><?php echo Html::a('<span class="glyphicon glyphicon-download-alt"></span> Télécharger', ['communicate/instructions'], ['class'=>'btn btn-primary']) ?></p>
</div>
</div>
</div>


+ 56
- 0
backend/views/communicate/paper.php 查看文件

@@ -0,0 +1,56 @@
<?php

/**
Copyright distrib (2018)

contact@opendistrib.net

Ce logiciel est un programme informatique servant à aider les producteurs
à distribuer leur production en circuits courts.

Ce logiciel est régi par la licence CeCILL soumise au droit français et
respectant les principes de diffusion des logiciels libres. Vous pouvez
utiliser, modifier et/ou redistribuer ce programme sous les conditions
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
sur le site "http://www.cecill.info".

En contrepartie de l'accessibilité au code source et des droits de copie,
de modification et de redistribution accordés par cette licence, il n'est
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
seule une responsabilité restreinte pèse sur l'auteur du programme, le
titulaire des droits patrimoniaux et les concédants successifs.

A cet égard l'attention de l'utilisateur est attirée sur les risques
associés au chargement, à l'utilisation, à la modification et/ou au
développement et à la reproduction du logiciel par l'utilisateur étant
donné sa spécificité de logiciel libre, qui peut le rendre complexe à
manipuler et qui le réserve donc à des développeurs et des professionnels
avertis possédant des connaissances informatiques approfondies. Les
utilisateurs sont donc invités à charger et tester l'adéquation du
logiciel à leurs besoins dans des conditions permettant d'assurer la
sécurité de leurs systèmes et ou de leurs données et, plus généralement,
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.

Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use yii\helpers\Html ;

$this->setTitle('Communiquer par papier') ;
$this->addBreadcrumb('Communiquer') ;

?>

<div id="paper" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Encart à imprimer</h3>
</div>
<div class="panel-body">
<p>Imprimez cet encart pour indiquer à vos clients l'adresse internet leur permettant de passer leurs commandes.</p>
<?php echo $this->render('instructions', ['producer' => $producer]) ; ?>
<p><?php echo Html::a('<span class="glyphicon glyphicon-download-alt"></span> Télécharger', ['communicate/instructions'], ['class'=>'btn btn-primary']) ?></p>
</div>
</div>


+ 8
- 9
backend/views/dashboard/index.php 查看文件

@@ -36,15 +36,14 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\helpers\GlobalParam;
use common\logic\Distribution\Distribution\Module\DistributionModule;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Module\OrderModule;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\Setting\SettingModule;
use common\logic\Subscription\Subscription\Module\SubscriptionModule;
use common\logic\User\User\Module\UserModule;
use yii\helpers\Html ;
use domain\Distribution\Distribution\DistributionModule;
use domain\Order\Order\Order;
use domain\Order\Order\OrderModule;
use domain\Producer\Producer\ProducerModule;
use domain\Setting\SettingModule;
use domain\Subscription\Subscription\SubscriptionModule;
use domain\User\User\UserModule;
use yii\helpers\Html;

$distributionModule = DistributionModule::getInstance();
$userModule = UserModule::getInstance();

+ 4
- 5
backend/views/delivery-note/index.php 查看文件

@@ -36,13 +36,12 @@
* termes.
*/

use common\logic\Document\DeliveryNote\Model\DeliveryNote;
use domain\Document\DeliveryNote\DeliveryNote;
use domain\Order\Order\Order;
use domain\PointSale\PointSale\PointSale;
use yii\grid\GridView;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\Order\Order\Model\Order;
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use common\logic\Document\DeliveryNote\Module\DeliveryNoteModule;
use yii\helpers\Html;

$deliveryNoteModule = $this->getDeliveryNoteModule();


+ 15
- 5
backend/views/distribution/index.php 查看文件

@@ -92,11 +92,16 @@ $this->setPageTitle('Distributions') ;
<span class="info-box-text">
<h4>
Distribution du <strong>{{ dateFormat }}</strong>
<a class="btn btn-default" :href="distribution.url_order" @click="copyLinkOrder($event, distribution.url_order)"><span class="glyphicon glyphicon-link"></span></a>
<a v-if="distribution.active" class="btn btn-default" :href="distribution.url_order" @click="copyLinkOrder($event, distribution.url_order)"><span class="glyphicon glyphicon-link"></span></a>
<span v-if="distribution.is_leave_period" class="label label-info">
<span class="glyphicon glyphicon-info-sign"></span>
Congés
</span>
</h4>

<a @click="activeWeekDistribution" data-active="0" class="btn btn-default btn-active-week" v-if="oneDistributionWeekActive">Désactiver cette semaine</a>
<a @click="activeWeekDistribution" data-active="1" class="btn btn-default btn-active-week" v-else>Activer cette semaine</a>
<a @click="activeDistribution" data-active="0" class="btn btn-default" v-if="distribution.active">Désactiver ce jour</a>
<a @click="activeDistribution" data-active="1" class="btn btn-default" v-else>Activer ce jour</a>
</span>
@@ -294,13 +299,18 @@ $this->setPageTitle('Distributions') ;
</div>
<button id="btn-add-subscriptions" @click="addSubscriptions" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span> Importer les abonnements</button>
<template v-if="producer && producer.tiller == true">
<button v-if="tillerIsSynchro" id="btn-tiller" class="btn btn-success btn-xs" disabled><span class="glyphicon glyphicon-refresh"></span> Synchronisé avec Tiller</button>
<template v-else-if="!isDistributionToday()">
<template v-if="tillerIsAuthenticated">
<button v-if="tillerIsSynchro" id="btn-tiller" class="btn btn-success btn-xs" disabled><span class="glyphicon glyphicon-refresh"></span> Synchronisé avec Tiller</button>
<template v-else-if="!isDistributionToday()">
<span data-toggle="tooltip" data-placement="top" data-original-title="Synchronisation possible uniquement le jour de la distribution">
<button id="btn-tiller" class="btn btn-xs btn-default" disabled><span class="glyphicon glyphicon-refresh"></span> Synchroniser avec Tiller</button>
</span>
</template>
<button v-else id="btn-tiller" class="btn btn-xs btn-default" @click="synchroTiller"><span class="glyphicon glyphicon-refresh"></span> Synchroniser avec Tiller</button>
</template>
<template v-else>
<a :href="tillerUrlAuthorizeCode" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-refresh"></span> Connexion Tiller</a>
</template>
<button v-else id="btn-tiller" class="btn btn-xs btn-default" @click="synchroTiller"><span class="glyphicon glyphicon-refresh"></span> Synchroniser avec Tiller</button>
</template>
<button v-if="producer && producer.credit" id="btn-pay-orders" class="btn btn-default btn-xs" @click="payOrders"><span class="glyphicon glyphicon-euro"></span> Débiter les commandes</button>
<button id="btn-add-order" @click="openModalFormOrderCreate" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-plus"></span> Ajouter une commande</button>

+ 6
- 6
backend/views/distribution/report-bourlingue.php 查看文件

@@ -37,12 +37,12 @@ termes.
*/

use common\helpers\Price;
use common\logic\Config\Unit\Module\UnitModule;
use common\logic\Config\Unit\Service\UnitDefinition;
use common\logic\Order\Order\Module\OrderModule;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Module\ProductModule;
use common\logic\User\UserProducer\Model\UserProducer;
use domain\Config\Unit\UnitDefinition;
use domain\Config\Unit\UnitModule;
use domain\Order\Order\OrderModule;
use domain\Product\Product\Product;
use domain\Product\Product\ProductModule;
use domain\User\UserProducer\UserProducer;

$unitModule = UnitModule::getInstance();
$productModule = ProductModule::getInstance();

+ 3
- 3
backend/views/distribution/report-grid.php 查看文件

@@ -1,8 +1,8 @@
<?php

use common\logic\Order\Order\Module\OrderModule;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Product\Product\Module\ProductModule;
use domain\Order\Order\OrderModule;
use domain\Producer\Producer\Producer;
use domain\Product\Product\ProductModule;

$orderModule = OrderModule::getInstance();


+ 1
- 1
backend/views/distribution/shopping-cart-labels.php 查看文件

@@ -1,6 +1,6 @@
<?php

use common\logic\Distribution\Distribution\Export\DistributionShoppingCartLabelsPdfGenerator;
use domain\Distribution\Distribution\Export\DistributionShoppingCartLabelsPdfGenerator;

$distributionShoppingCartLabelsPdfGenerator = DistributionShoppingCartLabelsPdfGenerator::getInstance();
$index = 0;

+ 4
- 4
backend/views/document/_download_product_line.php 查看文件

@@ -1,10 +1,10 @@
<?php

use common\helpers\Price;
use common\logic\Config\Unit\Module\UnitModule;
use common\logic\Order\ProductOrder\Module\ProductOrderModule;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\Product\Product\Model\Product;
use domain\Config\Unit\UnitModule;
use domain\Order\ProductOrder\ProductOrderModule;
use domain\Producer\Producer\ProducerModule;
use domain\Product\Product\Product;
use yii\helpers\Html;

$documentModule = $this->getDocumentModule();

+ 28
- 20
backend/views/document/_form.php 查看文件

@@ -36,14 +36,7 @@
* termes.
*/

use common\helpers\MeanPayment;use common\helpers\Price;
use common\logic\Document\Document\Module\DocumentModule;
use common\logic\Document\Invoice\Module\InvoiceModule;
use common\logic\Payment\Module\PaymentModule;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\User\User\Module\UserModule;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use domain\Document\Document\DocumentModule;use domain\Document\Invoice\InvoiceModule;use domain\Payment\PaymentModule;use domain\Producer\Producer\ProducerModule;use domain\User\User\UserModule;use yii\helpers\Html;use yii\widgets\ActiveForm;

\backend\assets\VuejsDocumentFormAsset::register($this);

@@ -212,12 +205,6 @@ $documentClass = $documentModule->getClass($model);
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-download-alt"></span> Télécharger
(PDF)</a>

<?php if ($documentModule->isStatusValid($model)): ?>
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/regenerate', 'id' => $model->id]) ?>"
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-repeat"></span> Regénérer
(PDF)</a>
<?php endif; ?>

<?php if ($documentClass == 'Invoice' && $producerModule->getConfig('option_export_evoliz')): ?>
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/export-csv-evoliz', 'id' => $model->id]) ?>"
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-save-file"></span> Export Evoliz
@@ -233,6 +220,12 @@ $documentClass = $documentModule->getClass($model);
href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/validate', 'id' => $model->id, 'backUpdateForm' => 1]) ?>"
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-ok"></span> Valider le document</a>

<?php if ($documentModule->isStatusValid($model)): ?>
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/regenerate', 'id' => $model->id]) ?>"
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-repeat"></span> Regénérer
(PDF)</a>
<?php endif; ?>

<?php if (isset($model->user) && strlen($model->user->email) > 0): ?>
<a v-if="!document.is_sent"
href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/send', 'id' => $model->id, 'backUpdateForm' => 1]) ?>"
@@ -378,22 +371,37 @@ $documentClass = $documentModule->getClass($model);
<template v-for="order in ordersArray">
<tr v-for="productOrder in order.productOrder">
<td class="col-md-4">
<div class="product-name">{{ getProductById(productOrder.id_product).name }}
<div class="product-name">
<a :href="productOrder.url_product" target="_blank">
{{ getProductById(productOrder.id_product).name }}
</a>
</div>
<ul class="product-order-meta">
<li v-if="order.distribution_date">Commande : <a class="btn btn-sm btn-default"
:href="productOrder.url_order">{{
<li v-if="order.distribution_date">Commande : <a :href="productOrder.url_order">{{
order.distribution_date }}</a></li>
<li>Utilisateur : {{ order.username }}</li>
<li v-if="order.point_sale_name">Point de vente : {{ order.point_sale_name }}</li>
</ul>
</td>
<td class="col-md-2">
{{ formatPrice(getProductOrderPrice(productOrder)) }}
<template v-if="document.status == 'draft'">
<div class="input-group input-group-edit-invoice-price">
<input type="text" class="form-control" :id="'input-product-order-invoice-price-'+productOrder.id" :value="getProductOrderPrice(productOrder)" :data-id-product-order="productOrder.id" @keyup="showProductOrderInvoicePriceButtonApply" />
<span class="input-group-addon">€</span>
</div>
<div class="product-order-invoice-price-button-apply" :id="'product-order-invoice-price-button-apply-'+productOrder.id">
<button class="btn btn-success" type="button" :data-id-product-order="productOrder.id" @click="updateProductOrderInvoicePrice">
<span class="glyphicon glyphicon-ok"></span>
</button>
</div>
</template>
<template v-else>
{{ formatPrice(getProductOrderPrice(productOrder)) }}
</template>
<template
v-if="document.status == 'draft' && getProductOrderPrice(productOrder) != getBestProductPrice(productOrder.id_product, productOrder.quantity)">
<i class="fa fa-exclamation-triangle"
title="Prix différent de celui défini au niveau du produit"></i>
<i class="different-price fa fa-exclamation-triangle"
:title="'Prix différent de celui défini au niveau du produit ('+getBestProductPrice(productOrder.id_product, productOrder.quantity)+' €)'"></i>
</template>
</td>
<td class="col-md-2">{{ productOrder.quantity }}</td>

+ 2
- 2
backend/views/document/download.php 查看文件

@@ -1,8 +1,8 @@
<?php

use yii\helpers\Html;
use common\logic\Order\Order\Model\Order;
use common\helpers\Price;
use domain\Order\Order\Order;
use yii\helpers\Html;

$producerModule = $this->getProducerModule();
$userModule = $this->getUserModule();

+ 3
- 3
backend/views/document/form/_payment.php 查看文件

@@ -2,9 +2,9 @@

use common\helpers\MeanPayment;
use common\helpers\Price;
use common\logic\Document\Document\Module\DocumentModule;
use common\logic\Document\Invoice\Module\InvoiceModule;
use common\logic\Payment\Module\PaymentModule;
use domain\Document\Document\DocumentModule;
use domain\Document\Invoice\InvoiceModule;
use domain\Payment\PaymentModule;
use yii\helpers\Html;
use yii\widgets\ActiveForm;


+ 3
- 4
backend/views/invoice/index.php 查看文件

@@ -36,11 +36,10 @@
* termes.
*/

use yii\helpers\Html;
use domain\Document\Invoice\Invoice;
use domain\Order\Order\Order;
use yii\grid\GridView;
use common\helpers\Url;
use common\logic\Document\Invoice\Model\Invoice;
use common\logic\Order\Order\Model\Order;
use yii\helpers\Html;

$producerModule = $this->getProducerModule();
$invoiceModule = $this-> getInvoiceModule();

+ 5
- 6
backend/views/layouts/header.php 查看文件

@@ -36,15 +36,14 @@
* termes.
*/

use common\helpers\GlobalParam;
use common\helpers\Image;
use common\helpers\Price;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\User\User\Module\UserModule;
use domain\Distribution\Distribution\Distribution;
use domain\Producer\Producer\Producer;
use domain\Producer\Producer\ProducerModule;
use domain\User\User\UserModule;
use yii\helpers\Html;
use common\helpers\GlobalParam;

use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Producer\Producer\Model\Producer;

$userModule = UserModule::getInstance();
$producerModule = ProducerModule::getInstance();

+ 58
- 19
backend/views/layouts/left.php 查看文件

@@ -37,8 +37,8 @@
*/

use common\helpers\GlobalParam;
use common\logic\Feature\Feature\Feature;
use common\logic\User\User\Module\UserModule;
use domain\Feature\Feature\Feature;
use domain\User\User\UserModule;

$producerModule = $this->getProducerModule();
$userModule = UserModule::getInstance();
@@ -62,24 +62,27 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
$producer = GlobalParam::getCurrentProducer();
$newVersionOpendistribLabel = '';
if ($producer && !$producerModule->isUpToDateWithOpendistribVersion($producer)) {
$newVersionOpendistribLabel = '<span class="pull-right-container"><small class="label pull-right bg-green">'.GlobalParam::getOpendistribVersion().'</small></span>';
$newVersionOpendistribLabel = '<span class="pull-right-container"><small class="label pull-right bg-green">' . GlobalParam::getOpendistribVersion() . '</small></span>';
}

$countTicketsProducerUnreadLabel = '';
$countTicketsProducerUnread = $ticketModule->countTicketsUnreadByUser($this->getUserCurrent());
if($countTicketsProducerUnread && !$isUserCurrentGrantedAsAdministrator) {
$countTicketsProducerUnreadLabel = '<small class="label pull-right bg-blue">'.$countTicketsProducerUnread.'</small>';
if ($countTicketsProducerUnread && !$isUserCurrentGrantedAsAdministrator) {
$countTicketsProducerUnreadLabel = '<small class="label pull-right bg-blue">' . $countTicketsProducerUnread . '</small>';
}

$developerOnlineLabel = '';
if($adminSettingBag->get('supportOnline')) {
if ($adminSettingBag->get('supportOnline')) {
$developerOnlineLabel = '<small class="label pull-right bg-green"><i class="fa fa-phone"></i></small>';
}

$countTicketsAdminUnreadLabel = '';
$countTicketsAdminUnread = $ticketModule->countTicketsAdminUnreadByUser($this->getUserCurrent());
if($countTicketsAdminUnread && $isUserCurrentGrantedAsAdministrator) {
$countTicketsAdminUnreadLabel = '<span class="pull-right-container"><small class="label pull-right bg-green">'.$countTicketsAdminUnread.'</small></span>';
$countTicketsLabel = '';
$countTicketsAdminUnread = $ticketModule->getRepository()->countTicketsAdminUnreadByUser($this->getUserCurrent());
if ($countTicketsAdminUnread && $isUserCurrentGrantedAsAdministrator) {
$countTicketsLabel = '<span class="pull-right-container"><small class="label pull-right bg-green">' . $countTicketsAdminUnread . '</small></span>';
} else {
$countTicketsAdminOpen = $ticketModule->getRepository()->countTicketsAdminStatusOpen();
$countTicketsLabel = '<span class="pull-right-container"><small class="label pull-right bg-blue">' . $countTicketsAdminOpen . '</small></span>';
}

$sumUserProducerCredits = $userProducerModule->sumUserProducerCredits();
@@ -88,8 +91,34 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran

$countUsersWithStatusProducerOnline = $userModule->getRepository()->countUsersStatusProducerOnline();
$countUsersWithStatusProducerOnlineLabel = '';
if($countUsersWithStatusProducerOnline) {
$countUsersWithStatusProducerOnlineLabel = '<span class="pull-right-container"><small class="label pull-right bg-blue">'.$countUsersWithStatusProducerOnline.'</small></span>';
if ($countUsersWithStatusProducerOnline) {
$countUsersWithStatusProducerOnlineLabel = '<small class="label pull-right bg-red">' . $countUsersWithStatusProducerOnline . '</small>';
}

$countUsersWithStatusUserOnline = $userModule->getRepository()->countUsersStatusUserOnline();
$countUsersWithStatusUserOnlineLabel = '';
if ($countUsersWithStatusUserOnline) {
$countUsersWithStatusUserOnlineLabel = '<small class="label pull-right bg-blue">' . $countUsersWithStatusUserOnline . '</small>';
}

$countUsersOnlineLabel = '';
if ($countUsersWithStatusProducerOnline || $countUsersWithStatusUserOnline) {
$countUsersOnlineLabel = '<span class="pull-right-container">';
if ($countUsersWithStatusUserOnline) {
$countUsersOnlineLabel .= $countUsersWithStatusUserOnlineLabel;
}
if ($countUsersWithStatusProducerOnline) {
$countUsersOnlineLabel .= $countUsersWithStatusProducerOnlineLabel;
}
$countUsersOnlineLabel .= '</span>';
}

$countProducerInvoicesUnpaidLabel = '';
$countProducerInvoicesUnpaid = $this->getProducerModule()->getDolibarrUtils()
->countDolibarrProducerInvoicesUnpaid($producer);
if($countProducerInvoicesUnpaid > 1) {
$countProducerInvoicesUnpaidLabelColor = ($countProducerInvoicesUnpaid > 2) ? 'red' : 'orange';
$countProducerInvoicesUnpaidLabel = '<span class="pull-right-container"><small class="label pull-right bg-'.$countProducerInvoicesUnpaidLabelColor.'">' . $countProducerInvoicesUnpaid . '</small></span>';
}

?>
@@ -140,7 +169,16 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
],
],
['label' => 'Abonnements', 'icon' => 'repeat', 'url' => ['/subscription/index'], 'visible' => $isUserCurrentGrantedAsProducer, 'active' => Yii::$app->controller->id == 'subscription'],
['label' => 'Communiquer', 'icon' => 'bullhorn', 'url' => ['/communicate/index'], 'visible' => $isUserCurrentGrantedAsProducer],
[
'label' => 'Communiquer',
'icon' => 'bullhorn',
'url' => ['/communicate/email'],
'visible' => $isUserCurrentGrantedAsProducer,
'items' => [
['label' => 'Email', 'icon' => 'paper-plane', 'url' => ['/communicate/email'], 'visible' => $isUserCurrentGrantedAsProducer],
['label' => 'Papier', 'icon' => 'print', 'url' => ['/communicate/paper'], 'visible' => $isUserCurrentGrantedAsProducer],
]
],
[
'label' => 'Documents',
'icon' => 'clone',
@@ -170,6 +208,7 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
'url' => ['/producer-invoice/index'],
'visible' => $isUserCurrentGrantedAsProducer && Yii::$app->parameterBag->get('dolibarrApiKey'),
'active' => Yii::$app->controller->id == 'producer-invoice',
'template' => '<a href="{url}">{icon} {label}' . $countProducerInvoicesUnpaidLabel . '</a>'
],
['label' => 'Tarifs & modules', 'icon' => 'euro', 'url' => ['/producer/billing'], 'visible' => $isUserCurrentGrantedAsProducer],
[
@@ -184,16 +223,16 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
[
'label' => 'En ligne',
'icon' => 'wifi',
'url' => ['producer-admin/online'],
'url' => ['online-admin/index'],
'visible' => $isUserCurrentGrantedAsAdministrator,
'template' => '<a href="{url}">{icon} {label}' . $countUsersWithStatusProducerOnlineLabel . '</a>'
'template' => '<a href="{url}">{icon} {label}' . $countUsersOnlineLabel . '</a>'
],
[
'label' => 'Support',
'icon' => 'comments',
'url' => ['support-admin/index'],
'visible' => $isUserCurrentGrantedAsAdministrator,
'template' => '<a href="{url}">{icon} {label}' . $countTicketsAdminUnreadLabel . '</a>'
'template' => '<a href="{url}">{icon} {label}' . $countTicketsLabel . '</a>'
],
['label' => 'Producteurs', 'icon' => 'th-list', 'url' => ['/producer-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator],
[
@@ -202,9 +241,9 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
'url' => ['/stats-admin/matomo'],
'visible' => $isUserCurrentGrantedAsAdministrator,
'items' => [
['label' => 'Matomo', 'icon' => 'line-chart', 'url' => ['/stats-admin/matomo'], 'visible' => $isUserCurrentGrantedAsAdministrator],
['label' => 'Chiffre d\'affaire', 'icon' => 'line-chart', 'url' => ['/stats-admin/turnover'], 'visible' => $isUserCurrentGrantedAsAdministrator],
['label' => 'Commandes clients', 'icon' => 'calendar', 'url' => ['/stats-admin/customer-orders'], 'visible' => $isUserCurrentGrantedAsAdministrator],
['label' => 'Matomo', 'icon' => 'line-chart', 'url' => ['/stats-admin/matomo'], 'visible' => $isUserCurrentGrantedAsAdministrator],
['label' => 'Chiffre d\'affaire', 'icon' => 'line-chart', 'url' => ['/stats-admin/turnover'], 'visible' => $isUserCurrentGrantedAsAdministrator],
['label' => 'Commandes clients', 'icon' => 'calendar', 'url' => ['/stats-admin/customer-orders'], 'visible' => $isUserCurrentGrantedAsAdministrator],
],
],
['label' => 'Paramètres', 'icon' => 'cog', 'url' => ['/setting-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator && $featureChecker->isEnabled(Feature::ALIAS_SETTINGS)],

+ 3
- 0
backend/views/layouts/main.php 查看文件

@@ -68,6 +68,9 @@ if (Yii::$app->controller->action->id === 'login') {
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="baseurl" content="<?= Yii::$app->urlManagerBackend->baseUrl ; ?>">
<meta name="baseurl-absolute" content="<?= Yii::$app->urlManagerBackend->getHostInfo().Yii::$app->urlManagerBackend->baseUrl; ?>">
<?php if($this->metaRefresh): ?>
<meta http-equiv="refresh" content="60">
<?php endif; ?>
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->page_title) ?> | Opendistrib</title>
<link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManagerBackend->getBaseUrl(); ?>/img/favicon-distrib.png" />

+ 128
- 0
backend/views/online-admin/index.php 查看文件

@@ -0,0 +1,128 @@
<?php

/**
* Copyright distrib (2018)
*
* contact@opendistrib.net
*
* Ce logiciel est un programme informatique servant à aider les producteurs
* à distribuer leur production en circuits courts.
*
* Ce logiciel est régi par la licence CeCILL soumise au droit français et
* respectant les principes de diffusion des logiciels libres. Vous pouvez
* utiliser, modifier et/ou redistribuer ce programme sous les conditions
* de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
* sur le site "http://www.cecill.info".
*
* En contrepartie de l'accessibilité au code source et des droits de copie,
* de modification et de redistribution accordés par cette licence, il n'est
* offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
* seule une responsabilité restreinte pèse sur l'auteur du programme, le
* titulaire des droits patrimoniaux et les concédants successifs.
*
* A cet égard l'attention de l'utilisateur est attirée sur les risques
* associés au chargement, à l'utilisation, à la modification et/ou au
* développement et à la reproduction du logiciel par l'utilisateur étant
* donné sa spécificité de logiciel libre, qui peut le rendre complexe à
* manipuler et qui le réserve donc à des développeurs et des professionnels
* avertis possédant des connaissances informatiques approfondies. Les
* utilisateurs sont donc invités à charger et tester l'adéquation du
* logiciel à leurs besoins dans des conditions permettant d'assurer la
* sécurité de leurs systèmes et ou de leurs données et, plus généralement,
* à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
*
* Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
* pris connaissance de la licence CeCILL, et que vous en avez accepté les
* termes.
*/

use common\helpers\Image;
use yii\helpers\Html;

$producerModule = $this->getProducerModule();
$userModule = $this->getUserModule();
$this->setTitle('En ligne');
$this->addBreadcrumb($this->getTitle());
$this->setMetaRefresh(true);

?>
<div class="online-index">

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<div class="glyphicon glyphicon-grain"></div>
Producteurs (<?= count($usersWithStatusProducerOnlineArray); ?>)
</h3>
</div>
<div class="panel-body">
<?php if($usersWithStatusProducerOnlineArray && count($usersWithStatusProducerOnlineArray) > 0): ?>
<?php foreach ($usersWithStatusProducerOnlineArray as $userWithStatusProducerOnline): ?>
<?php $producer = $userWithStatusProducerOnline->producer; ?>
<?php if($producer): ?>
<div class="col-md-3">
<div class="box box-primary box-producer">
<div class="box-body box-profile">
<?php if ($producer->logo && Image::isPhotoExist($producer->logo)): ?>
<img class="profile-user-img img-responsive img-circle"
src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>"
alt="Logo <?= Html::encode($producer->name) ?>">
<?php endif; ?>

<h3 class="profile-username text-center">
<a title="Aller sur le compte de ce producteur" href="<?= $this->getUrlManagerBackend()->createUrl(['site/switch-producer', 'id' => $producer->id]); ?>">
<?= $producer->name; ?>
</a>
</h3>
<p class="text-muted text-center">
<?= $userModule->getSolver()->getUsername($userWithStatusProducerOnline); ?><br/>
</p>
</div>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
<?php else: ?>
<div class="alert alert-info">Aucun producteur en ligne actuellement.</div>
<?php endif; ?>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-user"></span>
Utilisateurs (<?= count($usersWithStatusUserOnlineArray); ?>)
</h3>
</div>
<div class="panel-body">
<?php if($usersWithStatusUserOnlineArray && count($usersWithStatusUserOnlineArray) > 0): ?>
<?php foreach ($usersWithStatusUserOnlineArray as $userWithStatusUserOnline): ?>
<div class="col-md-3">
<div class="box box-primary box-user">
<div class="box-body box-profile">
<h3 class="profile-username text-center">
<a title="Prendre la main" href="<?= $this->getUrlManagerBackend()->createUrl(['user/switch-identity', 'id' => $userWithStatusUserOnline->id]); ?>">
<?= $userModule->getSolver()->getUsername($userWithStatusUserOnline); ?>
</a>
</h3>
<p class="text-muted text-center">
<?php $userProducerArray = $userWithStatusUserOnline->userProducer; ?>
<?php foreach($userProducerArray as $userProducer): ?>
<?php if($userProducer->active && $userProducer->bookmark): ?>
<span class="label label-default"><?= $userProducer->producer->name; ?></span>
<?php endif; ?>
<?php endforeach; ?>
</p>
</div>
</div>
</div>
<?php endforeach; ?>
<div class="clr"></div>
<?php else: ?>
<div class="alert alert-info">Aucun utilisateur en ligne actuellement.</div>
<?php endif; ?>
</div>
</div>
</div>

+ 2
- 2
backend/views/order/report.php 查看文件

@@ -36,8 +36,8 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\logic\Order\Order\Model\Order;
use common\logic\Order\Order\Module\OrderModule;
use domain\Order\Order\Order;
use domain\Order\Order\OrderModule;

$orderModule = OrderModule::getInstance();


+ 6
- 6
backend/views/point-sale/_form.php 查看文件

@@ -36,15 +36,15 @@
* termes.
*/

use common\logic\Distribution\Distribution\Module\DistributionModule;
use common\logic\Distribution\Distribution\Service\ExportManager;
use common\logic\Producer\Producer\Module\ProducerModule;
use domain\Distribution\Distribution\DistributionModule;
use domain\Distribution\Distribution\ExportManager;
use domain\Producer\Producer\Producer;
use domain\Producer\Producer\ProducerModule;
use lo\widgets\Toggle;
use domain\User\User\UserModule;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\User\User\Module\UserModule;

$producerModule = ProducerModule::getInstance();
$userModule = UserModule::getInstance();

+ 3
- 3
backend/views/point-sale/index.php 查看文件

@@ -36,10 +36,10 @@
* termes.
*/

use yii\helpers\Html;
use domain\PointSale\UserPointSale\UserPointSale;
use domain\Producer\Producer\Producer;
use yii\grid\GridView;
use common\logic\PointSale\UserPointSale\Model\UserPointSale;
use common\logic\Producer\Producer\Model\Producer;
use yii\helpers\Html;

$pointSaleModule = $this->getPointSaleModule();


+ 1
- 1
backend/views/producer-admin/_form.php 查看文件

@@ -36,9 +36,9 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use domain\Producer\Producer\Producer;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\logic\Producer\Producer\Model\Producer;

?>


+ 1
- 1
backend/views/producer-admin/billing.php 查看文件

@@ -36,7 +36,7 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\logic\Producer\Producer\Module\ProducerModule;
use domain\Producer\Producer\ProducerModule;

$this->setTitle('Facturation producteur ('.$producer->name.')') ;
$this->addBreadcrumb(['label' => 'Producteurs', 'url' => ['index']]) ;

+ 4
- 4
backend/views/producer-admin/index.php 查看文件

@@ -36,11 +36,11 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use yii\helpers\Html;
use yii\grid\GridView;
use common\logic\User\User\Model\User;
use common\logic\Producer\Producer\Model\Producer;
use common\helpers\Price;
use domain\Producer\Producer\Producer;
use domain\User\User\User;
use yii\grid\GridView;
use yii\helpers\Html;

$producerModule = $this->getProducerModule();


+ 0
- 85
backend/views/producer-admin/online.php 查看文件

@@ -1,85 +0,0 @@
<?php

/**
* Copyright distrib (2018)
*
* contact@opendistrib.net
*
* Ce logiciel est un programme informatique servant à aider les producteurs
* à distribuer leur production en circuits courts.
*
* Ce logiciel est régi par la licence CeCILL soumise au droit français et
* respectant les principes de diffusion des logiciels libres. Vous pouvez
* utiliser, modifier et/ou redistribuer ce programme sous les conditions
* de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
* sur le site "http://www.cecill.info".
*
* En contrepartie de l'accessibilité au code source et des droits de copie,
* de modification et de redistribution accordés par cette licence, il n'est
* offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
* seule une responsabilité restreinte pèse sur l'auteur du programme, le
* titulaire des droits patrimoniaux et les concédants successifs.
*
* A cet égard l'attention de l'utilisateur est attirée sur les risques
* associés au chargement, à l'utilisation, à la modification et/ou au
* développement et à la reproduction du logiciel par l'utilisateur étant
* donné sa spécificité de logiciel libre, qui peut le rendre complexe à
* manipuler et qui le réserve donc à des développeurs et des professionnels
* avertis possédant des connaissances informatiques approfondies. Les
* utilisateurs sont donc invités à charger et tester l'adéquation du
* logiciel à leurs besoins dans des conditions permettant d'assurer la
* sécurité de leurs systèmes et ou de leurs données et, plus généralement,
* à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
*
* Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
* pris connaissance de la licence CeCILL, et que vous en avez accepté les
* termes.
*/

use common\helpers\Image;
use yii\helpers\Html;
use yii\grid\GridView;
use common\logic\User\User\Model\User;
use common\logic\Producer\Producer\Model\Producer;
use common\helpers\Price;

$producerModule = $this->getProducerModule();
$userModule = $this->getUserModule();
$this->setTitle('Producteurs en ligne');
$this->addBreadcrumb($this->getTitle());

?>
<div class="producer-admin-online">
<?php if($usersWithStatusProducerOnlineArray && count($usersWithStatusProducerOnlineArray) > 0): ?>
<?php foreach ($usersWithStatusProducerOnlineArray as $userWithStatusProducerOnline): ?>
<?php $producer = $userWithStatusProducerOnline->producer; ?>
<div class="col-md-3">
<div class="box box-primary">
<div class="box-body box-profile">
<?php if ($producer->logo && Image::isPhotoExist($producer->logo)): ?>
<img class="profile-user-img img-responsive img-circle"
src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>"
alt="Logo <?= Html::encode($producer->name) ?>">
<?php endif; ?>

<h3 class="profile-username text-center">
<?= $producer->name; ?>
</h3>
<p class="text-muted text-center">
<?= $userModule->getSolver()->getUsername($userWithStatusProducerOnline); ?><br/>
</p>
<!--<ul class="list-group list-group-unbordered">
<li class="list-group-item">
<b>Téléphone</b> <a class="pull-right">06 00 00 00 00</a>
</li>
</ul>
<a href="#" class="btn btn-primary btn-block"><b>Bouton</b></a>-->
</div>
</div>
</div>
<?php endforeach; ?>
<div class="clr"></div>
<?php else: ?>
<div class="alert alert-info">Aucun producteur en ligne actuellement.</div>
<?php endif; ?>
</div>

+ 29
- 10
backend/views/producer/update.php 查看文件

@@ -38,18 +38,18 @@

use common\helpers\Dropdown;
use common\helpers\GlobalParam;
use common\logic\Distribution\Distribution\Module\DistributionModule;
use common\logic\Distribution\Distribution\Service\ExportManager;
use common\logic\Feature\Feature\Feature;
use common\logic\Feature\Feature\FeatureModule;
use common\logic\User\User\Module\UserModule;
use common\logic\User\UserGroup\Module\UserGroupModule;
use domain\Config\TaxRate\TaxRate;
use domain\Distribution\Distribution\DistributionModule;
use domain\Distribution\Distribution\ExportManager;
use domain\Document\Document\Document;
use domain\Feature\Feature\Feature;
use domain\Feature\Feature\FeatureModule;
use domain\Producer\Producer\Producer;
use domain\User\User\UserModule;
use domain\User\UserGroup\UserGroupModule;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Config\TaxRate\Model\TaxRate;
use common\logic\Document\Document\Model\Document;
use yii\helpers\ArrayHelper;

\backend\assets\VuejsProducerUpdateAsset::register($this);

@@ -282,6 +282,12 @@ $this->addBreadcrumb($this->getTitle());
->dropDownList(Dropdown::noYesChoices()); ?>

<h4>Divers</h4>
<?= $form->field($model, 'option_leave_period_start')->textInput([
'class' => 'datepicker form-control'
]); ?>
<?= $form->field($model, 'option_leave_period_end')->textInput([
'class' => 'datepicker form-control'
]); ?>
<?php
$choicesWeeksDistributionsActivatedInAdvanceArray = [null => '--'];
for ($i = 1; $i < 13; $i++) {
@@ -416,8 +422,21 @@ $this->addBreadcrumb($this->getTitle());
<?= $form->field($model, 'tiller')
->dropDownList(Dropdown::noYesChoices())
->label('Synchroniser avec Tiller'); ?>
<?= $form->field($model, 'tiller_api_version')
->dropDownList([
'v2' => 'v2',
'v3' => 'v3'
]); ?>

<h4>API V2</h4>
<?= $form->field($model, 'tiller_provider_token'); ?>
<?= $form->field($model, 'tiller_restaurant_token'); ?>

<h4>API V3</h4>
<?= $form->field($model, 'tiller_store_id'); ?>
<?= $form->field($model, 'tiller_redirect_uri'); ?>
<?= $form->field($model, 'tiller_client_id'); ?>
<?= $form->field($model, 'tiller_client_secret'); ?>
</div>
</div>


+ 4
- 4
backend/views/product/_form.php 查看文件

@@ -1,13 +1,13 @@
<?php

use common\helpers\GlobalParam;
use common\helpers\Image;
use domain\PointSale\PointSale\PointSale;
use lo\widgets\Toggle;
use yii\helpers\Html;
use domain\Product\Product\Product;
use yii\bootstrap\ActiveForm;
use yii\helpers\ArrayHelper;
use common\helpers\GlobalParam;
use common\logic\Product\Product\Model\Product;
use common\logic\PointSale\PointSale\Model\PointSale;
use yii\helpers\Html;

$producerModule = $this->getProducerModule();
$productCategoryModule = $this->getProductCategoryModule();

+ 4
- 5
backend/views/product/index.php 查看文件

@@ -36,13 +36,12 @@
* termes.
*/

use common\helpers\Image;
use yii\helpers\Html;
use yii\grid\GridView;
use common\helpers\GlobalParam;
use \lo\widgets\Toggle;
use common\helpers\Image;
use common\helpers\Price;
use common\logic\Product\Product\Model\Product;
use lo\widgets\Toggle;
use yii\grid\GridView;
use yii\helpers\Html;

$productModule = $this->getProductModule();


+ 4
- 4
backend/views/product/update/prices/_form.php 查看文件

@@ -1,10 +1,10 @@
<?php

use common\logic\Config\Unit\Module\UnitModule;
use common\logic\Product\Product\Module\ProductModule;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use common\helpers\GlobalParam;
use domain\Config\Unit\UnitModule;
use domain\Product\Product\ProductModule;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;

$unitModule = UnitModule::getInstance();
$userModule = $this->getUserModule();

+ 3
- 3
backend/views/product/update/prices/list.php 查看文件

@@ -36,11 +36,11 @@
* termes.
*/

use common\logic\User\User\Module\UserModule;
use yii\helpers\Html;
use common\helpers\Price;
use domain\Product\Product\ProductModule;
use domain\User\User\UserModule;
use yii\grid\GridView;
use common\logic\Product\Product\Module\ProductModule;
use yii\helpers\Html;

$productModule = ProductModule::getInstance();
$userModule = UserModule::getInstance();

+ 2
- 2
backend/views/quotation/index.php 查看文件

@@ -36,9 +36,9 @@
* termes.
*/

use common\logic\Document\Quotation\Model\Quotation;
use domain\Document\Quotation\Quotation;
use domain\Order\Order\Order;
use yii\grid\GridView;
use common\logic\Order\Order\Model\Order;
use yii\helpers\Html;

$quotationModule = $this->getQuotationModule();

+ 1
- 1
backend/views/setting-admin/index.php 查看文件

@@ -36,7 +36,7 @@
* termes.
*/

use common\logic\Setting\SettingModule;
use domain\Setting\SettingModule;
use lo\widgets\Toggle;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;

+ 2
- 2
backend/views/subscription/_form.php 查看文件

@@ -36,10 +36,10 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use domain\Subscription\Subscription\Subscription;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper ;
use common\logic\Subscription\Subscription\Model\Subscription;

\backend\assets\VuejsSubscriptionFormAsset::register($this);


+ 7
- 7
backend/views/subscription/index.php 查看文件

@@ -36,15 +36,15 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\logic\Subscription\Subscription\Module\SubscriptionModule;
use yii\helpers\Html;
use common\helpers\GlobalParam;
use domain\PointSale\PointSale\PointSale;
use domain\Product\Product\Product;
use domain\Product\Product\ProductModule;
use domain\Subscription\Subscription\Subscription;
use domain\Subscription\Subscription\SubscriptionModule;
use yii\grid\GridView;
use common\helpers\GlobalParam ;
use common\logic\Subscription\Subscription\Model\Subscription;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\Product\Product\Module\ProductModule;
use yii\helpers\ArrayHelper;
use common\logic\Product\Product\Model\Product;
use yii\helpers\Html;

$subscriptionModule = SubscriptionModule::getInstance();


+ 2
- 4
backend/views/support/index.php 查看文件

@@ -36,11 +36,9 @@
* termes.
*/

use common\helpers\Image;
use common\logic\Ticket\Ticket\Model\Ticket;
use common\logic\Ticket\Ticket\Module\TicketModule;
use yii\helpers\Html;
use domain\Ticket\Ticket\TicketModule;
use yii\grid\GridView;
use yii\helpers\Html;

/**
* @var $this common\components\ViewBackend

+ 2
- 2
backend/views/support/view.php 查看文件

@@ -1,8 +1,8 @@
<?php

use common\helpers\GlobalParam;
use common\logic\Ticket\Ticket\Module\TicketModule;
use common\logic\User\User\Module\UserModule;
use domain\Ticket\Ticket\TicketModule;
use domain\User\User\UserModule;
use yii\helpers\Html;
use yii\widgets\ActiveForm;


+ 5
- 5
backend/views/user/_form.php 查看文件

@@ -36,14 +36,14 @@
* termes.
*/

use common\logic\Distribution\Distribution\Module\DistributionModule;
use common\logic\Distribution\Distribution\Service\ExportManager;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\User\User\Module\UserModule;
use domain\Distribution\Distribution\DistributionModule;
use domain\Distribution\Distribution\ExportManager;
use domain\Producer\Producer\ProducerModule;
use lo\widgets\Toggle;
use domain\User\User\UserModule;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;

\backend\assets\VuejsUserFormAsset::register($this);


+ 60
- 27
backend/views/user/_menu.php 查看文件

@@ -38,33 +38,66 @@ termes.

use yii\helpers\Html;

if($section == 'email') {
$route = 'communicate/email';
}
else {
$route = 'user/index';
}

?>

<div id="menu-users">
<div id="nav-points-sale">
<a class="btn <?php if(!$idPointSaleActive && !$sectionInactiveUsers && !$sectionSubscribers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/'.$section]); ?>">
<span class="glyphicon glyphicon-th-list"></span> Tous <span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
<?php if(isset($sectionSubscribers) && !is_null($sectionSubscribers)): ?>
<a class="btn <?php if($sectionSubscribers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/'.$section,'sectionSubscribers' => 1]); ?>">
<span class="glyphicon glyphicon-repeat"></span>
Abonnés
<span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
<?php endif; ?>
<?php if(isset($sectionInactiveUsers) && !is_null($sectionInactiveUsers)): ?>
<a class="btn <?php if($sectionInactiveUsers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/'.$section,'sectionInactiveUsers' => 1]); ?>">
<span class="glyphicon glyphicon-time"></span>
Inactifs
<span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
<?php endif; ?>
<?php foreach($pointsSaleArray as $pointSale): ?>
<a class="btn <?php if($idPointSaleActive == $pointSale->id): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/'.$section,'idPointSale' => $pointSale->id]); ?>">
<span class="glyphicon glyphicon-map-marker"></span>
<?= Html::encode($pointSale->name) ?>
<span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
<?php endforeach; ?>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Filtre</h3>
</div>
<div class="panel-body">
<div id="menu-users">
<div id="nav-points-sale">
<h4>Général</h4>
<div>
<a class="btn btn-xs <?php if(!$idPointSaleActive && !$idDistributionActive && !$sectionInactiveUsers && !$sectionSubscribers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl([$route]); ?>">
<span class="glyphicon glyphicon-th-list"></span> Tous
</a>
<?php if(isset($sectionSubscribers) && !is_null($sectionSubscribers)): ?>
<a class="btn btn-xs <?php if($sectionSubscribers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl([$route,'sectionSubscribers' => 1]); ?>">
<span class="glyphicon glyphicon-repeat"></span>
Abonnés
</a>
<?php endif; ?>
<?php if(isset($sectionInactiveUsers) && !is_null($sectionInactiveUsers)): ?>
<a class="btn btn-xs <?php if($sectionInactiveUsers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl([$route,'sectionInactiveUsers' => 1]); ?>">
<span class="glyphicon glyphicon-time"></span>
Inactifs
</a>
<?php endif; ?>
</div>

<?php if(count($pointsSaleArray) > 0): ?>
<h4>Points de vente</h4>
<div>
<?php foreach($pointsSaleArray as $pointSale): ?>
<a class="btn btn-xs <?php if($idPointSaleActive == $pointSale->id): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl([$route,'idPointSale' => $pointSale->id]); ?>">
<span class="glyphicon glyphicon-map-marker"></span>
<?= Html::encode($pointSale->name) ?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>

<?php if($section == 'email' && count($incomingDistributionsArray) > 0): ?>
<h4>Distributions</h4>
<div>
<?php foreach($incomingDistributionsArray as $distribution): ?>
<a class="btn btn-xs <?php if($idDistributionActive == $distribution->id): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl([$route,'idDistribution' => $distribution->id]); ?>">
<span class="glyphicon glyphicon-calendar"></span>
<?= Html::encode($incomingDistributionsDatesArray[$distribution->id]) ?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>

+ 20
- 4
backend/views/user/credit.php 查看文件

@@ -36,12 +36,12 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\helpers\GlobalParam;
use common\helpers\MeanPayment;
use domain\Payment\Payment;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\helpers\GlobalParam;
use common\logic\Payment\Model\Payment;
use common\helpers\MeanPayment;

$paymentManager = $this->getPaymentModule();
$producerModule = $this->getProducerModule();
@@ -102,6 +102,9 @@ $this->addBreadcrumb('Créditer') ;
MeanPayment::OTHER => MeanPayment::getStrBy(MeanPayment::OTHER),
]) ?>
<?= $form->field($creditForm, 'comment')->textarea() ?>
<?= $form->field($creditForm, 'date_transaction')->textInput([
'class' => 'datepicker form-control'
]) ?>
<?= $form->field($creditForm, 'send_mail')->checkbox() ?>

<div class="form-group">
@@ -167,7 +170,20 @@ $this->addBreadcrumb('Créditer') ;
'label' => 'Commentaire',
'format' => 'raw',
'value' => function ($model) {
return nl2br($model->comment);
if($model->comment) {
return nl2br($model->comment);
}
return '';
}
],
[
'label' => 'Transaction',
'format' => 'raw',
'value' => function ($model) {
if($model->date_transaction) {
return date('d/m/Y', strtotime($model->date_transaction));
}
return '';
}
],
],

+ 7
- 6
backend/views/user/index.php 查看文件

@@ -37,13 +37,13 @@
*/

use common\helpers\GlobalParam;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\User\UserGroup\Module\UserGroupModule;
use yii\helpers\Html;
use domain\Order\Order\Order;
use domain\Producer\Producer\ProducerModule;
use domain\User\User\UserModule;
use domain\User\UserProducer\UserProducer;
use yii\grid\GridView;
use common\logic\User\User\Module\UserModule;
use common\logic\Order\Order\Model\Order;
use common\logic\User\UserProducer\Model\UserProducer;
use yii\helpers\Html;
use domain\User\UserGroup\UserGroupModule;

$userModule = UserModule::getInstance();
$producerModule = ProducerModule::getInstance();
@@ -60,6 +60,7 @@ $this->addButton(['label' => 'Nouvel utilisateur <span class="glyphicon glyphico

$this->render('_menu', [
'idPointSaleActive' => $idPointSaleActive,
'idDistributionActive' => 0,
'sectionInactiveUsers' => $sectionInactiveUsers,
'sectionSubscribers' => $sectionSubscribers,
'pointsSaleArray' => $pointsSaleArray,

+ 37
- 11
backend/web/css/screen.css 查看文件

@@ -2827,37 +2827,51 @@ termes.
.document-form .info-box .info-box-text {
font-size: 13px;
}
/* line 7, ../sass/document/_form.scss */
/* line 8, ../sass/document/_form.scss */
.document-form .info-box .info-box-number {
font-size: 15px;
}
/* line 12, ../sass/document/_form.scss */
/* line 14, ../sass/document/_form.scss */
.document-form #block-add-product .input-price {
text-align: center;
}
/* line 16, ../sass/document/_form.scss */
/* line 19, ../sass/document/_form.scss */
.document-form #block-add-product .input-group-quantity .input-quantity {
text-align: center;
}
/* line 22, ../sass/document/_form.scss */
/* line 25, ../sass/document/_form.scss */
.document-form #block-add-product .total .input-group {
margin-bottom: 10px;
}
/* line 25, ../sass/document/_form.scss */
/* line 29, ../sass/document/_form.scss */
.document-form #block-add-product .total .btn {
float: right;
}
/* line 32, ../sass/document/_form.scss */
/* line 36, ../sass/document/_form.scss */
.document-form #block-list-products ul.product-order-meta {
padding: 0px;
margin: 0px;
padding-left: 20px;
}
/* line 37, ../sass/document/_form.scss */
/* line 41, ../sass/document/_form.scss */
.document-form #block-list-products ul.product-order-meta li {
color: gray;
font-size: 11px;
}
/* line 51, ../sass/document/_form.scss */
.document-form #block-list-products .product-order-invoice-price-button-apply {
display: none;
}
/* line 54, ../sass/document/_form.scss */
.document-form #block-list-products .product-order-invoice-price-button-apply .btn {
display: block;
width: 100%;
}
/* line 60, ../sass/document/_form.scss */
.document-form #block-list-products .different-price {
position: relative;
top: 5px;
}

/* line 7, ../sass/document/_index.scss */
.quotation-index .content-wrapper .content table.table .column-actions,
@@ -2966,16 +2980,28 @@ termes.
margin-top: 5px;
}

/* line 3, ../sass/producer-admin/_online.scss */
.producer-admin-online .box {
/* line 3, ../sass/online-admin/_index.scss */
.online-index .box {
overflow: hidden;
}
/* line 6, ../sass/online-admin/_index.scss */
.online-index .box.box-user {
height: 150px;
}
/* line 10, ../sass/online-admin/_index.scss */
.online-index .box.box-producer {
height: 250px;
}
/* line 6, ../sass/producer-admin/_online.scss */
.producer-admin-online .box .profile-username {
/* line 14, ../sass/online-admin/_index.scss */
.online-index .box .profile-username {
font-family: 'Source Sans Pro',sans-serif;
font-weight: normal;
font-size: 18px;
}
/* line 19, ../sass/online-admin/_index.scss */
.online-index .box .profile-username a {
color: #333;
}

/* line 4, ../sass/feature-admin/_index.scss */
.feature-admin-index table th.only-for-selected-producers,

+ 22
- 2
backend/web/js/vuejs/distribution-index.js 查看文件

@@ -46,7 +46,7 @@ var app = new Vue({
dateFormat: null,
loading: true,
distribution: {
active: false,
active: false
},
producer: null,
oneDistributionWeekActive: false,
@@ -75,6 +75,8 @@ var app = new Vue({
showModalPayment: false,
idOrderPayment: 0,
showLoading: false,
tillerIsAuthenticated: false,
tillerUrlAuthorizeCode: '#',
tillerIsSynchro: false,
checkboxSelectAllOrders: false,
messageGenerateDeliveryNoteDisplayed: false,
@@ -206,10 +208,13 @@ var app = new Vue({
app.deliveryNotes = response.data.delivery_notes;
}

app.tillerUrlAuthorizeCode = response.data.tiller_url_authorize_code;
app.tillerIsAuthenticated = response.data.tiller_is_authenticated;
app.tillerIsSynchro = response.data.tiller_is_synchro;

app.calendar.attrs = [];
var distributions = response.data.distributions;
var leave_period_dates = response.data.leave_period_dates;
var dayCurrentIsDistributionActive = false;
var dateFormatCompare = false;
if (app.date) {
@@ -244,6 +249,18 @@ var app = new Vue({
}
}

// leave period
if (leave_period_dates.length) {
app.calendar.attrs.push({
key: 'leave_period',
dates: leave_period_dates,
highlight: {
color: 'blue',
fillMode: 'solid'
}
});
}

app.showLoading = false;
app.checkboxSelectAllOrders = false;

@@ -260,7 +277,7 @@ var app = new Vue({
setTimeout("opendistrib_popover(); opendistrib_dropdown_tooltip();", 500);

var highlightStyle = {
color: 'orange',
color: 'black',
fillMode: 'light'
}
if (dayCurrentIsDistributionActive) {
@@ -631,6 +648,9 @@ var app = new Vue({
.then(function (response) {
app.init(app.idActivePointSale);
});
},
authTiller: function() {

},
totalActivePointSale: function () {
var total = 0;

+ 27
- 1
backend/web/js/vuejs/document-form.js 查看文件

@@ -122,7 +122,7 @@ var app = new Vue({
var price = 0;
if (documentClass == 'DeliveryNote' || documentClass == 'Invoice') {
price = productOrder.invoice_price;
if (!price) {
if (isNaN(price) || price === null) {
price = productOrder.price;
}
} else {
@@ -327,6 +327,32 @@ var app = new Vue({
if (isNaN(this.productAddQuantity)) {
this.productAddQuantity = 1;
}
},
showProductOrderInvoicePriceButtonApply: function(event) {
if(event.key == 'Enter') {
this.updateProductOrderInvoicePrice(event);
}
else {
var idProductOrder = event.currentTarget.getAttribute('data-id-product-order');
$('#product-order-invoice-price-button-apply-'+idProductOrder).show();
}
},
updateProductOrderInvoicePrice: function (event) {
var idProductOrder = event.currentTarget.getAttribute('data-id-product-order');
var invoicePrice = $('#input-product-order-invoice-price-'+idProductOrder).val();

axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-update-product-order-invoice-price", {
params: {
idProductOrder: idProductOrder,
invoicePrice: invoicePrice
}
})
.then(function (response) {
appAlerts.alertResponse(response);
$('#input-product-order-invoice-price-'+idProductOrder).val(response.data.datas.invoice_price);
$('#product-order-invoice-price-button-apply-'+idProductOrder).hide();
app.init();
});
}
}
});

+ 1
- 1
backend/web/js/vuejs/producer-update.js 查看文件

@@ -84,7 +84,7 @@ var app = new Vue({
{
name: 'logiciels-caisse',
nameDisplay: 'Logiciels de caisse',
isAdminSection: 0
isAdminSection: 1
},
{
name: 'software',

+ 62
- 40
backend/web/sass/document/_form.scss 查看文件

@@ -1,43 +1,65 @@

.document-form {
.info-box {
.info-box-text {
font-size: 13px ;
}
.info-box-number {
font-size: 15px ;
}
}
#block-add-product {
.input-price {
text-align: center ;
}
.input-group-quantity {
.input-quantity {
text-align: center ;
}
}

.total {
.input-group {
margin-bottom: 10px ;
}
.btn {
float: right ;
}
}
}

#block-list-products {
ul.product-order-meta {
padding: 0px ;
margin: 0px ;
padding-left: 20px ;

li {
color: gray ;
font-size: 11px ;
}
}
}
.info-box {
.info-box-text {
font-size: 13px;
}

.info-box-number {
font-size: 15px;
}
}

#block-add-product {
.input-price {
text-align: center;
}

.input-group-quantity {
.input-quantity {
text-align: center;
}
}

.total {
.input-group {
margin-bottom: 10px;
}

.btn {
float: right;
}
}
}

#block-list-products {
ul.product-order-meta {
padding: 0px;
margin: 0px;
padding-left: 20px;

li {
color: gray;
font-size: 11px;
}
}

.input-group-edit-invoice-price {

}

.product-order-invoice-price-button-apply {
display: none;

.btn {
display: block;
width: 100%;
}
}

.different-price {
position: relative;
top: 5px;
}
}
}

+ 24
- 0
backend/web/sass/online-admin/_index.scss 查看文件

@@ -0,0 +1,24 @@

.online-index {
.box {
overflow: hidden;

&.box-user {
height: 150px;
}

&.box-producer {
height: 250px;
}

.profile-username {
font-family: 'Source Sans Pro',sans-serif;
font-weight: normal;
font-size: 18px;

a {
color: #333;
}
}
}
}

+ 0
- 12
backend/web/sass/producer-admin/_online.scss 查看文件

@@ -1,12 +0,0 @@

.producer-admin-online {
.box {
height: 250px;

.profile-username {
font-family: 'Source Sans Pro',sans-serif;
font-weight: normal;
font-size: 18px;
}
}
}

+ 1
- 1
backend/web/sass/screen.scss 查看文件

@@ -1530,7 +1530,7 @@ a.btn, button.btn {
@import "support/_index.scss";
@import "support/_view.scss";
@import "producer-admin/_index.scss";
@import "producer-admin/_online.scss";
@import "online-admin/_index.scss";
@import "feature-admin/_index.scss";
@import "setting/_form.scss";
@import "_responsive.scss" ;

+ 1
- 1
common/components/AlwaysdataClient.php 查看文件

@@ -3,8 +3,8 @@
namespace common\components;

use common\helpers\Password;
use common\logic\Producer\Producer\Model\Producer;
use GuzzleHttp\Client;
use domain\Producer\Producer\Producer;
use yii\base\ErrorException;

class AlwaysdataClient

+ 1
- 2
common/components/BusinessLogic.php 查看文件

@@ -2,8 +2,7 @@

namespace common\components;

use common\logic\Producer\Producer\Model\Producer;
use common\logic\ProducerContextTrait;
use domain\Producer\Producer\Producer;
use yii\base\ErrorException;

class BusinessLogic

+ 33
- 33
common/components/BusinessLogicTrait.php 查看文件

@@ -2,39 +2,39 @@

namespace common\components;

use common\logic\Config\TaxRate\Module\TaxRateModule;
use common\logic\Config\Unit\Module\UnitModule;
use common\logic\Distribution\Distribution\Module\DistributionModule;
use common\logic\Distribution\PointSaleDistribution\Module\PointSaleDistributionModule;
use common\logic\Distribution\ProductDistribution\Module\ProductDistributionModule;
use common\logic\Document\DeliveryNote\Module\DeliveryNoteModule;
use common\logic\Document\Document\Module\DocumentModule;
use common\logic\Document\Invoice\Module\InvoiceModule;
use common\logic\Document\Quotation\Module\QuotationModule;
use common\logic\Feature\Feature\FeatureModule;
use common\logic\Feature\FeatureProducer\FeatureProducerModule;
use common\logic\Opinion\Module\OpinionModule;
use common\logic\Order\Order\Module\OrderModule;
use common\logic\Order\ProductOrder\Module\ProductOrderModule;
use common\logic\Payment\Module\PaymentModule;
use common\logic\PointSale\PointSale\Module\PointSaleModule;
use common\logic\PointSale\UserPointSale\Module\UserPointSaleModule;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\Producer\ProducerPriceRange\Module\ProducerPriceRangeModule;
use common\logic\Product\Product\Module\ProductModule;
use common\logic\Product\ProductCategory\Module\ProductCategoryModule;
use common\logic\Product\ProductPointSale\Module\ProductPointSaleModule;
use common\logic\Product\ProductPrice\Module\ProductPriceModule;
use common\logic\Setting\SettingModule;
use common\logic\Subscription\ProductSubscription\Module\ProductSubscriptionModule;
use common\logic\Subscription\Subscription\Module\SubscriptionModule;
use common\logic\Ticket\Ticket\Module\TicketModule;
use common\logic\Ticket\TicketMessage\Module\TicketMessageModule;
use common\logic\Ticket\TicketUser\Module\TicketUserModule;
use common\logic\User\User\Module\UserModule;
use common\logic\User\UserGroup\Module\UserGroupModule;
use common\logic\User\UserProducer\Module\UserProducerModule;
use common\logic\User\UserUserGroup\Module\UserUserGroupModule;
use domain\Config\TaxRate\TaxRateModule;
use domain\Config\Unit\UnitModule;
use domain\Distribution\Distribution\DistributionModule;
use domain\Distribution\PointSaleDistribution\PointSaleDistributionModule;
use domain\Distribution\ProductDistribution\ProductDistributionModule;
use domain\Document\DeliveryNote\DeliveryNoteModule;
use domain\Document\Document\DocumentModule;
use domain\Document\Invoice\InvoiceModule;
use domain\Document\Quotation\QuotationModule;
use domain\Feature\Feature\FeatureModule;
use domain\Feature\FeatureProducer\FeatureProducerModule;
use domain\Opinion\OpinionModule;
use domain\Order\Order\OrderModule;
use domain\Order\ProductOrder\ProductOrderModule;
use domain\Payment\PaymentModule;
use domain\PointSale\PointSale\PointSaleModule;
use domain\PointSale\UserPointSale\UserPointSaleModule;
use domain\Producer\Producer\ProducerModule;
use domain\Producer\ProducerPriceRange\ProducerPriceRangeModule;
use domain\Product\Product\ProductModule;
use domain\Product\ProductCategory\ProductCategoryModule;
use domain\Product\ProductPointSale\ProductPointSaleModule;
use domain\Product\ProductPrice\Module\ProductPriceModule;
use domain\Setting\SettingModule;
use domain\Subscription\ProductSubscription\ProductSubscriptionModule;
use domain\Subscription\Subscription\SubscriptionModule;
use domain\Ticket\Ticket\TicketModule;
use domain\Ticket\TicketMessage\TicketMessageModule;
use domain\Ticket\TicketUser\TicketUserModule;
use domain\User\User\UserModule;
use domain\User\UserGroup\UserGroupModule;
use domain\User\UserProducer\UserProducerModule;
use domain\User\UserUserGroup\UserUserGroupModule;

trait BusinessLogicTrait
{

+ 1
- 1
common/components/MailerService.php 查看文件

@@ -2,7 +2,7 @@

namespace common\components;

use common\logic\Producer\Producer\Model\Producer;
use domain\Producer\Producer\Producer;
use yii\mail\MessageInterface;

class MailerService

+ 10
- 0
common/components/Tiller/TillerClientInterface.php 查看文件

@@ -0,0 +1,10 @@
<?php

namespace common\components\Tiller;

interface TillerClientInterface
{
public function isAuthenticated(): bool;
public function getOrders($date);
public function postOrder($params);
}

common/components/TillerClient.php → common/components/Tiller/TillerClientV2.php 查看文件

@@ -36,11 +36,11 @@
* termes.
*/

namespace common\components;
namespace common\components\Tiller;

use linslin\yii2\curl;

class TillerClient
class TillerClientV2 implements TillerClientInterface
{
var $curl;
var $providerToken;
@@ -54,6 +54,16 @@ class TillerClient
$this->restaurantToken = $restaurantToken;
}

public function getUrlAuthorizeCode(string $clientId = null, string $redirectUri = null): string
{
return "#";
}

public function isAuthenticated(): bool
{
return true;
}

public function getOrders($date)
{
$orders = $this->curl->setGetParams([

+ 110
- 0
common/components/Tiller/TillerClientV3.php 查看文件

@@ -0,0 +1,110 @@
<?php

/**
* Copyright distrib (2018)
*
* contact@opendistrib.net
*
* Ce logiciel est un programme informatique servant à aider les producteurs
* à distribuer leur production en circuits courts.
*
* Ce logiciel est régi par la licence CeCILL soumise au droit français et
* respectant les principes de diffusion des logiciels libres. Vous pouvez
* utiliser, modifier et/ou redistribuer ce programme sous les conditions
* de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
* sur le site "http://www.cecill.info".
*
* En contrepartie de l'accessibilité au code source et des droits de copie,
* de modification et de redistribution accordés par cette licence, il n'est
* offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
* seule une responsabilité restreinte pèse sur l'auteur du programme, le
* titulaire des droits patrimoniaux et les concédants successifs.
*
* A cet égard l'attention de l'utilisateur est attirée sur les risques
* associés au chargement, à l'utilisation, à la modification et/ou au
* développement et à la reproduction du logiciel par l'utilisateur étant
* donné sa spécificité de logiciel libre, qui peut le rendre complexe à
* manipuler et qui le réserve donc à des développeurs et des professionnels
* avertis possédant des connaissances informatiques approfondies. Les
* utilisateurs sont donc invités à charger et tester l'adéquation du
* logiciel à leurs besoins dans des conditions permettant d'assurer la
* sécurité de leurs systèmes et ou de leurs données et, plus généralement,
* à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
*
* Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
* pris connaissance de la licence CeCILL, et que vous en avez accepté les
* termes.
*/

namespace common\components\Tiller;

use common\components\Tiller\TillerClientInterface;
use GuzzleHttp\Exception\RequestException;
use linslin\yii2\curl;

class TillerClientV3 implements TillerClientInterface
{
var $client;
var $storeId;
var $headers = [];
var $urlApi = 'https://api.tiller.systems/';

public function __construct(string $storeId = null, string $accessToken = null)
{
$this->client = new \GuzzleHttp\Client();
$this->storeId = (int) $storeId;
$this->headers = [
'authorization' => 'Bearer '.$accessToken,
'accept' => 'application/json',
'content-type' => 'application/json',
];
}

public function getUrlAuthorizeCode(string $clientId = null, string $redirectUri = null): string
{
if($clientId && $redirectUri) {
return "https://oauth.api.tiller.systems/oauth2/authorize?client_id=$clientId&response_type=code&scope=&redirect_uri=$redirectUri";
}

return '#';
}

public function isAuthenticated(): bool
{
return $this->getOrders(date('Y-m-d')) !== false;
}

public function getOrders($date)
{
try {
$response = $this->client->request('POST', $this->urlApi.'orders/v3/orders/search', [
'body' => json_encode([
'storeIds' => [$this->storeId],
'openDate' => [
'from' => date('Y-m-d H:i:s', strtotime($date)),
'to' => date('Y-m-d H:i:s', strtotime($date) + 24 * 60 * 60 - 1)
]
]),
'headers' => $this->headers
]);

return $response->getBody()->getContents();
}
catch (RequestException $exception) {
return false;
}
}

public function postOrder($params)
{
$response = $this->client->request('POST', $this->urlApi.'purchase-requests/v1/requests', [
'query' => [
'storeId' => $this->storeId
],
'body' => json_encode($params),
'headers' => $this->headers
]);

return $response->getBody()->getContents();
}
}

+ 7
- 1
common/components/View.php 查看文件

@@ -38,7 +38,7 @@ termes.

namespace common\components ;

use common\logic\User\User\Model\User;
use domain\User\User\User;

class View extends \yii\web\View
{
@@ -48,6 +48,7 @@ class View extends \yii\web\View
var $icon;
var $page_title ;
var $buttons ;
var $metaRefresh = false;

public function getLogic()
{
@@ -113,6 +114,11 @@ class View extends \yii\web\View
]);
}

public function setMetaRefresh(bool $active)
{
$this->metaRefresh = $active;
}

public function getUrlManagerFrontend()
{
return \Yii::$app->urlManagerFrontend;

+ 15
- 15
common/config/main.php 查看文件

@@ -39,14 +39,14 @@
use common\components\BusinessLogic;
use common\components\DolibarrApi;
use common\components\ForumFlarumClient;
use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Document\DeliveryNote\Model\DeliveryNote;
use common\logic\Order\Order\Model\Order;
use common\logic\Ticket\Ticket\Model\Ticket;
use common\logic\Payment\Model\Payment;
use common\logic\User\User\Model\User;
use domain\Distribution\Distribution\Distribution;
use domain\Document\DeliveryNote\DeliveryNote;
use domain\Order\Order\Order;
use domain\Payment\Payment;
use domain\Ticket\Ticket\Ticket;
use domain\User\User\User;

$serverName = isset($_SERVER['SERVER_NAME']) ?? '';
$serverName = isset($_SERVER['SERVER_NAME']) ?? '' ;

return [
'bootstrap' => ['listener'],
@@ -99,7 +99,7 @@ return [
],
'user' => [
'class' => 'yii\web\User',
'identityClass' => 'common\logic\User\User\Model\User',
'identityClass' => 'domain\User\User\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => 'distrib',
@@ -187,29 +187,29 @@ return [
'observers' => [
User::class => [
// Producer : lien avec utilisateur
common\logic\Producer\Producer\Event\UserObserver::class
domain\Producer\Producer\Event\UserObserver::class
],
Order::class => [
// Payment : remboursement commande
common\logic\Payment\Event\OrderObserver::class
domain\Payment\Event\OrderObserver::class
],
Payment::class => [
// UserProducer : mise à jour du crédit
common\logic\User\UserProducer\Event\PaymentObserver::class
domain\User\UserProducer\Event\PaymentObserver::class
],
Distribution::class => [
// Subscription : génération des commandes sur base des abonnements
common\logic\Subscription\Subscription\Event\DistributionObserver::class
domain\Subscription\Subscription\Event\DistributionObserver::class
],
DeliveryNote::class => [
// Order : assignation du bon de livraison aux commandes
common\logic\Order\Order\Event\DeliveryNoteObserver::class,
domain\Order\Order\Event\DeliveryNoteObserver::class,
// DeliveryNote : validation automatique des bons de livraison
common\logic\Document\DeliveryNote\Event\DeliveryNoteObserver::class
domain\Document\DeliveryNote\Event\DeliveryNoteObserver::class
],
Ticket::class => [
// User : envoi email nouveau ticket à l'administrateur
common\logic\User\User\Event\TicketObserver::class,
domain\User\User\Event\TicketObserver::class,
],
],
],

+ 1
- 1
common/config/params.php 查看文件

@@ -37,7 +37,7 @@
*/

return [
'version' => '24.2.A',
'version' => '24.2.B',
'maintenanceMode' => false,
'siteName' => 'Opendistrib',
'adminEmail' => 'contact@opendistrib.net',

+ 1
- 1
common/controllers/CommonController.php 查看文件

@@ -41,7 +41,7 @@ namespace common\controllers;
use common\components\BusinessLogic;
use common\components\BusinessLogicTrait;
use common\components\ParameterBag;
use common\logic\User\User\Model\User;
use domain\User\User\User;
use yii;
use yii\web\Response;


+ 1
- 1
common/forms/ContactForm.php 查看文件

@@ -38,7 +38,7 @@ termes.

namespace common\forms;

use common\logic\Producer\Producer\Model\Producer;
use domain\Producer\Producer\Producer;
use Yii;
use yii\base\Model;


+ 2
- 2
common/forms/LoginForm.php 查看文件

@@ -38,8 +38,8 @@ termes.

namespace common\forms;

use common\logic\Producer\Producer\Model\Producer;
use common\logic\User\User\Model\User;
use domain\Producer\Producer\Producer;
use domain\User\User\User;
use Yii;
use yii\base\Model;


+ 6
- 7
common/forms/SubscriptionForm.php 查看文件

@@ -38,13 +38,12 @@ termes.

namespace common\forms;

use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Module\ProductModule;
use common\logic\Subscription\ProductSubscription\Model\ProductSubscription;
use common\logic\Subscription\Subscription\Model\Subscription;
use common\logic\Subscription\Subscription\Module\SubscriptionModule;
use common\logic\User\User\Module\UserModule;
use Yii;
use domain\Product\Product\Product;
use domain\Product\Product\ProductModule;
use domain\Subscription\ProductSubscription\ProductSubscription;
use domain\Subscription\Subscription\Subscription;
use domain\Subscription\Subscription\SubscriptionModule;
use domain\User\User\UserModule;
use yii\base\Model;

class SubscriptionForm extends Model

+ 7
- 6
common/helpers/Ajax.php 查看文件

@@ -7,17 +7,17 @@ class Ajax
const RESPONSE_TYPE_ERROR = 'error';
const RESPONSE_TYPE_SUCCESS = 'success';

public static function responseSuccess(string $message): array
public static function responseSuccess(string $message, array $datas = []): array
{
return self::response(self::RESPONSE_TYPE_SUCCESS, $message);
return self::response(self::RESPONSE_TYPE_SUCCESS, $message, $datas);
}

public static function responseError(string $message): array
public static function responseError(string $message, array $datas = []): array
{
return self::response(self::RESPONSE_TYPE_ERROR, $message);
return self::response(self::RESPONSE_TYPE_ERROR, $message, $datas);
}

private static function response(string $responseType, string $message): array
private static function response(string $responseType, string $message, array $datas = []): array
{
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

@@ -26,7 +26,8 @@ class Ajax
'alert' => [
'type' => self::getAlertClass($responseType),
'message' => $message
]
],
'datas' => $datas
];
}


+ 1
- 1
common/helpers/CSV.php 查看文件

@@ -38,7 +38,7 @@

namespace common\helpers;

use common\logic\Producer\Producer\Module\ProducerModule;
use domain\Producer\Producer\ProducerModule;

class CSV
{

+ 2
- 3
common/helpers/GlobalParam.php 查看文件

@@ -38,9 +38,8 @@

namespace common\helpers;

use common\logic\Producer\Producer\Model\Producer;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\User\User\Service\UserSolver;
use domain\Producer\Producer\ProducerModule;
use domain\User\User\UserSolver;

class GlobalParam
{

+ 1
- 1
common/helpers/Price.php 查看文件

@@ -38,7 +38,7 @@

namespace common\helpers;

use common\logic\Document\Document\Model\Document;
use domain\Document\Document\Document;

class Price
{

+ 0
- 11
common/logic/Distribution/Distribution/Event/DistributionActiveEvent.php 查看文件

@@ -1,11 +0,0 @@
<?php

namespace common\logic\Distribution\Distribution\Event;

use common\logic\Distribution\Distribution\Model\Distribution;
use yii\base\Event;

class DistributionActiveEvent extends Event
{
public Distribution $distribution;
}

+ 0
- 14
common/logic/Distribution/PointSaleDistribution/Service/PointSaleDistributionDefinition.php 查看文件

@@ -1,14 +0,0 @@
<?php

namespace common\logic\Distribution\PointSaleDistribution\Service;

use common\logic\AbstractDefinition;
use common\logic\Distribution\PointSaleDistribution\Model\PointSaleDistribution;

class PointSaleDistributionDefinition extends AbstractDefinition
{
public function getEntityFqcn(): string
{
return PointSaleDistribution::class;
}
}

+ 0
- 14
common/logic/Distribution/ProductDistribution/Service/ProductDistributionDefinition.php 查看文件

@@ -1,14 +0,0 @@
<?php

namespace common\logic\Distribution\ProductDistribution\Service;

use common\logic\AbstractDefinition;
use common\logic\Distribution\ProductDistribution\Model\ProductDistribution;

class ProductDistributionDefinition extends AbstractDefinition
{
public function getEntityFqcn(): string
{
return ProductDistribution::class;
}
}

+ 0
- 8
common/logic/Document/Document/Model/DocumentInterface.php 查看文件

@@ -1,8 +0,0 @@
<?php

namespace common\logic\Document\Document\Model;

interface DocumentInterface
{

}

部分文件因文件數量過多而無法顯示

Loading…
取消
儲存