@@ -28,6 +28,7 @@ class DashboardAdminAdminController extends SovDashboardController | |||
$assets->addWebpackEncoreEntry('carac-common'); | |||
$assets->addWebpackEncoreEntry('carac-switch-merchant'); | |||
$assets->addWebpackEncoreEntry('carac-duplicate'); | |||
$assets->addWebpackEncoreEntry('carac-product'); | |||
return $assets; | |||
} |
@@ -27,6 +27,7 @@ abstract class ProductCategoryAdminController extends AbstractAdminController | |||
[ | |||
FormField::addPanel('general'), | |||
TextField::new('title'), | |||
NumberField::new('position')->hideOnForm(), | |||
AssociationField::new('parent'), | |||
CKEditorField::new('description'), | |||
BooleanField::new('saleStatus'), |
@@ -2,19 +2,42 @@ | |||
namespace Lc\CaracoleBundle\Controller\Product; | |||
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\CaracoleBundle\Container\Order\OrderShopContainer; | |||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | |||
use Lc\CaracoleBundle\Field\Address\AddressField; | |||
use Lc\CaracoleBundle\Resolver\SectionResolver; | |||
use Lc\SovBundle\Controller\AbstractAdminController; | |||
use Lc\SovBundle\Field\BooleanField; | |||
use Lc\SovBundle\Field\CKEditorField; | |||
use Lc\SovBundle\Field\StatusField; | |||
use Symfony\Component\HttpFoundation\RequestStack; | |||
use Symfony\Component\HttpFoundation\Response; | |||
abstract class ProductFamilyAdminController extends AbstractAdminController | |||
{ | |||
use AdminControllerTrait; | |||
public function showSalesStatistic(AdminContext $context) | |||
{ | |||
$productFamily = $context->getEntity()->getInstance(); | |||
$currentSection = $this->get(SectionResolver::class)->getCurrent(); | |||
$productsSalesStatistic = $this->get(OrderShopContainer::class)->getBuilder()->getProductsSalesStatistic($currentSection, $productFamily, 16); | |||
$parameters = array( | |||
'productFamily' => $productFamily, | |||
'productsSalesStatistic' => $productsSalesStatistic | |||
); | |||
//TODO flashMessages ??? | |||
$response['flashMessages'] = [];//$this->utils->getFlashMessages(); | |||
$response['data'] = $this->render('@LcCaracole/admin/product/modal/show_products_sales_statistic.html.twig', $parameters)->getContent(); | |||
$response['statistics'] = $productsSalesStatistic; | |||
return new Response(json_encode($response)); | |||
} | |||
} |
@@ -71,6 +71,13 @@ final class AssociationField implements FieldInterface | |||
return $this; | |||
} | |||
public function setFilterIsOnline(): self | |||
{ | |||
$this->queryBuilderParameters['status'] = 1; | |||
return $this; | |||
} | |||
public function initQueryBuilder(): self | |||
{ | |||
$param = $this->queryBuilderParameters; | |||
@@ -81,11 +88,16 @@ final class AssociationField implements FieldInterface | |||
if (isset($param['section'])) { | |||
$qb->andWhereSection('e',$param['section']); | |||
} | |||
if (isset($param['merchant'])) { | |||
$qb->andWhereMerchant('e',$param['merchant']); | |||
} | |||
if (isset($param['status'])) { | |||
$qb->andWhere('e.status = :status')->setParameter('status', $param['status']); | |||
} | |||
$qb->orderBy('e.position', 'ASC'); | |||
/*if (isset($param['devAlias'])) { | |||
$qb->andWhere('e.devAlias = :devAlias')->setParameter( | |||
'devAlias', |
@@ -6,9 +6,7 @@ namespace Lc\CaracoleBundle\Model\Product; | |||
use Doctrine\Common\Collections\Collection; | |||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
*/ | |||
interface ProductCategoryInterface | |||
{ | |||
public function getSection(): SectionInterface; |
@@ -523,6 +523,7 @@ class OrderShopStore extends AbstractStore | |||
->selectSum() | |||
->groupBy('.cycleNumber, product.id'); | |||
return $query->find(); | |||
} | |||
@@ -36,16 +36,14 @@ class ReductionCatalogStore extends AbstractStore | |||
return $query; | |||
} | |||
/* | |||
public function getByProductFamily(ProductFamilyInterface $productFamily, $query = null) | |||
{ | |||
$query = $this->createDefaultQuery($query); | |||
$query | |||
->filterProductFamily($productFamily) | |||
->filterIsOnline(); | |||
->filterProductFamily($productFamily); | |||
return $query->findOne(); | |||
} | |||
*/ | |||
} | |||
} |
@@ -0,0 +1,65 @@ | |||
jQuery(document).ready(function () { | |||
initBtnShowTotalOrderProduct(); | |||
}); | |||
function initBtnShowTotalOrderProduct(){ | |||
$('.lc-show-products-sales-statistic').unbind('click').on('click', function (){ | |||
$btn = $(this); | |||
var url = $(this).data('url'); | |||
$('#modal-products-sales-statistic').remove(); | |||
$.ajax({ | |||
url: url, | |||
method: "POST", | |||
dataType: "json", | |||
success: function (response) { | |||
$('body').append(response.data); | |||
$('#modal-products-sales-statistic').modal('show'); | |||
initModalProductsSalesStatistic(response.statistics); | |||
} | |||
}); | |||
}); | |||
} | |||
function initModalProductsSalesStatistic(statistics) { | |||
var chart = null; | |||
$('.btn-products-sales-statistic').off('click'); | |||
$('.btn-products-sales-statistic').on('click', function () { | |||
$('.table-products-sales-statistic').hide(); | |||
$('.btn-products-sales-statistic').addClass('btn-secondary').removeClass('btn-primary'); | |||
$(this).removeClass('btn-secondary').addClass('btn-primary'); | |||
$('#table-products-sales-statistic-'+$(this).data('property-name')).show() | |||
if (chart) chart.destroy(); | |||
$(this).removeClass('btn-secondary'); | |||
chart = drawProductsSalesStatistic(statistics,$(this).data('property-name')) | |||
}); | |||
$('.btn-products-sales-statistic').first().click(); | |||
} | |||
function drawProductsSalesStatistic(statictics, propertyName) { | |||
var options = { | |||
bezierCurve : false, | |||
tooltips: { | |||
callbacks: { | |||
label: (item) => item.yLabel , | |||
}, | |||
}, | |||
}; | |||
chart = new Chart(document.getElementById("chart"), { | |||
"type": "line", | |||
"data": { | |||
"labels": Object.values(statictics.label), | |||
"datasets": [{ | |||
"label": "Vente de produits / semaine", | |||
"data": Object.values(statictics.data[propertyName].data), | |||
"fill": false, | |||
"borderColor": "rgb(75, 192, 192)", | |||
"lineTension": 0.1 | |||
}] | |||
}, | |||
"options": options | |||
}); | |||
return chart; | |||
} |
@@ -145,6 +145,10 @@ entity: | |||
ProductCategory: | |||
label: Catégorie | |||
label_plurial: Catégories | |||
ProductFamily: | |||
fields: | |||
priceWithTax: Prix de vente | |||
sales: Historique des ventes | |||
form: | |||
user_merchant: |
@@ -0,0 +1 @@ | |||
{{ price_solver.getPriceWithTax(entity.instance)|format_price|raw }} |
@@ -0,0 +1,3 @@ | |||
{% import '@LcCaracole/admin/product/macro/product_family_macro.html.twig' as pfm %} | |||
{% set section_current = section_container.resolver.getCurrent() %} | |||
{{ pfm.product_family_sales_statistic(order_shop_container.builder.getProductsSalesStatistic(section_current, entity.instance, 2), entity.instance) }} |
@@ -0,0 +1,34 @@ | |||
{% extends '@LcCaracole/admin/product/macro/product_family_macro.html.twig' %} | |||
{% macro product_family_sales_statistic(productsSalesStatistic, productFamily) %} | |||
{% if productsSalesStatistic %} | |||
<button type="button" data-product-family="{{ productFamily.id }}" | |||
class="lc-show-products-sales-statistic btn btn-sm" | |||
data-toggle="tooltip" title="{{ 'action.product.statSales'|trans }}" | |||
data-url="{{ ea_url({crudAction : 'showSalesStatistic', entityId: productFamily.id }) }}"> | |||
{% for weekNumber, weekNumberQuantity in productsSalesStatistic['data']['total_sales']['data']|reverse(true) %} | |||
<span class="text-success"><i class="fa fa-calendar"></i> {{ weekNumber }}</span> | |||
<span class="text-info"><i class="fa fa-shopping-basket"></i> | |||
<strong> | |||
{{ weekNumberQuantity is null ? 0 : weekNumberQuantity }} | |||
{% if productFamily and (productFamily.behaviorDisplaySale== constant('App\\Entity\\Product\\ProductFamily::BEHAVIOR_DISPLAY_SALE_BY_MEASURE')) %} | |||
{{ productFamily.unit.unitReference }} | |||
{% endif %} | |||
</strong> | |||
</span> | |||
<br/> | |||
{% endfor %} | |||
</button> | |||
{% endif %} | |||
{% endmacro product_family_sales_statistic %} | |||
{% macro autoresize_field(field) %} | |||
<tr> | |||
<td>{{ form_label(field) }}</td> | |||
<td> | |||
<div class="autoresize"> | |||
{{ form_widget(field, {'attr' : {rows : '1'}}) }} | |||
</div> | |||
</td> | |||
</tr> | |||
{% endmacro autoresize_field %} |
@@ -0,0 +1,95 @@ | |||
{% embed "@LcSov/adminlte/embed/modal.twig" %} | |||
{% import '@LcCaracole/admin/product/macro/product_family_macro.html.twig' as pfm %} | |||
{% trans_default_domain 'lcshop' %} | |||
{% block size %}modal-lg{% endblock %} | |||
{% block id %}modal-products-sales-statistic{% endblock %} | |||
{% block title %}Total ventes/semaines : {{ productFamily.title }}{% endblock %} | |||
{% block body %} | |||
<div class="row"> | |||
<div class="col-10"> | |||
{{ _self.btn_pss(productsSalesStatistic, productFamily, 'Global', 'total_sales') }} | |||
{% if productFamily.activeProducts %} | |||
{% for product in productFamily.products %} | |||
{% if product.status >= 0 %} | |||
{{ _self.btn_pss(productsSalesStatistic, productFamily, product.title , product.id ) }} | |||
{% endif %} | |||
{% endfor %} | |||
{% endif %} | |||
</div> | |||
<!-- | |||
<div class="col-2"> | |||
<h5>Stock actuel</h5> | |||
{#{% include '@LcShop/backend/default/field/product_family_available_quantity.html.twig' with {item:productFamily, value: productFamily.availableQuantity} %}#} | |||
</div> | |||
--> | |||
<div class="col-12"> | |||
{{ _self.table_pss(productsSalesStatistic, productFamily, 'total_sales') }} | |||
{% for product in productFamily.products %} | |||
{% if product.status >= 0 %} | |||
{{ _self.table_pss(productsSalesStatistic, productFamily, product.id) }} | |||
{% endif %} | |||
{% endfor %} | |||
</div> | |||
<div class="col-12"> | |||
<canvas id="chart"></canvas> | |||
</div> | |||
</div> | |||
{% endblock %} | |||
{% block footer %}{% endblock %} | |||
{% macro btn_pss(productsSalesStatistic,productFamily, label, propertyName) %} | |||
<button style="margin-bottom: 10px;" type="button" data-property-name="{{ propertyName }}" | |||
class="btn btn-sm btn-primary btn-products-sales-statistic"> | |||
{{ label }} <br/> | |||
{{ productsSalesStatistic['data'][propertyName]['average_period'] }} | |||
{% if propertyName== 'total_sales' and productFamily and (productFamily.behaviorDisplaySale== constant('Lc\\CaracoleBundle\\Model\\Product\\ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE')) %} | |||
{{ productFamily.unit.unitReference }} | |||
{% endif %} | |||
<br/> | |||
<small>(en moyenne)</small> | |||
</button> | |||
{% endmacro btn_pss %} | |||
{% macro table_pss(productsSalesStatistic, productFamily, propertyName) %} | |||
<div style="margin:20px 0;" class="table-products-sales-statistic" id="table-products-sales-statistic-{{ propertyName }}"> | |||
<table class="table table-bordered table-striped"> | |||
<tbody> | |||
<tr> | |||
<th class="text-success"> | |||
<i class="fa fa-calendar"></i> Semaine | |||
</th> | |||
{% for weekNumber, weekNumberQuantity in productsSalesStatistic['data'][propertyName]['data'] %} | |||
<td class="text-success align-right"> | |||
{{ weekNumber }} | |||
</td> | |||
{% endfor %} | |||
</tr> | |||
<tr> | |||
<th class="text-info"> | |||
<i class="fa fa-shopping-basket"></i> Commandés | |||
</th> | |||
{% for weekNumber, weekNumberQuantity in productsSalesStatistic['data'][propertyName]['data'] %} | |||
<td class="text-info align-right"> | |||
<strong> | |||
{{ weekNumberQuantity is null ? 0 : weekNumberQuantity }} | |||
{% if propertyName== 'total_sales' and productFamily and (productFamily.behaviorDisplaySale== constant('Lc\\CaracoleBundle\\Model\\Product\\ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE')) %} | |||
{{ productFamily.unit.unitReference }} | |||
{% endif %} | |||
</strong> | |||
</td> | |||
{% endfor %} | |||
</tr> | |||
</tbody> | |||
</table> | |||
</div> | |||
{% endmacro table_pss %} | |||
{% endembed %} | |||
@@ -2,8 +2,12 @@ | |||
namespace Lc\CaracoleBundle\Solver\Product; | |||
use Doctrine\Common\Collections\ArrayCollection; | |||
use Doctrine\Common\Collections\Collection; | |||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | |||
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | |||
use Lc\CaracoleBundle\Model\Product\ProductInterface; | |||
use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface; | |||
use Lc\CaracoleBundle\Solver\Price\PriceSolver; | |||
class ProductFamilySolver | |||
@@ -39,6 +43,7 @@ class ProductFamilySolver | |||
public function getCheapestProduct(ProductFamilyInterface $productFamily) | |||
{ | |||
$priceSolver = $this->priceSolver; | |||
return $this->getCheapestOrMostExpensiveProduct( | |||
$productFamily, | |||
function ($a, $b) use ($priceSolver) { | |||
@@ -53,6 +58,7 @@ class ProductFamilySolver | |||
public function getCheapestProductByRefUnit(ProductFamilyInterface $productFamily) | |||
{ | |||
$priceSolver = $this->priceSolver; | |||
return $this->getCheapestOrMostExpensiveProduct( | |||
$productFamily, | |||
function ($a, $b) use ($priceSolver) { | |||
@@ -67,6 +73,7 @@ class ProductFamilySolver | |||
public function getMostExpensiveProductByRefUnit(ProductFamilyInterface $productFamily) | |||
{ | |||
$priceSolver = $this->priceSolver; | |||
return $this->getCheapestOrMostExpensiveProduct( | |||
$productFamily, | |||
function ($a, $b) use ($priceSolver) { | |||
@@ -84,13 +91,14 @@ class ProductFamilySolver | |||
$returnSelfIfNotActiveProducts | |||
) { | |||
if ($productFamily->getActiveProducts()) { | |||
$products = $productFamily->getProductsOnline()->getValues(); | |||
$products = $this->getProductsOnline($productFamily)->getValues(); | |||
if (count($products) > 0) { | |||
usort($products, $comparisonFunction); | |||
return $products[0]; | |||
} | |||
} else { | |||
return $productFamily->getOriginProduct(); | |||
return $this->getOriginProduct($returnSelfIfNotActiveProducts); | |||
} | |||
if ($returnSelfIfNotActiveProducts) { | |||
return $productFamily; | |||
@@ -99,14 +107,310 @@ class ProductFamilySolver | |||
} | |||
} | |||
public function countProductFamiliesOrganizedByParentCategory(array $categories): int | |||
public function getAvailableQuantityInherited(ProductFamilyInterface $productFamily) | |||
{ | |||
$count = 0; | |||
foreach ($categories as $category) { | |||
$count += count($category['products']); | |||
$availableQuantity = 0; | |||
switch ($productFamily->getBehaviorCountStock()) { | |||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE : | |||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY : | |||
$availableQuantity = $productFamily->getAvailableQuantity(); | |||
break; | |||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT : | |||
foreach ($this->getProductsOnline($productFamily) as $product) { | |||
$availableQuantity += $product->getAvailableQuantityInherited(); | |||
} | |||
break; | |||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED : | |||
$availableQuantity = false; | |||
break; | |||
} | |||
return $availableQuantity; | |||
} | |||
public function getTaxRateInherited(ProductFamilyInterface $productFamily) | |||
{ | |||
if ($productFamily->getTaxRate()) { | |||
return $productFamily->getTaxRate(); | |||
} else { | |||
return $productFamily->getSection()->getMerchant()->getTaxRate(); | |||
} | |||
} | |||
public function getProductsOnline(ProductFamilyInterface $productFamily): Collection | |||
{ | |||
$products = $productFamily->getProducts(); | |||
$productsOnlineArray = new ArrayCollection(); | |||
foreach ($products as $product) { | |||
if ($product->getStatus() == 1 && $product->getOriginProduct() != true) { | |||
$productsOnlineArray[] = $product; | |||
} | |||
} | |||
return $productsOnlineArray; | |||
} | |||
public function getReductionCatalogInherited(ProductFamilyInterface $productFamily): ?ReductionCatalogInterface | |||
{ | |||
return $productFamily->getReductionCatalog(); | |||
} | |||
public function getProductCategoryParent(ProductFamilyInterface $productFamily) | |||
{ | |||
$productCategories = $productFamily->getProductCategories(); | |||
if (count($productCategories) > 0) { | |||
return $productCategories[0]->getParent(); | |||
} | |||
return false; | |||
} | |||
public function getProductCategoryChild(ProductFamilyInterface $productFamily) | |||
{ | |||
$productCategories = $productFamily->getProductCategories(); | |||
foreach ($productCategories as $productCategory) { | |||
if ($productCategory->getParent()) { | |||
return $productCategory; | |||
} | |||
} | |||
return false; | |||
} | |||
public function isPropertyNoveltyOnline(ProductFamilyInterface $productFamily): ?bool | |||
{ | |||
if ($productFamily->getPropertyNoveltyExpirationDate()) { | |||
$now = new \DateTime(); | |||
if ($now <= $productFamily->getPropertyNoveltyExpirationDate()) { | |||
return true; | |||
} | |||
} | |||
return false; | |||
} | |||
public function countProperties(ProductFamilyInterface $productFamily): bool | |||
{ | |||
$count = 0; | |||
$count += (int)strlen($productFamily->getPropertyOrganicLabel()) > 0; | |||
$count += (int)strlen($productFamily->getPropertyWeight()) > 0; | |||
$count += (int)strlen($productFamily->getPropertyFragrances()) > 0; | |||
$count += (int)strlen($productFamily->getPropertyComposition()) > 0; | |||
$count += (int)strlen($productFamily->getPropertyAllergens()) > 0; | |||
$count += (int)strlen($productFamily->getPropertyAlcoholLevel()) > 0; | |||
$count += (int)strlen($productFamily->getPropertyCharacteristics()) > 0; | |||
$count += (int)strlen($productFamily->getPropertyFeature()) > 0; | |||
$count += (int)strlen($productFamily->getPropertyPackaging()) > 0; | |||
$count += (int)strlen($productFamily->getPropertyQuantity()) > 0; | |||
$count += (int)strlen($productFamily->getPropertyVariety()) > 0; | |||
$count += (int)($productFamily->getPropertyExpirationDate() != null); | |||
return $count; | |||
} | |||
} | |||
public function hasProductsWithVariousWeight(ProductFamilyInterface $productFamily) | |||
{ | |||
if ($productFamily->getActiveProducts()) { | |||
$arrayCountProducts = []; | |||
$products = $this->getProductsOnline($productFamily); | |||
foreach ($products as $product) { | |||
$titleProduct = $product->getTitleInherited(); | |||
if (!isset($arrayCountProducts[$titleProduct])) { | |||
$arrayCountProducts[$titleProduct] = []; | |||
} | |||
if (!in_array($product->getQuantityLabelInherited(), $arrayCountProducts[$titleProduct])) { | |||
$arrayCountProducts[$titleProduct][] = $product->getQuantityLabelInherited(); | |||
} | |||
if (count($arrayCountProducts[$titleProduct]) > 1) { | |||
return true; | |||
} | |||
} | |||
} | |||
return false; | |||
} | |||
public function getProductsGroupByTitle(ProductFamilyInterface $productFamily): array | |||
{ | |||
$arrayProductsGroupByTitle = []; | |||
$products = $this->getProductsOnline($productFamily); | |||
foreach ($products as $product) { | |||
if ($product->getStatus() == 1) { | |||
$titleProduct = $product->getTitleInherited(); | |||
if (!isset($arrayProductsGroupByTitle[$titleProduct])) { | |||
$arrayProductsGroupByTitle[$titleProduct] = []; | |||
} | |||
$arrayProductsGroupByTitle[$titleProduct][] = $product; | |||
} | |||
} | |||
return $arrayProductsGroupByTitle; | |||
} | |||
public function getOriginProduct(ProductFamilyInterface $productFamily): ProductInterface | |||
{ | |||
$products = $productFamily->getProducts(); | |||
foreach ($products as $product) { | |||
if ($product->getOriginProduct()) { | |||
return $product; | |||
} | |||
} | |||
} | |||
public function getOriginProductOnline(ProductFamilyInterface $productFamily): ?ProductInterface | |||
{ | |||
$originProduct = $this->getOriginProduct($productFamily); | |||
if ($originProduct->getStatus() == 1) { | |||
return $originProduct; | |||
} else { | |||
return null; | |||
} | |||
} | |||
public function hasOneProductOnline(ProductFamilyInterface $productFamily) | |||
{ | |||
if (($productFamily->getActiveProducts() && count($this->getProductsOnline($productFamily)) > 0) | |||
|| (!$productFamily->getActiveProducts() && $this->getOriginProduct($productFamily))) { | |||
return true; | |||
} | |||
return false; | |||
} | |||
public function getFieldBuyingPrice(ProductFamilyInterface $productFamily): string | |||
{ | |||
if ($productFamily->getBehaviorPrice() === ProductFamilyModel::BEHAVIOR_PRICE_BY_PIECE) { | |||
return 'buyingPrice'; | |||
} elseif ($productFamily->getBehaviorPrice() === ProductFamilyModel::BEHAVIOR_PRICE_BY_REFERENCE_UNIT) { | |||
return 'buyingPriceByRefUnit'; | |||
} | |||
} | |||
public function getFieldPrice(ProductFamilyInterface $productFamily): string | |||
{ | |||
if ($productFamily->getBehaviorPrice() === ProductFamilyModel::BEHAVIOR_PRICE_BY_PIECE) { | |||
return 'price'; | |||
} elseif ($productFamily->getBehaviorPrice() === ProductFamilyModel::BEHAVIOR_PRICE_BY_REFERENCE_UNIT) { | |||
return 'priceByRefUnit'; | |||
} | |||
} | |||
public function getBehaviorPriceInherited(ProductFamilyInterface $productFamily) :string | |||
{ | |||
return $productFamily->getBehaviorPrice(); | |||
} | |||
public function getBehaviorCountStockChoices(): array | |||
{ | |||
return [ | |||
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE, | |||
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT, | |||
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY, | |||
ProductFamilyModel::BEHAVIOR_COUNT_STOCK_UNLIMITED, | |||
]; | |||
} | |||
public function getBehaviorDisplaySaleChoices(): array | |||
{ | |||
return [ | |||
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_MEASURE, | |||
ProductFamilyModel::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY, | |||
]; | |||
} | |||
public function getBehaviorStockCycleChoices(): array | |||
{ | |||
return [ | |||
ProductFamilyModel::BEHAVIOR_STOCK_CYCLE_NON_RENEWABLE, | |||
ProductFamilyModel::BEHAVIOR_STOCK_CYCLE_RENEWABLE, | |||
ProductFamilyModel::BEHAVIOR_STOCK_CYCLE_RENEWABLE_VALIDATION, | |||
]; | |||
} | |||
public function getWaringMessageTypeChoices(): array | |||
{ | |||
return [ | |||
ProductFamilyModel::WARNING_MESSAGE_TYPE_ERROR, | |||
ProductFamilyModel::WARNING_MESSAGE_TYPE_INFO, | |||
ProductFamilyModel::WARNING_MESSAGE_TYPE_SUCCESS, | |||
ProductFamilyModel::WARNING_MESSAGE_TYPE_WARNING, | |||
]; | |||
} | |||
public function getBehaviorAddToCartChoices(): array | |||
{ | |||
return [ | |||
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_MULTIPLE, | |||
ProductFamilyModel::BEHAVIOR_ADD_TO_CART_SIMPLE, | |||
]; | |||
} | |||
public function getBehaviorPriceChoices(): array | |||
{ | |||
return [ | |||
ProductFamilyModel::BEHAVIOR_PRICE_BY_PIECE, | |||
ProductFamilyModel::BEHAVIOR_PRICE_BY_REFERENCE_UNIT, | |||
]; | |||
} | |||
public function getPropertyOrganicLabelChoices(): array | |||
{ | |||
return [ | |||
ProductFamilyModel::PROPERTY_ORGANIC_LABEL_AB, | |||
ProductFamilyModel::PROPERTY_ORGANIC_LABEL_NP, | |||
ProductFamilyModel::PROPERTY_ORGANIC_LABEL_HVE, | |||
ProductFamilyModel::PROPERTY_ORGANIC_LABEL_TVVR, | |||
]; | |||
} | |||
public function getTypeExpirationDateChoices(): array | |||
{ | |||
return [ | |||
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLC, | |||
ProductFamilyModel::TYPE_EXPIRATION_DATE_DDM, | |||
ProductFamilyModel::TYPE_EXPIRATION_DATE_DLUO, | |||
]; | |||
} | |||
public function getBehaviorExpirationDateChoices(): array | |||
{ | |||
return [ | |||
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY, | |||
ProductFamilyModel::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT, | |||
]; | |||
} | |||
} | |||
@@ -49,7 +49,7 @@ class ProductsSalesStatistic extends Statistic | |||
// Initialise les valeurs des données pour chaque Interval de date | |||
public function init(SectionInterface $section, OrderShopSolver $orderShopSolver, OpeningResolver $openingResolver) | |||
{ | |||
$currentCycleNumber = $orderShopSolver->getCycleNumberCurrentOrder(); | |||
$currentCycleNumber = $orderShopSolver->getCycleNumberCurrentOrder($section); | |||
if ($openingResolver->isOpenSale($section, null,OpeningResolver::OPENING_CONTEXT_BACKEND) == false && date('w') > 2) { | |||
$currentCycleNumber = $currentCycleNumber - 1; | |||
} |