浏览代码

Correctif mineur

packProduct
Fab 3 年前
父节点
当前提交
19d05b8ce4
共有 12 个文件被更改,包括 62 次插入54 次删除
  1. +5
    -1
      Controller/AdminControllerTrait.php
  2. +0
    -42
      Controller/User/UserAdminController.php
  3. +4
    -1
      Definition/Field/Product/ProductCategoryFieldDefinition.php
  4. +2
    -2
      Field/AssociationField.php
  5. +22
    -0
      Repository/Product/ProductFamilyRepositoryQuery.php
  6. +1
    -0
      Repository/User/UserRepositoryQuery.php
  7. +13
    -0
      Repository/User/UserStore.php
  8. +7
    -1
      Resources/views/admin/credit/index_credithistory.html.twig
  9. +5
    -4
      Resources/views/admin/product/macro/product_family_macro.html.twig
  10. +1
    -1
      Resources/views/admin/section/field/section.html.twig
  11. +1
    -1
      Solver/Ticket/TicketSolver.php
  12. +1
    -1
      Statistic/Product/ProductsSalesStatistic.php

+ 5
- 1
Controller/AdminControllerTrait.php 查看文件

@@ -74,13 +74,17 @@ trait AdminControllerTrait

if ($this->isInstanceOf(FilterMerchantInterface::class)
|| $this->isInstanceOf(FilterMultipleMerchantsInterface::class)) {
$repositoryQuery->filterByMerchant($this->get(MerchantResolver::class)->getCurrent());
$repositoryQuery->filterByMerchant($this->getMerchantCurrent());
}

if ($sectionCurrent && $this->isInstanceOf(FilterSectionInterface::class)) {
$repositoryQuery->filterBySection($sectionCurrent);
}

if ($this->isOutOfSection() && $this->isInstanceOf(FilterSectionInterface::class)) {
$repositoryQuery->filterByMerchantViaSection($this->getMerchantCurrent());
}

return $repositoryQuery;
}


+ 0
- 42
Controller/User/UserAdminController.php 查看文件

@@ -39,49 +39,7 @@ abstract class UserAdminController extends SovUserAdminController
}
}

public function configureFields(string $pageName): iterable
{
$fields = $this->get(UserContainer::class)
->getFieldDefinition()
->setMerchant($this->getMerchantCurrent())
->getAllFields();

if ($pageName == Crud::PAGE_INDEX) {
return [
$fields['id'],
$fields['gender'],
$fields['lastname'],
$fields['firstname'],
$fields['email'],
$fields['phone'],
$fields['birthdate'],
$fields['groupUsers'],
$fields['isSaleAlwaysOpen'],
$fields['newsletters']
];
} elseif ($pageName == Crud::PAGE_EDIT || $pageName == Crud::PAGE_NEW) {
$fieldToReturn = [
$fields['id'],
$fields['gender'],
$fields['lastname'],
$fields['firstname'],
$fields['email'],
$fields['phone'],
$fields['birthdate'],
$fields['groupUsers'],
$fields['isSaleAlwaysOpen'],
$fields['newsletters'],
$fields['ticketTypesNotification']
];

if ($this->isGranted('ROLE_SUPER_ADMIN')) {
$fieldToReturn[] = $fields['roles'];
}
return $fieldToReturn;
} elseif ($pageName == Crud::PAGE_DETAIL) {
return [$fields['id']];
}
}


}

+ 4
- 1
Definition/Field/Product/ProductCategoryFieldDefinition.php 查看文件

@@ -34,7 +34,10 @@ class ProductCategoryFieldDefinition extends AbstractFieldDefinition
return array_merge($fieldArray, [
'id',
'title',
'status'
'position',
'createdAt',
'status',
'saleStatus'
]);
}


+ 2
- 2
Field/AssociationField.php 查看文件

@@ -39,14 +39,14 @@ final class AssociationField implements FieldInterface
return (new self())
->setProperty($propertyName)
->setLabel($label)
->setTemplateName('crud/field/association')
->setTemplatePath('@LcSov/adminlte/crud/field/association.html.twig')
->setFormType(EntityType::class)
->addCssClass('field-association')
->setCustomOption(self::OPTION_AUTOCOMPLETE, false)
->setCustomOption(self::OPTION_CRUD_CONTROLLER, null)
->setCustomOption(self::OPTION_WIDGET, self::WIDGET_AUTOCOMPLETE)
->setCustomOption(self::OPTION_QUERY_BUILDER_CALLABLE, null)
->setCustomOption(self::OPTION_RELATED_URL, null)
->setCustomOption(self::OPTION_RELATED_URL, 'fefefe')
->setCustomOption(self::OPTION_DOCTRINE_ASSOCIATION_TYPE, null);
}


+ 22
- 0
Repository/Product/ProductFamilyRepositoryQuery.php 查看文件

@@ -11,6 +11,7 @@ use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
{
protected bool $isJoinSections = false;
protected bool $isJoinProductCategories = false;
protected bool $isJoinProductFamilySectionProperties = false;
protected bool $isJoinProducts = false;
@@ -47,6 +48,19 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
return $this;
}

public function joinSections(bool $addSelect = true): self
{
if (!$this->isJoinSections) {
$this->isJoinSections = true;

$this->leftJoin('pfsp.section', 'section');
if ($addSelect) {
$this->addSelect('section');
}
}
return $this;
}

public function filterBySection(SectionInterface $section,bool $addSelectProductFamilySectionProperties = true)
{
$this->joinProductFamilySectionProperties($addSelectProductFamilySectionProperties);
@@ -54,6 +68,14 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
$this->andWhere('pfsp.status = 1');
}

public function filterByMerchantViaSection(MerchantInterface $merchant)
{
$this->joinProductFamilySectionProperties(false);
$this->joinSections(false);
$this->andWhereMerchant('section', $merchant);
$this->andWhere('pfsp.status = 1');
}


public function selectCount(): self
{

+ 1
- 0
Repository/User/UserRepositoryQuery.php 查看文件

@@ -12,6 +12,7 @@ class UserRepositoryQuery extends SovUserRepositoryQuery

protected $isJoinUserMerchants = false;


public function joinUserMerchants(): self
{
if (!$this->isJoinUserMerchants) {

+ 13
- 0
Repository/User/UserStore.php 查看文件

@@ -19,4 +19,17 @@ class UserStore extends SovUserStore
return $query;
}

public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

public function getJoinGroupUsers(){
$query = $this->createDefaultQuery();
$query->joinGroupUsers(true);
return $query->find();

}


}

+ 7
- 1
Resources/views/admin/credit/index_credithistory.html.twig 查看文件

@@ -2,11 +2,17 @@

{% block content_title %}
{{ 'index'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
<br />
<br/>
{{ user_merchant.user }}

{% endblock %}

{% block global_actions %}
{{ parent() }}
{% import 'admin/user/macro/user.html.twig' as user_macros %}
{{ user_macros.write_to_user_button(user_merchant.user) }}
{% endblock %}

{% block page_actions %}
{{ parent() }}
<h4>Créduit actuel : {{ user_merchant.credit|format_price|raw }}</h4>

+ 5
- 4
Resources/views/admin/product/macro/product_family_macro.html.twig 查看文件

@@ -1,14 +1,15 @@
{% extends '@LcCaracole/admin/product/macro/product_family_macro.html.twig' %}

{% macro product_family_sales_statistic(productsSalesStatistic, productFamily) %}
{% if productsSalesStatistic %}
{% if productsSalesStatistic and productsSalesStatistic|length %}
<button type="button" data-product-family="{{ productFamily.id }}"
class="lc-show-products-sales-statistic btn btn-sm"
data-toggle="tooltip" title="{{ 'showHistorySales'|sov_trans_admin_action }}"
data-url="{{ ea_url({crudAction : 'showSalesStatistic', entityId: productFamily.id }) }}">
{% for key, weekNumberQuantity in productsSalesStatistic['data']['total_sales']['data'] %}
<span class="text-success"><i
class="fa fa-calendar"></i> {{ productsSalesStatistic['label'][key] }}</span>
<span class="text-success">
<i class="fa fa-calendar"></i>
{{ productsSalesStatistic['label'][key] }}</span>
<span class="text-info"><i class="fa fa-shopping-basket"></i>
<strong>
{{ weekNumberQuantity is null ? 0 : weekNumberQuantity }}
@@ -32,4 +33,4 @@
</div>
</td>
</tr>
{% endmacro autoresize_field %}
{% endmacro autoresize_field %}

+ 1
- 1
Resources/views/admin/section/field/section.html.twig 查看文件

@@ -4,4 +4,4 @@
{{ macros_section.section_badge(item.section) }}
{% else %}
<span class="badge badge-secondary">Aucune</span>
{% endif %}
{% endif %}

+ 1
- 1
Solver/Ticket/TicketSolver.php 查看文件

@@ -7,7 +7,7 @@ use Lc\SovBundle\Solver\Ticket\TicketSolver as SovTicketSolver;

class TicketSolver extends SovTicketSolver
{
public function getTypeChoices(): array
public static function getTypeChoices(): array
{
$choices = parent::getTypeChoices();
$choicesProduct = [

+ 1
- 1
Statistic/Product/ProductsSalesStatistic.php 查看文件

@@ -54,7 +54,7 @@ class ProductsSalesStatistic extends Statistic
}

// Initialise les valeurs des données pour chaque Interval de date
public function init(SectionInterface $section, DistributionBuilder $distributionBuilder, OpeningResolver $openingResolver)
public function init(SectionInterface $section, DistributionBuilder $distributionBuilder)
{
$this->distributionList = $distributionBuilder->getDistributionListFromCurrentOrder($section, $this->nbCycle);


正在加载...
取消
保存