Explorar el Código

Merge branch 'develop'

master
Guillaume Bourgeois hace 8 meses
padre
commit
4a11f1f3f5
Se han modificado 28 ficheros con 356 adiciones y 103 borrados
  1. +10
    -5
      backend/controllers/DistributionController.php
  2. +1
    -1
      backend/controllers/TillerController.php
  3. +9
    -0
      backend/controllers/UserController.php
  4. +2
    -3
      backend/views/communicate/email.php
  5. +1
    -1
      backend/views/distribution/index.php
  6. +1
    -1
      backend/views/point-sale/index.php
  7. +1
    -1
      backend/views/subscription/index.php
  8. +25
    -0
      backend/views/user/_form.php
  9. +33
    -0
      backend/views/user/view.php
  10. +59
    -44
      backend/web/css/screen.css
  11. +10
    -0
      backend/web/js/backend.js
  12. +11
    -0
      backend/web/sass/_responsive.scss
  13. +4
    -0
      backend/web/sass/distribution/_index.scss
  14. +10
    -7
      common/components/Tiller/TillerClientV3.php
  15. +1
    -1
      common/config/params.php
  16. +26
    -0
      common/versions/24.3.A.php
  17. +26
    -0
      console/migrations/m240314_093700_add_column_user_email_invoicing.php
  18. +28
    -0
      console/migrations/m240320_092736_add_columns_user_trust_alert.php
  19. +4
    -1
      domain/Document/Document/DocumentManager.php
  20. +25
    -8
      domain/Order/Order/TillerManager.php
  21. +14
    -0
      domain/PointSale/PointSale/PointSaleSolver.php
  22. +9
    -4
      domain/User/User/User.php
  23. +12
    -0
      domain/User/User/UserSolver.php
  24. +5
    -2
      domain/User/UserProducer/UserProducer.php
  25. +3
    -1
      producer/views/order/confirm.php
  26. +4
    -2
      producer/views/site/index.php
  27. +21
    -20
      producer/views/subscription/_form.php
  28. +1
    -1
      producer/web/js/vuejs/subscription-form.js

+ 10
- 5
backend/controllers/DistributionController.php Ver fichero

@@ -316,6 +316,7 @@ class DistributionController extends BackendController
$orderModule = $this->getOrderModule();
$paymentManager = $this->getPaymentModule();
$productOrderModule = $this->getProductOrderModule();
$userProducerModule = $this->getUserProducerModule();

if ($ordersArray) {
foreach ($ordersArray as &$order) {
@@ -360,10 +361,14 @@ class DistributionController extends BackendController
];
}

$arrayCreditUser = [];
if(isset($order->user)) {
$arrayCreditUser['credit'] = $userModule->getCredit($order->user);
$arrayCreditUser['credit_active'] = $userModule->getCreditActive($order->user);
$arrayDatasUser = [];
if(isset($order->user) && $order->user) {
$arrayDatasUser['credit'] = $userModule->getCredit($order->user);
$arrayDatasUser['credit_active'] = $userModule->getCreditActive($order->user);

$userProducer = $userProducerModule->getRepository()->findOneUserProducer($order->user);
$arrayDatasUser['trust_alert'] = $userProducer->trust_alert;
$arrayDatasUser['trust_alert_comment'] = $userProducer->trust_alert_comment;
}

$oneProductUnactivated = false;
@@ -384,7 +389,7 @@ class DistributionController extends BackendController
'amount_surplus' => Price::numberTwoDecimals($orderModule->getOrderAmount($order, Order::AMOUNT_SURPLUS)),
'user' => (isset($order->user)) ? array_merge(
$order->user->getAttributes(),
$arrayCreditUser
$arrayDatasUser
) : null,
'pointSale' => $order->pointSale ? ['id' => $order->pointSale->id, 'name' => $order->pointSale->name] : null,
'productOrder' => $productOrderArray,

+ 1
- 1
backend/controllers/TillerController.php Ver fichero

@@ -86,6 +86,6 @@ class TillerController extends BackendController
$producer->tiller_refresh_token = $refreshToken;
$producer->save();

return $this->redirectDashboard();
return $this->redirect(['distribution/index']);
}
}

+ 9
- 0
backend/controllers/UserController.php Ver fichero

@@ -207,6 +207,9 @@ class UserController extends BackendController
$userBelongToProducer = UserProducer::findOne(['id_user' => $id, 'id_producer' => GlobalParam::getCurrentProducerId()]);
if ($userBelongToProducer) {
$model->newsletter = $userBelongToProducer->newsletter;
$model->trust_alert = $userBelongToProducer->trust_alert;
$model->trust_alert_comment = $userBelongToProducer->trust_alert_comment;

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

// on envoie le mail de bienvenue si le mail vient d'être défini
@@ -220,12 +223,18 @@ class UserController extends BackendController
$this->processLinkUserGroup($model);
//$this->processProductPricePercent($model);

// Newsletter
if ($model->newsletter) {
$userModule->getNewsletterManager()->subscribeUserNewsletter($model);
} else {
$userModule->getNewsletterManager()->unsubscribeUserNewsletter($model);
}

// Alerte confiance
$userBelongToProducer->trust_alert = $model->trust_alert;
$userBelongToProducer->trust_alert_comment = $model->trust_alert_comment;
$userBelongToProducer->save();

$this->setFlash('success', 'Utilisateur <strong>' . Html::encode($userModule->getUsername($model)) . '</strong> modifié.');
return $this->redirect(['view', 'id' => $model->id]);
}

+ 2
- 3
backend/views/communicate/email.php Ver fichero

@@ -75,10 +75,9 @@ $this->render('@backend/views/user/_menu_filter.php',[
<?php //$form->field($mailForm, 'message')->textarea(['rows' => '15']) ; ?>
<?= $form->field($mailForm, 'message')->widget(letyii\tinymce\Tinymce::class, [
'configs' => [
'plugins' => Yii::$app->parameterBag->get('tinyMcePlugins'),
]
'plugins' => Yii::$app->parameterBag->get('tinyMcePlugins')
],
]); ?>

<div class="form-group form-buttons">
<?= Html::submitButton( 'Envoyer', ['class' => 'btn btn-primary']) ?>
</div>

+ 1
- 1
backend/views/distribution/index.php Ver fichero

@@ -386,7 +386,7 @@ $this->setPageTitle('Distributions') ;
<span class="label label-success" v-if="!order.date_update && !order.date_delete"><span class="glyphicon glyphicon-check"></span></span>
</td>
<td class="column-user">
<a :href="baseUrl+'/user/view?id='+order.id_user" target="_blank" v-if="order.user">
<a v-if="order.user" :href="baseUrl+'/user/view?id='+order.id_user" target="_blank" :class="order.user.trust_alert ? 'user-trust-alert' : ''" :title="order.user.trust_alert ? order.user.trust_alert_comment : ''">
<template v-if="order.user.name_legal_person && order.user.name_legal_person.length">
{{ order.user.name_legal_person }}
</template>

+ 1
- 1
backend/views/point-sale/index.php Ver fichero

@@ -89,7 +89,7 @@ $this->addButton(
'wednesday' => 'Mercredi',
'thursday' => 'Jeudi',
'friday' => 'Vendredi',
'saterday' => 'Samedi',
'saturday' => 'Samedi',
'sunday' => 'Dimanche',
],
'value' => function ($model) use ($pointSaleModule) {

+ 1
- 1
backend/views/subscription/index.php Ver fichero

@@ -139,7 +139,7 @@ $subscriptionsArray = Subscription::searchAll() ;
'wednesday' => 'Mercredi',
'thursday' => 'Jeudi',
'friday' => 'Vendredi',
'saterday' => 'Samedi',
'saturday' => 'Samedi',
'sunday' => 'Dimanche',
],
'headerOptions' => ['class' => 'column-hide-on-mobile'],

+ 25
- 0
backend/views/user/_form.php Ver fichero

@@ -81,6 +81,10 @@ $distributionModule = DistributionModule::getInstance();
<?= $form->field($model, 'send_mail_welcome')->checkbox() ?>
<?php endif; ?>
<?= $form->field($model, 'address')->textarea() ?>
<?= $form->field($model, 'email_sending_invoicing_documents')
->textInput()
->hint("Utilisé pour l'envoi des documents (devis, bons de livraisons et factures)")
?>
</div>
</div>

@@ -161,6 +165,27 @@ $distributionModule = DistributionModule::getInstance();
</div>
</div>

<div class="panel panel-default panel-newsletter">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-exclamation-triangle"></i>
Alerte confiance
</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'trust_alert')->widget(Toggle::class,
[
'options' => [
'data-id' => $model->id,
'data-on' => 'Oui',
'data-off' => 'Non',
],
]
)->hint('Si activé, le nom du client sera mis en avant dans la liste des commandes'); ?>
<?= $form->field($model, 'trust_alert_comment')->textarea(['rows' => 7]); ?>
</div>
</div>

<?php if (
$distributionModule->getExportManager()->isEnabled(ExportManager::SHOPPING_CART_LABELS_PDF)
|| $producerModule->getSolver()->getConfig('option_export_evoliz')): ?>

+ 33
- 0
backend/views/user/view.php Ver fichero

@@ -39,11 +39,14 @@ termes.
use common\helpers\Price;
use domain\Order\Order\OrderModule;
use domain\User\User\UserModule;
use domain\User\UserProducer\UserProducerModule;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

$orderModule = OrderModule::getInstance();
$userModule = UserModule::getInstance();
$userProducerModule = UserProducerModule::getInstance();
$userProducer = $userProducerModule->findOneUserProducer($model);
$username = Html::encode($userModule->getSolver()->getUsername($model));
$this->setTitle($username.' (#'.$model->id.')') ;
$this->addBreadcrumb(['label' => 'Utilisateurs', 'url' => ['index']]) ;
@@ -144,6 +147,36 @@ $this->addBreadcrumb('Récapitulatif') ;
</div>
</div>

<?php if($userProducer->trust_alert): ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-exclamation-triangle"></i>
Alerte confiance
</h3>
</div>
<div class="panel-body">
<ul class="list-group list-group-unbordered">
<li class="list-group-item">
<strong>Alerte confiance</strong>
<span class="pull-right">
<span class="label label-danger">Oui</span>
</span>
</li>
<?php if($userProducer->trust_alert_comment && strlen($userProducer->trust_alert_comment) > 0): ?>
<li class="list-group-item">
<strong>Commentaire</strong>
<span class="pull-right">
<?= nl2br($userProducer->trust_alert_comment) ?>
</span>
<div class="clr"></div>
</li>
<?php endif; ?>
</ul>
</div>
</div>
<?php endif; ?>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">

+ 59
- 44
backend/web/css/screen.css Ver fichero

@@ -2430,15 +2430,19 @@ termes.
color: gray;
font-style: italic;
}
/* line 286, ../sass/distribution/_index.scss */
/* line 285, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-user .user-trust-alert {
color: red;
}
/* line 290, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-delivery-note {
position: relative;
}
/* line 290, ../sass/distribution/_index.scss */
/* line 294, ../sass/distribution/_index.scss */
.distribution-index #orders table td.tiller {
width: 60px;
}
/* line 293, ../sass/distribution/_index.scss */
/* line 297, ../sass/distribution/_index.scss */
.distribution-index #orders table td.tiller label {
font-size: 12px;
cursor: pointer;
@@ -2446,88 +2450,88 @@ termes.
top: -2px;
font-weight: normal;
}
/* line 302, ../sass/distribution/_index.scss */
/* line 306, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions {
position: relative;
text-align: right;
}
/* line 306, ../sass/distribution/_index.scss */
/* line 310, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .wrapper-button-dropdown {
display: inline-block;
}
/* line 310, ../sass/distribution/_index.scss */
/* line 314, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .dropdown-menu {
left: -70px;
width: 227px;
}
/* line 315, ../sass/distribution/_index.scss */
/* line 319, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .modal-form-order,
.distribution-index #orders table td.column-actions .modal-payment {
text-align: left;
}
/* line 320, ../sass/distribution/_index.scss */
/* line 324, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription {
position: relative;
}
/* line 323, ../sass/distribution/_index.scss */
/* line 327, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus {
position: absolute;
top: 4px;
right: 4px;
font-size: 7px;
}
/* line 332, ../sass/distribution/_index.scss */
/* line 336, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-state-payment {
width: 133px;
}
/* line 338, ../sass/distribution/_index.scss */
/* line 342, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-credit a.positive {
color: green;
}
/* line 341, ../sass/distribution/_index.scss */
/* line 345, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-credit a.negative {
color: red;
}
/* line 347, ../sass/distribution/_index.scss */
/* line 351, ../sass/distribution/_index.scss */
.distribution-index #orders table .state-payment-mobile {
display: none;
}
/* line 351, ../sass/distribution/_index.scss */
/* line 355, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-payment {
position: relative;
}
/* line 354, ../sass/distribution/_index.scss */
/* line 358, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-payment div.btn-group {
width: 125px;
}
/* line 360, ../sass/distribution/_index.scss */
/* line 364, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view ul {
list-style-type: none;
margin-left: 0px;
padding-left: 15px;
}
/* line 370, ../sass/distribution/_index.scss */
/* line 374, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view .comment {
margin-top: 20px;
}
/* line 374, ../sass/distribution/_index.scss */
/* line 378, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view .delivery {
margin-top: 20px;
}
/* line 383, ../sass/distribution/_index.scss */
/* line 387, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container {
width: 100%;
padding: 0px;
}
/* line 387, ../sass/distribution/_index.scss */
/* line 391, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-body {
padding-right: 15px;
}
/* line 390, ../sass/distribution/_index.scss */
/* line 394, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-body table {
margin-bottom: 150px;
}
/* line 395, ../sass/distribution/_index.scss */
/* line 399, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-footer {
border-top-color: #f4f4f4;
position: fixed;
@@ -2539,64 +2543,64 @@ termes.
text-align: center;
border-top: solid 1px #e0e0e0;
}
/* line 407, ../sass/distribution/_index.scss */
/* line 411, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-footer .actions-form button {
float: none;
}
/* line 411, ../sass/distribution/_index.scss */
/* line 415, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-footer .actions-form div.right {
float: right;
}
/* line 418, ../sass/distribution/_index.scss */
/* line 422, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .btn-credit {
float: right;
}
/* line 424, ../sass/distribution/_index.scss */
/* line 428, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered td {
background-color: #e9e9e9;
}
/* line 428, ../sass/distribution/_index.scss */
/* line 432, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered input.input-quantity {
font-size: 16px;
font-weight: bold;
}
/* line 434, ../sass/distribution/_index.scss */
/* line 438, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price {
width: 150px;
}
/* line 437, ../sass/distribution/_index.scss */
/* line 441, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price input {
text-align: center;
}
/* line 441, ../sass/distribution/_index.scss */
/* line 445, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price .input-group-addon {
background-color: #eee;
}
/* line 445, ../sass/distribution/_index.scss */
/* line 449, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price .invoice-price {
margin-top: 8px;
}
/* line 447, ../sass/distribution/_index.scss */
/* line 451, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price .invoice-price .label-invoice-price {
font-size: 11px;
font-weight: bold;
color: gray;
}
/* line 455, ../sass/distribution/_index.scss */
/* line 459, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity {
width: 165px;
}
/* line 458, ../sass/distribution/_index.scss */
/* line 462, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity input {
text-align: center;
color: black;
}
/* line 463, ../sass/distribution/_index.scss */
/* line 467, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .form-control {
border-right: 0px none;
padding-right: 4px;
}
/* line 468, ../sass/distribution/_index.scss */
/* line 472, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon {
padding: 5px;
padding-left: 0px;
@@ -2604,35 +2608,35 @@ termes.
border-left: 0px none;
border-right: 0px none;
}
/* line 477, ../sass/distribution/_index.scss */
/* line 481, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining {
text-align: right;
}
/* line 480, ../sass/distribution/_index.scss */
/* line 484, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.quantity-remaining, .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite {
color: #00A65A;
}
/* line 484, ../sass/distribution/_index.scss */
/* line 488, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative {
color: #DD4B39;
}
/* line 488, ../sass/distribution/_index.scss */
/* line 492, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite, .distribution-index .modal-form-order table.table-products td.quantity-remaining.empty {
font-size: 18px;
}
/* line 495, ../sass/distribution/_index.scss */
/* line 499, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .actions-form button {
margin-left: 15px;
}
/* line 503, ../sass/distribution/_index.scss */
/* line 507, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon {
width: 50px;
}
/* line 506, ../sass/distribution/_index.scss */
/* line 510, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon i {
font-size: 30px;
}
/* line 511, ../sass/distribution/_index.scss */
/* line 515, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-content {
margin-left: 50px;
}
@@ -3285,4 +3289,15 @@ termes.
.distribution-index #orders table .column-delivery-note {
display: none;
}

/* line 173, ../sass/_responsive.scss */
.communicate-email {
/*#mailform-message {
display: block !important;
height: 250px;
}
.tox-tinymce {
display: none;
}*/
}
}

+ 10
- 0
backend/web/js/backend.js Ver fichero

@@ -58,6 +58,7 @@ $(document).ready(function () {
opendistrib_point_sale_form();
opendistrib_check_all_checkboxes();
opendistrib_dashboard_admin_statistics();
opendistrib_tinymce_responsive();
});

var UrlManager = {
@@ -69,6 +70,15 @@ var UrlManager = {
}
};

function opendistrib_tinymce_responsive() {
// tinymce.activeEditor.mode.set('readonly');
//tinymce.activeEditor.hide();
//tinymce.EditorManager.execCommand('mceRemoveEditor',true, 'textarea#mailform-message');
//tinyMCE.init({readonly : 1});
//tinymce.activeEditor.getBody().setAttribute('contenteditable', false);
//tinyMCE.get('mailform-message').getBody().setAttribute('contenteditable', false);
}

function opendistrib_dashboard_admin_statistics() {
var selector = '#dashboard-admin-statistics-html';
if($(selector).length) {

+ 11
- 0
backend/web/sass/_responsive.scss Ver fichero

@@ -169,4 +169,15 @@ termes.
}
}
}

.communicate-email {
// désactivation de tinymce sur mobile car copier/coller impossible
/*#mailform-message {
display: block !important;
height: 250px;
}
.tox-tinymce {
display: none;
}*/
}
}

+ 4
- 0
backend/web/sass/distribution/_index.scss Ver fichero

@@ -281,6 +281,10 @@ termes.
color: gray;
font-style: italic;
}

.user-trust-alert {
color: red;
}
}

td.column-delivery-note {

+ 10
- 7
common/components/Tiller/TillerClientV3.php Ver fichero

@@ -97,13 +97,16 @@ class TillerClientV3 implements TillerClientInterface

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
]);
try {
$response = $this->client->request('POST', $this->urlApi.'purchase-requests/v1/requests?storeId='.$this->storeId, [
'body' => json_encode($params),
'headers' => $this->headers
]);
}
catch (RequestException $exception) {
print_r($exception);
die();
}

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

+ 1
- 1
common/config/params.php Ver fichero

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

return [
'version' => '24.2.C',
'version' => '24.3.A',
'maintenanceMode' => false,
'siteName' => 'Opendistrib',
'tinyMcePlugins' => 'preview searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link lists wordcount help',

+ 26
- 0
common/versions/24.3.A.php Ver fichero

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

require_once dirname(__FILE__).'/_macros.php';

version(
'25/03/2024',
[
[
"[Administration] Utilisateurs > Profil : possibilité de spécifier une adresse email spécifique pour l'envoi des factures",
"[Administration] Utilisateurs > Profil : possibilité de spécifier une alerte de confiance avec un commentaire",
"[Boutique] Points de vente : affichage adresse complète",
],
[
"[Administration] Logiciel de caisse > Tiller : mise à jour vers API V3",
]
],
[
[
],
[
]
],
$userCurrent
);

?>

+ 26
- 0
console/migrations/m240314_093700_add_column_user_email_invoicing.php Ver fichero

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

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m240314_093700_add_column_user_email_invoicing
*/
class m240314_093700_add_column_user_email_invoicing extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('user', 'email_sending_invoicing_documents', Schema::TYPE_STRING);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('user', 'email_sending_invoicing_documents');
}
}

+ 28
- 0
console/migrations/m240320_092736_add_columns_user_trust_alert.php Ver fichero

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

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m240320_092736_add_columns_user_trust_alert
*/
class m240320_092736_add_columns_user_trust_alert extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('user_producer', 'trust_alert', Schema::TYPE_BOOLEAN);
$this->addColumn('user_producer', 'trust_alert_comment', Schema::TYPE_TEXT);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('user_producer', 'trust_alert');
$this->dropColumn('user_producer', 'trust_alert_comment');
}
}

+ 4
- 1
domain/Document/Document/DocumentManager.php Ver fichero

@@ -3,12 +3,14 @@
namespace domain\Document\Document;

use domain\Producer\Producer\ProducerSolver;
use domain\User\User\UserSolver;
use kartik\mpdf\Pdf;
use domain\_\AbstractManager;
use yii\base\ErrorException;

class DocumentManager extends AbstractManager
{
protected UserSolver $userSolver;
protected DocumentSolver $documentSolver;
protected DocumentBuilder $documentBuilder;
protected ProducerSolver $producerSolver;
@@ -16,6 +18,7 @@ class DocumentManager extends AbstractManager

public function loadDependencies(): void
{
$this->userSolver = $this->loadService(UserSolver::class);
$this->documentSolver = $this->loadService(DocumentSolver::class);
$this->documentBuilder = $this->loadService(DocumentBuilder::class);
$this->producerSolver = $this->loadService(ProducerSolver::class);
@@ -124,7 +127,7 @@ class DocumentManager extends AbstractManager
], [
'document' => $document
])
->setTo($document->user->email)
->setTo($this->userSolver->getEmailSendingInvoicingDocuments($document->user))
->setFrom([$this->producerSolver->getEmailOpendistrib($producer) => $producer->name])
->setSubject('[' . $producer->name . '] ' . $subjectEmail);


+ 25
- 8
domain/Order/Order/TillerManager.php Ver fichero

@@ -89,13 +89,25 @@ class TillerManager extends AbstractManager
foreach ($order->productOrder as $productOrder) {
// v3
if($apiVersion == 'v3') {
$amount = round($this->productOrderSolver->getPriceWithTax($productOrder) * 100);

// classique
if(is_int($productOrder->quantity)) {
$quantity = $productOrder->quantity;
}
// vrac
else {
$amount = $amount * $productOrder->quantity;
$quantity = 1;
}

$lines[] = [
'name' => $productOrder->product->name,
'unitPrice' => [
'amount' => $this->productOrderSolver->getPriceWithTax($productOrder) * 100,
'amount' => $amount,
],
'taxRate' => $productOrder->taxRate->value * 100,
'quantity' => $productOrder->quantity
'quantity' => $quantity
];
}
// v2
@@ -130,6 +142,16 @@ class TillerManager extends AbstractManager
if (!$this->isSynchronized($date, $order->id)) {
// v3
if($apiVersion == 'v3') {

$payments = [];
$amountPayment = round($this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_PAID) * 100);
if($amountPayment) {
$payments[] = [
'externalId' => ''.$order->id,
'amount' => $amountPayment
];
}

$returnTiller = $this->tillerClient->postOrder([
'externalId' => ''.$order->id,
'purchaseRequestType' => 'clickAndCollect',
@@ -137,12 +159,7 @@ class TillerManager extends AbstractManager
'order' => [
'currencyCode' => 'EUR',
'itemLines' => $lines,
'payments' => [
[
'externalId' => ''.$order->id,
'amount' => $this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_PAID) * 100,
]
]
'payments' => $payments
]
]);
}

+ 14
- 0
domain/PointSale/PointSale/PointSaleSolver.php Ver fichero

@@ -105,6 +105,20 @@ class PointSaleSolver extends AbstractService implements SolverInterface
return $str;
}

public function getLocalityWithAddressTooltip(PointSale $pointSale): string
{
$html = '';

if($pointSale->address && strlen($pointSale->address) > 0) {
$html .= '<span data-toggle="tooltip" data-placement="bottom" title="'.Html::encode($pointSale->address).'">'.Html::encode($pointSale->locality).'</span>';
}
else {
$html .= Html::encode($pointSale->locality);
}

return $html;
}

public function isPublic(PointSale $pointSale): bool
{
if($pointSale->restricted_access || ($pointSale->code && strlen($pointSale->code))) {

+ 9
- 4
domain/User/User/User.php Ver fichero

@@ -78,6 +78,8 @@ class User extends ActiveRecordCommon implements IdentityInterface
var $product_price_percent;
var $newsletter;
var $send_mail_welcome;
var $trust_alert;
var $trust_alert_comment;

/**
* @inheritdoc
@@ -106,10 +108,10 @@ class User extends ActiveRecordCommon implements IdentityInterface
[['no_mail', 'mail_distribution_monday', 'mail_distribution_tuesday', 'mail_distribution_wednesday',
'mail_distribution_thursday', 'mail_distribution_friday', 'mail_distribution_saturday',
'mail_distribution_sunday', 'is_main_contact', 'newsletter', 'exclude_export_shopping_cart_labels',
'send_mail_welcome'], 'boolean'],
[['lastname', 'name', 'phone', 'address', 'type', 'name_legal_person', 'evoliz_code'], 'string'],
'send_mail_welcome', 'trust_alert'], 'boolean'],
[['lastname', 'name', 'phone', 'address', 'type', 'name_legal_person', 'evoliz_code', 'trust_alert_comment'], 'string'],
['lastname', 'verifyOneName', 'skipOnError' => false, 'skipOnEmpty' => false],
['email', 'email', 'message' => 'Cette adresse email n\'est pas valide'],
[['email', 'email_sending_invoicing_documents'], 'email', 'message' => 'Cette adresse email n\'est pas valide'],
['email', 'verifyEmail'],
['status', 'default', 'value' => self::STATUS_ACTIVE],
['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED, self::STATUS_ADMIN, self::STATUS_PRODUCER]],
@@ -151,7 +153,10 @@ class User extends ActiveRecordCommon implements IdentityInterface
'evoliz_code' => 'Code client Evoliz',
'newsletter' => "Inscrit au bulletin d'information",
'exclude_export_shopping_cart_labels' => "Exclure de l'export d'étiquettes",
'send_mail_welcome' => "Envoyer un email de bienvenue"
'send_mail_welcome' => "Envoyer un email de bienvenue",
'email_sending_invoicing_documents' => 'Email facturation',
'trust_alert' => 'Alerte confiance',
'trust_alert_comment' => 'Commentaire',
];
}


+ 12
- 0
domain/User/User/UserSolver.php Ver fichero

@@ -278,4 +278,16 @@ class UserSolver extends AbstractService implements SolverInterface
return $userProducer;
}

public function getEmailSendingInvoicingDocuments(User $user): ?string
{
if($user->email_sending_invoicing_documents && strlen($user->email_sending_invoicing_documents) > 0) {
return $user->email_sending_invoicing_documents;
}

if($user->email && strlen($user->email) > 0) {
return $user->email;
}

return null;
}
}

+ 5
- 2
domain/User/UserProducer/UserProducer.php Ver fichero

@@ -63,8 +63,9 @@ class UserProducer extends ActiveRecordCommon
return [
[['id_user', 'id_producer'], 'required'],
[['id_user', 'id_producer', 'product_price_percent'], 'integer'],
[['active', 'bookmark', 'credit_active', 'newsletter'], 'boolean'],
[['active', 'bookmark', 'credit_active', 'newsletter', 'trust_alert'], 'boolean'],
[['credit', 'product_price_percent'], 'double'],
[['trust_alert_comment'], 'string']
];
}

@@ -79,7 +80,9 @@ class UserProducer extends ActiveRecordCommon
'active' => 'Actif',
'bookmark' => 'Favoris',
'credit_active' => 'Crédit',
'product_price_percent' => 'Prix produits : pourcentage'
'product_price_percent' => 'Prix produits : pourcentage',
'trust_alert' => 'Alert confiance',
'trust_alert_comment' => 'Commentaire',
];
}


+ 3
- 1
producer/views/order/confirm.php Ver fichero

@@ -94,7 +94,9 @@ $this->setTitle('Confirmation de commande') ;
<?php if($order->pointSale->is_bread_box && $order->pointSale->bread_box_code): ?>
(Code : <strong><?= $order->pointSale->bread_box_code; ?></strong>)
<?php endif; ?>
<br />&nbsp; &nbsp; &nbsp;<span class="locality">à <?= Html::encode($order->pointSale->locality) ?></span><?php endif; ?>
<span class="locality">à <?= $pointSaleModule->getSolver()->getLocalityWithAddressTooltip($order->pointSale) ?></span>
<?php endif; ?>

<?php endif; ?>
</li>
<?php

+ 4
- 2
producer/views/site/index.php Ver fichero

@@ -40,6 +40,7 @@ use common\helpers\Image;
use common\helpers\Price;
use domain\Distribution\Distribution\DistributionModule;
use domain\Distribution\PointSaleDistribution\PointSaleDistribution;
use domain\PointSale\PointSale\PointSaleModule;
use domain\Producer\Producer\Producer;
use domain\Producer\Producer\ProducerModule;
use domain\Product\Product\ProductModule;
@@ -49,6 +50,7 @@ use yii\helpers\Html;
$productModule = ProductModule::getInstance();
$producerModule = ProducerModule::getInstance();
$distributionModule = DistributionModule::getInstance();
$pointSaleModule = PointSaleModule::getInstance();

$producer = $this->context->getProducerCurrent();

@@ -76,10 +78,10 @@ $this->setPageTitle(Html::encode($producer->type . ' à ' . $producer->city));
'attribute' => 'name',
'format' => 'raw',
'contentOptions' => ['class' => 'name'],
'value' => function ($model) {
'value' => function ($model) use ($pointSaleModule) {
$html = '<span class="the-name">' . Html::encode($model->name) . '</span>';
if (strlen($model->locality)) {
$html .= '<br />à ' . Html::encode($model->locality);
$html .= '<br />à ' . $pointSaleModule->getSolver()->getLocalityWithAddressTooltip($model);
}
return $html;
}

+ 21
- 20
producer/views/subscription/_form.php Ver fichero

@@ -99,27 +99,28 @@ $orderModule = OrderModule::getInstance();
</div>
<h3 id="step-date"><span>Dates</span></h3>
<div class="col-md-4">
<div class="form-group">
<label>Date de début</label>
<v-date-picker
mode="single"
v-model="dateBegin"
:input-props='{class: "form-control", placeholder: "" }'>
</v-date-picker>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>Date de début</label>
<v-date-picker
mode="single"
v-model="dateBegin"
:input-props='{class: "form-control", placeholder: "" }'>
</v-date-picker>
</div>
</div>
</div>
<div class="clr"></div>
<div class="col-md-4">
<div class="form-group">
<label>Date de fin</label>
<v-date-picker
mode="single"
v-model="dateEnd"
:min-date="dateBegin"
:input-props='{class: "form-control", placeholder: ""}'>
</v-date-picker>
<div class="hint-block">Laisser vide pour une durée indéterminée</div>
<div class="col-md-4">
<div class="form-group">
<label>Date de fin</label>
<v-date-picker
mode="single"
v-model="dateEnd"
:min-date="dateBegin"
:input-props='{class: "form-control", placeholder: ""}'>
</v-date-picker>
<div class="hint-block">Laisser vide pour une durée indéterminée</div>
</div>
</div>
</div>
<div class="clr"></div>

+ 1
- 1
producer/web/js/vuejs/subscription-form.js Ver fichero

@@ -35,7 +35,7 @@ var app = new Vue({
this.idSubscription = $('#subscription-id').val();
}

this.dateBegin = new Date();
//this.dateBegin = new Date();

axios.get("ajax-infos", {params: {idSubscription: this.idSubscription}})
.then(function (response) {

Cargando…
Cancelar
Guardar