Browse Source

Merge branch 'develop'

master
Guillaume 2 years ago
parent
commit
867010a02c
6 changed files with 37 additions and 11 deletions
  1. +8
    -2
      Definition/SectionSettingDefinition.php
  2. +2
    -2
      EventSubscriber/User/InitUserMerchantEventSubscriber.php
  3. +2
    -2
      Repository/Reduction/ReductionCreditRepositoryQuery.php
  4. +19
    -3
      Resolver/OpeningResolver.php
  5. +5
    -1
      Resources/views/admin/order/field/distribution.html.twig
  6. +1
    -1
      Twig/StoreTwigExtension.php

+ 8
- 2
Definition/SectionSettingDefinition.php View File

const SETTING_ORDER_CLOSED_START = 'orderClosedStart'; const SETTING_ORDER_CLOSED_START = 'orderClosedStart';
const SETTING_ORDER_CLOSED_END = 'orderClosedEnd'; const SETTING_ORDER_CLOSED_END = 'orderClosedEnd';
const SETTING_ORDER_MAXIMUM_PER_CYCLE = 'orderMaximumPerCycle'; const SETTING_ORDER_MAXIMUM_PER_CYCLE = 'orderMaximumPerCycle';
/*const SETTING_COLOR_PRIMARY = 'colorPrimary';
const SETTING_COLOR_SECONDARY = 'colorSecondary';*/
const SETTING_OPENING_TEXT_CLOSED = 'openingTextClosed';


const VALUE_ORDER_STATE_DEFAULT = 'default'; const VALUE_ORDER_STATE_DEFAULT = 'default';
const VALUE_ORDER_STATE_OPEN = 'open'; const VALUE_ORDER_STATE_OPEN = 'open';
] ]
); );


$this->addSettingText(
[
'category' => self::CATEGORY_GENERAL,
'name' => self::SETTING_OPENING_TEXT_CLOSED
]
);

$this->addSettingText( $this->addSettingText(
[ [
'name' => self::SETTING_ORDER_MAXIMUM_PER_CYCLE, 'name' => self::SETTING_ORDER_MAXIMUM_PER_CYCLE,

+ 2
- 2
EventSubscriber/User/InitUserMerchantEventSubscriber.php View File



public function createUserMerchant(EntityManagerEvent $event) public function createUserMerchant(EntityManagerEvent $event)
{ {
$user = $event->getEntity();
/* $user = $event->getEntity();
$entityRepository = $this->em->getRepository(get_class($user)); $entityRepository = $this->em->getRepository(get_class($user));
if ($user instanceof UserInterface) { if ($user instanceof UserInterface) {
$existingUser = $entityRepository->findOneByEmail($user->getEmail()); $existingUser = $entityRepository->findOneByEmail($user->getEmail());
); );
$this->em->create($userMerchant); $this->em->create($userMerchant);
} }
}
}*/
} }





+ 2
- 2
Repository/Reduction/ReductionCreditRepositoryQuery.php View File

public function filterInactive() public function filterInactive()
{ {
$this->joinUsers(); $this->joinUsers();
return $this->having('COUNT(users.id) = 0');
return $this->andWhere('.users IS EMPTY');
} }


public function filterActive() public function filterActive()
{ {
$this->joinUsers(); $this->joinUsers();
return $this->having('COUNT(users.id) > 0');
return $this->andWhere('.users IS NOT EMPTY');
} }


public function joinUsers() public function joinUsers()

+ 19
- 3
Resolver/OpeningResolver.php View File



namespace Lc\CaracoleBundle\Resolver; namespace Lc\CaracoleBundle\Resolver;


use App\Entity\Section\Section;
use Lc\CaracoleBundle\Definition\SectionSettingDefinition; use Lc\CaracoleBundle\Definition\SectionSettingDefinition;
use Lc\CaracoleBundle\Model\Section\OpeningInterface; use Lc\CaracoleBundle\Model\Section\OpeningInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface; use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Model\Section\SectionModel;
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; use Lc\CaracoleBundle\Repository\Order\OrderShopStore;
use Lc\CaracoleBundle\Repository\Section\OpeningStore; use Lc\CaracoleBundle\Repository\Section\OpeningStore;
use Lc\CaracoleBundle\Solver\Section\OpeningSolver; use Lc\CaracoleBundle\Solver\Section\OpeningSolver;
return ''; return '';
} }


public function isOpenSaleOnlyComplementaryOrders(Section $section = null, UserInterface $user = null)
public function isOpenSaleOnlyComplementaryOrders(SectionInterface $section = null, UserInterface $user = null)
{ {
if (is_null($section)) { if (is_null($section)) {
$section = $this->sectionResolver->getCurrent(); $section = $this->sectionResolver->getCurrent();
&& count($orderShopsUser) > 0; && count($orderShopsUser) > 0;
} }


public function getMessageOpeningNextSale(SectionInterface $section): ?string
{
$openingTextClosed = $this->settingSolver->getSettingValue(
$section,
SectionSettingDefinition::SETTING_OPENING_TEXT_CLOSED
);
if ($openingTextClosed && strlen($openingTextClosed) > 0) {
return $openingTextClosed ;
}

$dateOpeningNextSale = $this->getFormatedDateOpeningNextSale($section);
if ($dateOpeningNextSale && strlen($dateOpeningNextSale) > 0) {
return 'Réouverture aux commandes le <u>'.$dateOpeningNextSale.'</u>' ;
}

return null;
}

public function getMessages(): array public function getMessages(): array
{ {
return $this->messages; return $this->messages;

+ 5
- 1
Resources/views/admin/order/field/distribution.html.twig View File

{% endif %} {% endif %}
{% endif %} {% endif %}


{{ labelCycleType ~ distribution.cycleNumber }}A{{ distribution.year|slice(2,2) }}
{% if cycleType == "year" %}
A{{ distribution.cycleNumber }}
{% else %}
{{ labelCycleType ~ distribution.cycleNumber }}A{{ distribution.year|slice(2,2) }}
{% endif %}

+ 1
- 1
Twig/StoreTwigExtension.php View File

return $this->merchantResolver->getUserMerchant(); return $this->merchantResolver->getUserMerchant();
} }


public function getMerchantSetting(MerchantInterface $merchant, string $settingName): string
public function getMerchantSetting(MerchantInterface $merchant, string $settingName): ?string
{ {
return $this->settingSolver->getSettingValue($merchant, $settingName); return $this->settingSolver->getSettingValue($merchant, $settingName);
} }

Loading…
Cancel
Save