Browse Source

Merge branch 'develop'

master
Fab 4 years ago
parent
commit
06ad4b60c0
34 changed files with 428 additions and 104 deletions
  1. +8
    -0
      ShopBundle/Context/UserUtilsInterface.php
  2. +1
    -0
      ShopBundle/Controller/Backend/OrderController.php
  3. +6
    -0
      ShopBundle/Form/Backend/Merchant/MerchantConfigType.php
  4. +10
    -0
      ShopBundle/Model/OrderShop.php
  5. +2
    -0
      ShopBundle/Model/OrderStatus.php
  6. +17
    -0
      ShopBundle/Model/ProductFamily.php
  7. +14
    -0
      ShopBundle/Repository/CreditHistoryRepository.php
  8. +4
    -3
      ShopBundle/Repository/TicketRepository.php
  9. +24
    -1
      ShopBundle/Resources/public/css/backend/custom.css
  10. +0
    -1
      ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js
  11. +13
    -7
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  12. +6
    -1
      ShopBundle/Resources/public/sass/backend/custom.scss
  13. +15
    -1
      ShopBundle/Resources/translations/lcshop.fr.yaml
  14. +22
    -0
      ShopBundle/Resources/views/backend/default/block/list_addressloopinbesancon.html.twig
  15. +27
    -0
      ShopBundle/Resources/views/backend/default/block/list_orderswaitingbankreturn.html.twig
  16. +1
    -1
      ShopBundle/Resources/views/backend/default/layout/layout.html.twig
  17. +17
    -6
      ShopBundle/Resources/views/backend/form/custom_bootstrap_4.html.twig
  18. +5
    -0
      ShopBundle/Resources/views/backend/merchant/panel_email.html.twig
  19. +10
    -0
      ShopBundle/Resources/views/backend/merchant/panel_order.html.twig
  20. +37
    -0
      ShopBundle/Resources/views/backend/order/form/modal_orderstatushistories.html.twig
  21. +1
    -0
      ShopBundle/Resources/views/backend/order/macros.html.twig
  22. +1
    -0
      ShopBundle/Resources/views/backend/order/show-cart.html.twig
  23. +2
    -0
      ShopBundle/Resources/views/backend/order/show.html.twig
  24. +1
    -0
      ShopBundle/Resources/views/backend/productfamily/form.html.twig
  25. +1
    -1
      ShopBundle/Resources/views/backend/productfamily/macros.html.twig
  26. +59
    -23
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig
  27. +1
    -1
      ShopBundle/Services/CsvGenerator.php
  28. +2
    -1
      ShopBundle/Services/Order/OrderUtils.php
  29. +32
    -30
      ShopBundle/Services/Order/OrderUtilsStockTrait.php
  30. +76
    -22
      ShopBundle/Services/Price/OrderShopPriceUtils.php
  31. +2
    -2
      ShopBundle/Services/Price/PriceUtils.php
  32. +4
    -0
      ShopBundle/Services/ProductFamilyUtils.php
  33. +4
    -1
      ShopBundle/Services/UserUtils.php
  34. +3
    -2
      ShopBundle/Services/UtilsManager.php

+ 8
- 0
ShopBundle/Context/UserUtilsInterface.php View File

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

namespace Lc\ShopBundle\Context;

interface UserUtilsInterface
{

}

+ 1
- 0
ShopBundle/Controller/Backend/OrderController.php View File

@@ -467,6 +467,7 @@ class OrderController extends AdminController
case OrderStatus::ALIAS_PAID_BY_CREDIT :
case OrderStatus::ALIAS_PAID_ONLINE :
case OrderStatus::ALIAS_WAITING_DELIVERY :
case OrderStatus::ALIAS_WAITING_BANK_RETURN :
$parameters['form_order_payment'] = $this->createCustomForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView();
$parameters['form_order_status'] = $this->createCustomForm(OrderStatusType::class, 'orderStatus', $parameters)->createView();
$parameters['form_delete_order_payment'] = $this->createCustomForm(DeleteOrderPaymentType::class, 'deleteOrderPayment', $parameters)->createView();

+ 6
- 0
ShopBundle/Form/Backend/Merchant/MerchantConfigType.php View File

@@ -7,6 +7,7 @@ use Lc\ShopBundle\Context\MerchantConfigInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType;
@@ -55,6 +56,11 @@ class MerchantConfigType extends AbstractType
'label' => $merchantConfig->getLabel(),
]);
}
elseif($merchantConfig->getFieldType() == 'textarea') {
$form->add('value', TextareaType::class, [
'label' => $merchantConfig->getLabel(),
]);
}
else {
if($merchantConfig->getOption()) {
$form->add('value', TextType::class, [

+ 10
- 0
ShopBundle/Model/OrderShop.php View File

@@ -513,6 +513,16 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
return $this;
}

public function getDocumentInvoice(): Document
{
foreach($this->getDocuments() as $document) {
if($document->getType() == Document::TYPE_INVOICE) {
return $document ;
}
}

return false ;
}

/**
* @return Collection|Ticket[]

+ 2
- 0
ShopBundle/Model/OrderStatus.php View File

@@ -15,6 +15,7 @@ abstract class OrderStatus
const ALIAS_CART_CANCELED = 'cart-canceled' ;
const ALIAS_WAITING_PAYMENT_ONLINE = 'waiting-payment-online' ;
const ALIAS_WAITING_PAYMENT_CREDIT = 'waiting-payment-credit' ;
const ALIAS_WAITING_BANK_RETURN = 'waiting-bank-return' ;
const ALIAS_PAID_ONLINE = 'paid-online' ;
const ALIAS_ERROR_PAYMENT_ONLINE = 'error-payment-online' ;
const ALIAS_PAID_BY_CREDIT = 'paid-by-credit' ;
@@ -32,6 +33,7 @@ abstract class OrderStatus
self::ALIAS_PAID_ONLINE,
self::ALIAS_PAID_BY_CREDIT,
self::ALIAS_WAITING_DELIVERY,
self::ALIAS_WAITING_BANK_RETURN,
self::ALIAS_WAITING_DELIVERY_WITH_PAYMENT,
self::ALIAS_DELIVERED_WITHOUT_PAYMENT,
self::ALIAS_DONE

+ 17
- 0
ShopBundle/Model/ProductFamily.php View File

@@ -90,6 +90,11 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
*/
protected $productsType;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $productsQuantityAsTitle;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
@@ -289,6 +294,18 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
return $this;
}

public function getProductsQuantityAsTitle(): ?bool
{
return $this->productsQuantityAsTitle;
}

public function setProductsQuantityAsTitle(bool $productsQuantityAsTitle): self
{
$this->productsQuantityAsTitle = $productsQuantityAsTitle;

return $this;
}

public function getProductsType(): ?string
{
return $this->productsType;

+ 14
- 0
ShopBundle/Repository/CreditHistoryRepository.php View File

@@ -18,6 +18,20 @@ class CreditHistoryRepository extends BaseRepository implements DefaultRepositor
return CreditHistoryInterface::class;
}

public function findAllByDateStartEnd($merchant, $dateStart, $dateEnd)
{
return $this->createQueryBuilder('e')
->innerJoin('e.userMerchant', 'user_merchant')
->andWhere('user_merchant.merchant = :merchant')
->setParameter(':merchant', $merchant)
->andWhere('e.createdAt >= :dateStart')
->andWhere('e.createdAt <= :dateEnd')
->setParameter(':dateStart', $dateStart)
->setParameter(':dateEnd', $dateEnd)
->addOrderBy('e.createdAt', 'ASC')
->getQuery()->getResult();
}

public function findAllByUserMerchant($userMerchant)
{
return $this->createQueryBuilder('e')

+ 4
- 3
ShopBundle/Repository/TicketRepository.php View File

@@ -29,11 +29,12 @@ class TicketRepository extends BaseRepository implements DefaultRepositoryInterf
return $query ;
}

public function findAllOpen()
public function findAllOpen($limit=0)
{
$query = $this->findByMerchantQuery() ;
$this->filterStatus($query, [Ticket::TICKET_STATUS_OPEN, Ticket::TICKET_STATUS_BEING_PROCESSED]) ;
$this->filterStatus($query, [Ticket::TICKET_STATUS_OPEN]) ;
$query->addOrderBy('e.id', 'DESC') ;
$query->setMaxResults($limit);
return $query->getQuery()->getResult() ;
}

@@ -41,7 +42,7 @@ class TicketRepository extends BaseRepository implements DefaultRepositoryInterf
{
$query = $this->findByMerchantQuery() ;
$query->select('count(e.id)');
$this->filterStatus($query, [Ticket::TICKET_STATUS_OPEN, Ticket::TICKET_STATUS_BEING_PROCESSED]) ;
$this->filterStatus($query, [Ticket::TICKET_STATUS_OPEN]) ;
return $query->getQuery()->getSingleScalarResult() ;
}
}

+ 24
- 1
ShopBundle/Resources/public/css/backend/custom.css View File

@@ -690,6 +690,7 @@ table th .select2-container--default .select2-selection--single {
border-top: 1px solid #dee2e6;
text-align: center;
border-bottom: 2px solid #dee2e6;
position: relative;
}

/* line 252, ../../sass/backend/custom.scss */
@@ -834,8 +835,30 @@ table.products-collection-table tr.disabled {
display: block;
}

/* line 292, ../../sass/backend/custom.scss */
#dashboard #range_date_interval {
margin-bottom: 20px;
}

/* line 293, ../../sass/backend/custom.scss */
#dashboard #range_date_interval label {
float: left;
margin-right: 20px;
}

/* line 294, ../../sass/backend/custom.scss */
#dashboard #range_date_interval .form-check {
float: left;
margin-right: 10px;
}

/* line 295, ../../sass/backend/custom.scss */
#dashboard .table-condensed .btn, #dashboard .table-condensed .btn-sm {
white-space: nowrap;
}

/* Tickets */
/* line 296, ../../sass/backend/custom.scss */
/* line 301, ../../sass/backend/custom.scss */
#ticket-list .btn-sm {
display: block;
}

+ 0
- 1
ShopBundle/Resources/public/js/backend/script/default/vuejs-mixins.js View File

@@ -164,7 +164,6 @@ let mixinPrice = {
if (this.behaviorPriceValue == 'by-piece') {
this.setBuyingPriceByRefUnit();
this.setBuyingPriceByRefUnitWithTax();
log('ncihe');
this.setPriceByRefUnit();
this.setPriceByRefUnitWithTax();
} else if (this.behaviorPriceValue == 'by-reference-unit') {

+ 13
- 7
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js View File

@@ -209,7 +209,6 @@ $(window).on('load', function () {

this.$nextTick(function () {

log(this.status);
if (this.status == 0) {
$(this.$el).addClass('disabled');
}
@@ -248,8 +247,8 @@ $(window).on('load', function () {
if (field == 'unitInherited') {
$('select[data-ref="' + field + '"]').eq(y).focus();
} else {
$('input[data-ref="' + field + '"]').eq(y).focus();
log('blop');
$('input[data-ref="' + field + '"]').eq(y).focus().select();
}
});

@@ -283,7 +282,7 @@ $(window).on('load', function () {
var app = this;
$(this.$el).find('input, select').off('keydown');
$(this.$el).find('input, select').on('keydown', function (e) {
if (e.keyCode == 13 || e.keyCode == 9) e.preventDefault();
if (e.keyCode == 13 || e.keyCode == 9 || e.keyCode ==40 || e.keyCode==38) e.preventDefault();

//ENTRER
if (e.keyCode == 13) {
@@ -299,7 +298,6 @@ $(window).on('load', function () {
if (e.shiftKey && e.keyCode == 9) {
e.preventDefault();
$prevField = $(this).parents('td').prevAll('td:visible').first().find('input, select');
log($prevField);
if($prevField.length == 0){
$prevField = $(this).parents('td').prevAll('td:visible').first().prevAll('td:visible').first().find('input, select');

@@ -363,7 +361,7 @@ $(window).on('load', function () {
'supplierTaxRateValue': this.$refs.productUnitPrice.supplierTaxRateValue,
'marginProfit': this.$refs.productUnitPrice.marginProfit,
'marginProfitPercent': this.$refs.productUnitPrice.marginProfitPercent,
'productsQuantityAsTitle': this.productsQuantityAsTitle,
/*'taxRate': this.$refs.productUnitPrice.taxRate,
'supplierTaxRate': this.$refs.productUnitPrice.supplierTaxRate,
*/
@@ -396,6 +394,7 @@ $(window).on('load', function () {
'supplierTaxRate': null,
'multiplyingFactor': null,
'taxRateValue': null,
'productsQuantityAsTitle': null,
'propertyExpirationDate': this.propertyExpirationDate,
'behaviorExpirationDate': this.behaviorExpirationDate
};
@@ -425,7 +424,7 @@ $(window).on('load', function () {
propertyNoveltyExpirationDateActive: false,
propertyNoveltyExpirationDate:null,
activeProducts: false,
productsQuantityAsTitle: false,
formProducts: {},
currentSection: 'general',
sectionsArray: [
@@ -564,6 +563,13 @@ $(window).on('load', function () {
}
}
},
emptyProductsField: function (fieldName){
if (confirm('Êtes-vous sur de cette action ?')) {
for (i = 0; i < this.$refs.productForm.length; i++) {
this.$refs.productForm[i][fieldName] = null;
}
}
},
getUnitReference: function () {
if (typeof this.$refs.productUnitPrice !== 'undefined') {
return this.$refs.productUnitPrice.unitReference;

+ 6
- 1
ShopBundle/Resources/public/sass/backend/custom.scss View File

@@ -248,7 +248,7 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0
.card-body.p-0 .products-collection-table tbody > tr > td:first-of-type, .card-body.p-0 .products-collection-table tbody > tr > th:first-of-type, .card-body.p-0 .products-collection-table thead > tr > td:first-of-type, .card-body.p-0 .products-collection-table thead > tr > th:first-of-type{padding-left: 0.35rem;}
.products-collection-table .btn-empty-field{position: absolute; right: 3px; font-size: 0.7rem; top: 5px; padding: 0px;}
#lc-product-family-edit .products-collection-table {table-layout:fixed;/* background-clip: padding-box;*/ border-collapse: collapse;}
#lc-product-family-edit .products-collection-table th{font-size:13px; border-left: 1px solid #dee2e6; border-top: 1px solid #dee2e6; text-align: center; border-bottom: 2px solid #dee2e6;}
#lc-product-family-edit .products-collection-table th{font-size:13px; border-left: 1px solid #dee2e6; border-top: 1px solid #dee2e6; text-align: center; border-bottom: 2px solid #dee2e6; position: relative;}
#lc-product-family-edit .products-collection-table tfoot th{border-top: 2px solid #dee2e6;}
#lc-product-family-edit .products-collection-table th span {white-space: initial;}
#lc-product-family-edit .products-collection-table th:last-child{border-right: 1px solid #dee2e6;}
@@ -289,6 +289,11 @@ table.products-collection-table tr.disabled{opacity: 0.5}
#dashboard .btn-statistic small{margin-bottom: 10px; display: block;}
#dashboard .btn-statistic .value{display: block;}

#dashboard #range_date_interval {margin-bottom: 20px;}
#dashboard #range_date_interval label{float: left; margin-right: 20px;}
#dashboard #range_date_interval .form-check{float: left; margin-right: 10px;}
#dashboard .table-condensed .btn, #dashboard .table-condensed .btn-sm{white-space: nowrap;}


/* Tickets */


+ 15
- 1
ShopBundle/Resources/translations/lcshop.fr.yaml View File

@@ -67,9 +67,12 @@ group:
deliveryAddress: Adresse de livraison
complementary: Commandes complémentaires
tickets: Tickets relatif à la commande
orderStatusHistories: Historique de changement de statut
waitingBankReturn: Commandes en attente de retour banque
Ticket:
listMessages: Liste des messages
list: Tickets ouverts
listLast: Derniers tickets ouverts
PointSale:
main: Général
Merchant:
@@ -277,6 +280,9 @@ field:
users: Utilisateurs
total: Total
products: Produits
purchaseOrderEmailContent: "Contenu par défaut de l'email envoyé aux producteurs"
dateStart: Date de début
dateEnd: Date de fin

PointSale:
code: Code
@@ -319,6 +325,7 @@ field:
propertyAlcoholLevel: Degré d'alcool
displayPriceUnitRef: Afficher le prix par unité de référence
behaviorPrice: Travailler avec des tarifs
productsQuantityAsTitle: Titre équivalent à quantité
behaviorPriceOptions:
by-piece: À la pièce
by-reference-unit: Par unité de référence
@@ -466,7 +473,12 @@ field:
quotation: Devis
purchase-order: Bon de commande
delivery-note: Bon de livraison

Statistic:
interval: Affichage des résultats
intervalOptions:
days: Par jour
week: Par semaine
month: Par mois

action:
apply: Appliquer
@@ -490,6 +502,8 @@ action:
form.empty_value: Aucun(e)
add: Ajouter
valid: Valider
close: Fermer
history: Historique
product:
editStock: Gérer les stocks
editProductFamily: Éditer le produit

+ 22
- 0
ShopBundle/Resources/views/backend/default/block/list_addressloopinbesancon.html.twig View File

@@ -0,0 +1,22 @@
<table class="table table-condensed" id="address-list">
<thead>
<tr>
<th>Adresse</th>
<th></th>
</tr>
</thead>
<tbody>
{% for address in addressesLoopBesancon %}
<tr>
<td>{{ address }}</td>
<td><a class="btn-sm btn-success"
href="{{ path('easyadmin', {id: address.user.id, entity: 'User', action: 'show'}) }}">
<i class="fas fa-eye"></i>
</a></td>
</tr>
{% else %}
<tr>
<td colspan="2"><i>Aucune adresse pour le moment</i></td>
{% endfor %}
</tbody>
</table>

+ 27
- 0
ShopBundle/Resources/views/backend/default/block/list_orderswaitingbankreturn.html.twig View File

@@ -0,0 +1,27 @@
<table class="table table-condensed" id="address-list">
<thead>
<tr>
<th>Id</th>
<th>Utilisateurs</th>
<th>Date</th>
<th></th>
</tr>
</thead>
<tbody>
{% for order in ordersWaitingBankReturn %}
<tr>
<td>{{ order.id }}</td>
<td>{{ order.user }}</td>
<td>{{ order.updatedAt|date('d-m H:i') }}</td>
<td><a class="btn-sm btn-success"
href="{{ path('easyadmin', {id: order.id, entity: 'OrderShop', action: 'show'}) }}">
<i class="fas fa-eye"></i>
</a></td>
</tr>
{% else %}
<tr>
<td colspan="4"><i>Aucune commande pour le moment</i></td>
{% endfor %}
</tbody>
</table>


+ 1
- 1
ShopBundle/Resources/views/backend/default/layout/layout.html.twig View File

@@ -186,7 +186,7 @@
</div>

{% block content_reminders %}
{% if reminders|length >0 %}
{% if reminders is defined and reminders|length >0 %}
<div class="head-reminders card card-outline card-danger">
{% include '@LcShop/backend/default/block/list_reminders.html.twig' %}
</div>

+ 17
- 6
ShopBundle/Resources/views/backend/form/custom_bootstrap_4.html.twig View File

@@ -66,10 +66,13 @@
</div>
{% endif %}#}

{% set labelHelp = 'field.'~easyadmin['entity']['name']~'.'~name~'Help' %}
{% if labelHelp|trans({}, 'lcshop') == labelHelp %}{% set labelHelp = 'form.field.default.'~name~'Help' %}{% endif %}
{% if labelHelp|trans({}, 'lcshop') != labelHelp %}
<small class="form-text text-muted">{{ labelHelp|trans({}, 'lcshop')|raw }}</small>

{% if easyadmin is defined %}
{% set labelHelp = 'field.'~easyadmin['entity']['name']~'.'~name~'Help' %}
{% if labelHelp|trans({}, 'lcshop') == labelHelp %}{% set labelHelp = 'form.field.default.'~name~'Help' %}{% endif %}
{% if labelHelp|trans({}, 'lcshop') != labelHelp %}
<small class="form-text text-muted">{{ labelHelp|trans({}, 'lcshop')|raw }}</small>
{% endif %}
{% endif %}

{{- form_errors(form) -}}
@@ -127,12 +130,20 @@
{% if 'field.MerchantConfig.' in label %}
{% set name_trad = label|replace({'field.MerchantConfig.': ''}) %}
{% set trad = name_trad|lc_trad(easyadmin['entity']['name'], 'field') %}

{% else %}
{% set trad = name|lc_trad(easyadmin['entity']['name'], 'field') %}
{% if easyadmin is defined %}
{% set trad = name|lc_trad(easyadmin['entity']['name'], 'field') %}
{% else %}
{% set trad = name|lc_trad('', 'field') %}
{% endif %}

{% endif %}

{%- endif -%}
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ trad }}</{{ element|default('label') }}>
{% if trad is defined %}
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ trad }}</{{ element|default('label') }}>
{% endif %}
{%- endif -%}
{%- endblock form_label %}


+ 5
- 0
ShopBundle/Resources/views/backend/merchant/panel_email.html.twig View File

@@ -21,6 +21,11 @@
<div class="col-12">
{{ form_row(form.merchantConfigs['email-from-purchase-order']) }}
</div>
{% if form.merchantConfigs['purchase-order-email-content'] is defined %}
<div class="col-12">
{{ form_row(form.merchantConfigs['purchase-order-email-content']) }}
</div>
{% endif %}
{{ macros.card_end() }}
</div>
</div>

+ 10
- 0
ShopBundle/Resources/views/backend/merchant/panel_order.html.twig View File

@@ -17,6 +17,16 @@
<div class="col-6">
{{ form_row(form.merchantConfigs['order-open-time']) }}
</div>
{% if form.merchantConfigs['order-open-day-vip'] is defined %}
<div class="col-6">
{{ form_row(form.merchantConfigs['order-open-day-vip']) }}
</div>
{% endif %}
{% if form.merchantConfigs['order-open-time-vip'] is defined %}
<div class="col-6">
{{ form_row(form.merchantConfigs['order-open-time-vip']) }}
</div>
{% endif %}
<div class="col-6">
{{ form_row(form.merchantConfigs['order-close-day']) }}
</div>

+ 37
- 0
ShopBundle/Resources/views/backend/order/form/modal_orderstatushistories.html.twig View File

@@ -0,0 +1,37 @@
{% embed "@LcShop/backend/default/block/embed_modal.twig" %}
{% trans_default_domain 'lcshop' %}
{% block size %}modal-lg{% endblock %}
{% block id %}modal-order-status-histories{% endblock %}
{% block title %}{{ "group.OrderShop.orderStatusHistories"|trans }}{% endblock %}

{% block content %}
<div class="col">
<table class="table table-bordered">
<thead>
<th>Id</th>
<th>Date</th>
<th>Statut</th>
<th>Utilisateur</th>
<th>Origin</th>
</thead>
<tbody>
<template v-for="(orderStatusHistory, i) in order.orderStatusHistories">
<tr>
<td>${orderStatusHistory.id}</td>
<td>${orderStatusHistory.createdAt}</td>
<td>${orderStatusHistory.orderStatus}</td>
<td>${orderStatusHistory.createdBy}</td>
<td>${orderStatusHistory.origin}</td>
</tr>
</template>
</tbody>
</table>
</div>
{% endblock %}

{% block footer %}
<button type="button" class="btn btn-default float-right"
data-dismiss="modal">{{ 'action.close'|trans }}</button>
{% endblock %}

{% endembed %}

+ 1
- 0
ShopBundle/Resources/views/backend/order/macros.html.twig View File

@@ -602,6 +602,7 @@
<strong> ${order.orderStatus}</strong>
{% endblock %}
{% block button %}
{{ order_macros.order_modal_button('#modal-order-status-histories', 'btn-secondary', 'action.history') }}
{{ order_macros.order_modal_button('#modal-order-status') }}
{% endblock %}
{% endembed %}

+ 1
- 0
ShopBundle/Resources/views/backend/order/show-cart.html.twig View File

@@ -90,6 +90,7 @@
{% include '@LcShop/backend/order/form/modal_sendpaymentlink.html.twig' %}
{% endif %}

{% include '@LcShop/backend/order/form/modal_orderstatushistories.html.twig' %}
</div>
</div>
{% endblock %}

+ 2
- 0
ShopBundle/Resources/views/backend/order/show.html.twig View File

@@ -104,6 +104,8 @@
{% include '@LcShop/backend/order/form/modal_sendpaymentlink.html.twig' %}
{% endif %}

{% include '@LcShop/backend/order/form/modal_orderstatushistories.html.twig' %}

</div>
</div>
{% endblock %}

+ 1
- 0
ShopBundle/Resources/views/backend/productfamily/form.html.twig View File

@@ -48,6 +48,7 @@
{% if formValues.behaviorExpirationDate %}behaviorExpirationDate: "{{ formValues.behaviorExpirationDate }}",{% endif %}
{% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate }}",{% endif %}
{% if formValues.activeProducts %}activeProducts: "{{ formValues.activeProducts }}",{% endif %}
{% if formValues.productsQuantityAsTitle %}productsQuantityAsTitle: {{ formValues.productsQuantityAsTitle }},{% endif %}

};
multiplyingFactor = "{{ form.multiplyingFactor.vars.value }}"

+ 1
- 1
ShopBundle/Resources/views/backend/productfamily/macros.html.twig View File

@@ -68,7 +68,7 @@
#new
{% endif %} <br/>
{% verbatim %}{{keyForm}}{% endverbatim %}<i class="fa fa-fw fa-sort"></i></td>
{{ _self.product_field(4, product.title, 'title') }}
{{ _self.product_field(4, product.title, 'title', false, "",'v-show="productFamily.productsQuantityAsTitle == false"' ) }}
{{ _self.product_field(2, product.quantity, 'quantity') }}
{{ _self.product_field(2, product.unit, 'unit', 'unitWording') }}
{{ _self.product_field(3, product.buyingPriceByRefUnit, 'buyingPriceByRefUnit',false, '€', 'v-show="productFamily.behaviorPrice == \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') ~ '\'"') }}

+ 59
- 23
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig View File

@@ -2,7 +2,7 @@
{% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %}
{% trans_default_domain 'lcshop' %}

{#{% import _self as formMacros %}#}
{# {% import _self as formMacros %} #}
<div class="row">
{{ macros.startCard(12, 'ProductFamily.products', 'light', true) }}

@@ -13,51 +13,75 @@
<tr>
<th>
</th>
<th colspan="4" class="string">
<th colspan="4" class="string" v-show="productsQuantityAsTitle == false">
Titre
<button v-on:click="emptyProductsField('title');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th colspan="2" class="string ">
Quantité
<button v-on:click="emptyProductsField('quantity');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th colspan="2" class="quantity">
Unité
<button v-on:click="emptyProductsField('unit');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="buyingPriceByRefUnit ">
PA HT / ${ getUnitReference() }
<button v-on:click="emptyProductsField('buyingPriceByRefUnit');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="priceByRefUnit">
PA TTC / ${ getUnitReference() }
<button v-on:click="emptyProductsField('buyingPriceByRefUnitWithTax');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>

<th colspan="3" class="price main-info">
PA HT
<button v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'" v-on:click="emptyProductsField('buyingPrice');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th colspan="3" class="price"
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
PA TTC
<button v-on:click="emptyProductsField('buyingPriceWithTax');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th colspan="3" class="main-info">
Coef
<button v-on:click="emptyProductsField('multiplyingFactor');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>


<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="">
PV HT / ${ getUnitReference() }
<button v-on:click="emptyProductsField('priceByRefUnit');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
colspan="3" class="price">
PV TTC / ${ getUnitReference() }
<button v-on:click="emptyProductsField('priceByRefUnitWithTax');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>

<th colspan="3" class="price">
{# v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">#}
{# v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> #}
PV HT
<button v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'" v-on:click="emptyProductsField('price');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th colspan="3" class="price main-info">
PV TTC
<button v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'" v-on:click="emptyProductsField('priceWithTax');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th colspan="2">
Marge HT
@@ -66,14 +90,20 @@
<th colspan="2" class=""
v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'">
<span style="text-transform: uppercase"> ${typeExpirationDate}</span>
<button v-on:click="emptyProductsField('propertyExpirationDate');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'">
Stock
<button v-on:click="emptyProductsField('availableQuantity');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
Stock par défaut
<button v-on:click="emptyProductsField('availableQuantityDefault');"
class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
</th>
<th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'">
@@ -97,8 +127,9 @@
<th>
Rappel
</th>
<th colspan="4" class="string">
<th colspan="4" class="string" v-show="productsQuantityAsTitle == false">
${title}

</th>
<th colspan="2" class="string ">
${productFamily.quantity}
@@ -137,7 +168,7 @@
</th>

<th colspan="3" class="price">
{# v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">#}
{# v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> #}
${productFamily.price}
</th>
<th colspan="3" class="price main-info">
@@ -169,21 +200,26 @@
</tfoot>
</table>

<button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addProductForm"><span
class="fa fa-plus"></span> Ajouter une déclinaison
</button>
<p>
<strong>Aide à l'utilisation - Raccourci clavier</strong>
<ul>
<li><strong>TAB</strong> : Champ suivant</li>
<li><strong>SHIFT + TAB</strong> : Champ précédent</li>
<li><strong>FLÈCHE BAS</strong> : Déclinaison suivante</li>
<li><strong>FLÈCHE HAUT</strong> : Déclinaison précédente</li>
<li><strong>SHIFT + [+]</strong> : Ajout d'une nouvelle déclinaison</li>
</ul>
</p>

<div class="clearfix"></div>

<div class="col-12">
<button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addProductForm"><span
class="fa fa-plus"></span> Ajouter une déclinaison
</button>

{{ form_row(form.productsQuantityAsTitle, {"attr":{'v-model' : 'productsQuantityAsTitle'}}) }}
<p>
<strong>Aide à l'utilisation - Raccourci clavier</strong>
<ul>
<li><strong>TAB</strong> : Champ suivant</li>
<li><strong>SHIFT + TAB</strong> : Champ précédent</li>
<li><strong>FLÈCHE BAS</strong> : Déclinaison suivante</li>
<li><strong>FLÈCHE HAUT</strong> : Déclinaison précédente</li>
<li><strong>SHIFT + [+]</strong> : Ajout d'une nouvelle déclinaison</li>
</ul>
</p>
</div>

<div class="clearfix"></div>

{{ macros.endCard() }}
</div>
@@ -195,7 +231,7 @@
{% for keyForm,i in sortableProductsField %}
{% set product = form.products[i] %}

{#{% if product.vars.value.status >= 0 and (product.vars.value.originProduct is null or product.vars.value.originProduct == false) %}#}
{# {% if product.vars.value.status >= 0 and (product.vars.value.originProduct is null or product.vars.value.originProduct == false) %} #}
window.productForm[{{ keyForm }}] = {
{% if product.vars.value.originProduct is defined %}originProduct: parseInt({{ product.vars.value.originProduct }}),{% endif %}
{% if product.vars.value.status is defined %}status: parseInt({{ product.vars.value.status }}),{% endif %}
@@ -210,10 +246,10 @@
{% if product.vars.value.availableQuantity %}availableQuantity: parseInt({{ product.vars.value.availableQuantity }}),{% endif %}
{% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %}
{% if product.vars.value.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% endif %}
{#{% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %}#}
{# {% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %} #}
};
window.formProductTemplate[{{ keyForm }}] = '{{ product_family_macros.product_row(product, totalProductOrdered[product.vars.value.id])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';
{#{% endif %}#}
{# {% endif %} #}
{% endfor %}

</script>

+ 1
- 1
ShopBundle/Services/CsvGenerator.php View File

@@ -132,7 +132,7 @@ class CsvGenerator
$response = new StreamedResponse(function () {
$this->createCsv('php://output');
});
$response->headers->set('Content-Encoding', $this->toEncoding);
$response->headers->set('Content-Type', 'application/force-download');
$response->headers->set('Content-Disposition', 'attachment; filename="'.$this->titleDocument.'.csv"');
return $response;

+ 2
- 1
ShopBundle/Services/Order/OrderUtils.php View File

@@ -13,6 +13,7 @@ use Lc\ShopBundle\Context\OrderStatusHistoryInterface;
use Lc\ShopBundle\Context\PriceUtilsInterface;
use Lc\ShopBundle\Context\ProductFamilyUtilsInterface;
use Lc\ShopBundle\Context\ReductionCreditInterface;
use Lc\ShopBundle\Context\UserUtilsInterface;
use Lc\ShopBundle\Model\ProductFamily;
use Lc\ShopBundle\Services\CreditUtils;
use Lc\ShopBundle\Services\DocumentUtils;
@@ -45,7 +46,7 @@ class OrderUtils
protected $creditUtils;
protected $router;

public function __construct(EntityManagerInterface $em, Security $security, RouterInterface $router, UserUtils $userUtils,
public function __construct(EntityManagerInterface $em, Security $security, RouterInterface $router, UserUtilsInterface $userUtils,
MerchantUtilsInterface $merchantUtils, PriceUtilsInterface $priceUtils, ProductFamilyUtilsInterface $productFamilyUtils,
DocumentUtils $documentUtils, Utils $utils, CreditUtils $creditUtils)
{

+ 32
- 30
ShopBundle/Services/Order/OrderUtilsStockTrait.php View File

@@ -11,52 +11,54 @@ trait OrderUtilsStockTrait
{
public function deductAvailabilityProduct(\Lc\ShopBundle\Model\OrderShop $orderShop)
{
//TODO ne pas déduire des stocks les orderProduct marqué en relivraison

foreach ($orderShop->getOrderProducts() as $orderProduct) {
switch ($orderProduct->getProduct()->getProductFamily()->getBehaviorCountStock()) {
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
//Si ce n'esrt pas une relivraison OU si c'est une relivraison + relivraison + ce n'est pas une erruer producteur
if (!$orderProduct->isRedelivery() || ($orderProduct->isRedelivery() && $orderProduct->isRedeliverySupplierOrder() && !$orderProduct->isRedeliverySupplierMistake())) {
switch ($orderProduct->getProduct()->getProductFamily()->getBehaviorCountStock()) {
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE :

//Disponibilité par unité de référence
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$newAvailability = $oldAvailability - ($orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct() / $orderProduct->getUnit()->getCoefficient()));
//Disponibilité par unité de référence
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$newAvailability = $oldAvailability - ($orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct() / $orderProduct->getUnit()->getCoefficient()));

$productFamily = $orderProduct->getProduct()->getProductFamily();
$productFamily->setAvailableQuantity($newAvailability);
$productFamily->setUpdatedBy($orderShop->getUser());
$productFamily = $orderProduct->getProduct()->getProductFamily();
$productFamily->setAvailableQuantity($newAvailability);
$productFamily->setUpdatedBy($orderShop->getUser());

$this->em->persist($productFamily);
$this->em->persist($productFamily);

break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :
break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :

$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$newAvailability = $oldAvailability - $orderProduct->getQuantityOrder();
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$newAvailability = $oldAvailability - $orderProduct->getQuantityOrder();

$productFamily = $orderProduct->getProduct()->getProductFamily();
$productFamily->setAvailableQuantity($newAvailability);
$productFamily->setUpdatedBy($orderShop->getUser());
$productFamily = $orderProduct->getProduct()->getProductFamily();
$productFamily->setAvailableQuantity($newAvailability);
$productFamily->setUpdatedBy($orderShop->getUser());

$this->em->persist($productFamily);
$this->em->persist($productFamily);

break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$newAvailability = $oldAvailability - $orderProduct->getQuantityOrder();
break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
$oldAvailability = $orderProduct->getProduct()->getAvailableQuantityInherited();
$newAvailability = $oldAvailability - $orderProduct->getQuantityOrder();

$product = $orderProduct->getProduct();
$product->setAvailableQuantity($newAvailability);
$product->setUpdatedBy($orderShop->getUser());
$product = $orderProduct->getProduct();
$product->setAvailableQuantity($newAvailability);
$product->setUpdatedBy($orderShop->getUser());

$this->em->persist($product);
$this->em->persist($product);

break;
}
break;
}

$this->em->flush();
$this->em->flush();
}
}
}


public function isProductAvailable(Product $product, $quantityOrder = 0, $checkCart = false, $orderShop = null)
{
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1) {

+ 76
- 22
ShopBundle/Services/Price/OrderShopPriceUtils.php View File

@@ -30,7 +30,6 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
return $total;
}


//Inclus les ReductionCatalog des OrderProducts
public function getMarginOrderProducts(OrderShopInterface $orderShop): float
{
@@ -41,6 +40,33 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
return $total;
}

public function getMarginOrderProductsWithReductions(OrderShopInterface $orderShop): float
{
$total = $this->getMarginOrderProducts($orderShop);

$totalReductionAmount = 0;
foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) {
$totalReductionAmount += $this->getOrderProductsReductionCartAmountWithoutTax($orderShop, $orderReductionCart);
}

foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) {
$totalReductionAmount += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit);
}

$total -= $totalReductionAmount;

return $total;
}

public function getMarginOrderProductsWithReductionsPercent(OrderShopInterface $orderShop): float
{
if ($this->getTotalOrderProducts($orderShop)) {
return $this->round($this->getMarginOrderProductsWithReductions($orderShop) / $this->getTotalOrderProductsWithReductions($orderShop) * 100);
} else {
return 0;
}
}

public function getMarginOrderProductsPercent(OrderShopInterface $orderShop): float
{
if ($this->getTotalOrderProducts($orderShop)) {
@@ -48,15 +74,33 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
} else {
return 0;
}

}

public function getBrandTaxesOrderProductsWithReductionsPercent(OrderShopInterface $orderShop): float
{
if ($this->getTotalOrderProducts($orderShop)) {
return $this->round($this->getMarginOrderProducts($orderShop) / $this->getTotalBuyingPriceOrderProducts($orderShop->getOrderProducts()) * 100);
} else {
return 0;
}
}

public function getTotalOrderProductsWithTax(OrderShopInterface $orderShop): float
{
return $this->getTotalOrderProductsWithTaxByOrderProducts($orderShop->getOrderProducts());
}

public function getTotalBuyingPriceOrderProducts($orderProducts): float
{
$total = 0;

foreach ($orderProducts as $orderProduct) {
$total += $this->orderProductPriceUtils->getTotalBuyingPrice($orderProduct);
}

return $total;
}

public function getTotalBuyingPriceOrderProductsWithTax($orderProducts): float
{
$total = 0;
@@ -162,26 +206,6 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
return $total;
}


public function getMarginOrderProductsWithReductions(OrderShopInterface $orderShop): float
{
$total = $this->getMarginOrderProducts($orderShop);

$totalReductionAmount = 0;
foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) {
$totalReductionAmount += $this->getOrderProductsReductionCartAmountWithoutTax($orderShop, $orderReductionCart);
}

foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) {
$totalReductionAmount += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit);
}

$total -= $totalReductionAmount;

return $total;
}


public function getTotalOrderProductsWithTaxAndReductionCarts(OrderShopInterface $orderShop)
{
$total = $this->getTotalOrderProductsWithTax($orderShop);
@@ -276,5 +300,35 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface

return $amountWithTax;
}

public function getTotalReductions(OrderShopInterface $orderShop)
{
$total = 0 ;

foreach($orderShop->getOrderReductionCarts() as $orderReductionCart) {
$total += $this->getOrderProductsReductionCartAmountWithoutTax($orderShop, $orderReductionCart) ;
}

foreach($orderShop->getOrderReductionCredits() as $orderReductionCredit) {
$total += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit) ;
}

return $total ;
}

public function getTotalReductionsWithTax(OrderShopInterface $orderShop)
{
$total = 0 ;

foreach($orderShop->getOrderReductionCarts() as $orderReductionCart) {
$total += $this->getOrderProductsReductionCartAmountWithTax($orderShop, $orderReductionCart) ;
}

foreach($orderShop->getOrderReductionCredits() as $orderReductionCredit) {
$total += $this->getOrderProductsReductionCreditAmountWithTax($orderShop, $orderReductionCredit) ;
}

return $total ;
}
}


+ 2
- 2
ShopBundle/Services/Price/PriceUtils.php View File

@@ -35,7 +35,7 @@ class PriceUtils implements PriceUtilsInterface
$service = 'orderProductPriceUtils';
}

if ($entity instanceof OrderShopInterface || is_array($entity)) {
if ($entity instanceof OrderShopInterface || is_iterable($entity) || is_array($entity)) {
$service = 'orderShopPriceUtils';
}

@@ -51,7 +51,7 @@ class PriceUtils implements PriceUtilsInterface
}
} else {
if (!strlen($service)) {
throw new \ErrorException("PriceUtils : le type d'entité n'est pas géré.");
throw new \ErrorException("PriceUtils : le type d'entité n'est pas géré");
} else {
if (!method_exists($this->$service, $name)) {
throw new \ErrorException("PriceUtils : la méthode " . $name . " du service " . $service . " n'existe pas.");

+ 4
- 0
ShopBundle/Services/ProductFamilyUtils.php View File

@@ -142,6 +142,10 @@ class ProductFamilyUtils
$entity->addProduct($originProduct);

foreach ($entity->getProducts() as $product) {
if($entity->getProductsQuantityAsTitle() && $product->getStatus()>=1){
$product->setTitle(str_replace('.', ',',$product->getQuantityInherited()).$product->getUnitInherited()->getWording());
}

$product->setProductFamily($entity);
$this->em->persist($product);
$entity->addProduct($product);

+ 4
- 1
ShopBundle/Services/UserUtils.php View File

@@ -9,6 +9,7 @@ use Symfony\Component\HttpFoundation\Cookie ;
use Lc\ShopBundle\Context\VisitorInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Security;

class UserUtils
{
@@ -21,7 +22,8 @@ class UserUtils
protected $cookieChecker ;

public function __construct(ParameterBagInterface $parameterBag, EntityManagerInterface $em, Utils $utils,
RequestStack $requestStack, MerchantUtilsInterface $merchantUtils, CookieChecker $cookieChecker)
RequestStack $requestStack, MerchantUtilsInterface $merchantUtils, CookieChecker $cookieChecker,
Security $security)
{
$this->em = $em ;
$this->parameterBag = $parameterBag ;
@@ -30,6 +32,7 @@ class UserUtils
$this->visitorRepository = $this->em->getRepository($this->em->getClassMetadata(VisitorInterface::class)->getName()) ;
$this->merchantUtils = $merchantUtils ;
$this->cookieChecker = $cookieChecker ;
$this->security = $security ;
}

public function getCookieNameVisitor()

+ 3
- 2
ShopBundle/Services/UtilsManager.php View File

@@ -9,6 +9,7 @@ use Lc\ShopBundle\Context\OrderUtilsInterface;
use Lc\ShopBundle\Context\PriceUtilsInterface;
use Lc\ShopBundle\Context\ProductFamilyUtilsInterface;
use Lc\ShopBundle\Context\Services\StatisticsUtilsInterface;
use Lc\ShopBundle\Context\UserUtilsInterface;
use League\Flysystem\Util;

class UtilsManager
@@ -29,7 +30,7 @@ class UtilsManager

public function __construct(
Utils $utils,
UserUtils $userUtils,
UserUtilsInterface $userUtils,
MerchantUtilsInterface $merchantUtils,
ProductFamilyUtilsInterface $productFamilyUtils,
OrderUtilsInterface $orderUtils,
@@ -63,7 +64,7 @@ class UtilsManager
return $this->utils ;
}

public function getUserUtils(): UserUtils
public function getUserUtils(): UserUtilsInterface
{
return $this->userUtils ;
}

Loading…
Cancel
Save