Guillaume пре 3 година
родитељ
комит
a78ab68f29
7 измењених фајлова са 31 додато и 20 уклоњено
  1. +3
    -3
      Builder/Order/OrderShopBuilder.php
  2. +1
    -1
      Builder/User/UserMerchantBuilder.php
  3. +12
    -7
      Form/Ticket/TicketFormType.php
  4. +11
    -6
      Generator/OrderReferenceGenerator.php
  5. +1
    -1
      Repository/Order/OrderShopStore.php
  6. +1
    -0
      Resources/translations/admin.fr.yaml
  7. +2
    -2
      Twig/StoreTwigExtension.php

+ 3
- 3
Builder/Order/OrderShopBuilder.php Прегледај датотеку

@@ -316,7 +316,7 @@ class OrderShopBuilder
}

if ($orderShop->getOrderStatus()->getAlias() != $nextStatus) {
$orderShop = $this->changeOrderStatus($orderShop, $nextStatus);
$this->changeOrderStatus($orderShop, $nextStatus);
}

$this->entityManager->create($orderPayment);
@@ -386,8 +386,8 @@ class OrderShopBuilder

$orderShop->addOrderReductionCart($orderReductionCart);

if ($this->orderShopStore->isPositiveAmount($orderShop)
&& $this->isPositiveAmountRemainingToBePaid($orderShop)) {
if ($this->orderShopResolver->isPositiveAmount($orderShop)
&& $this->orderShopResolver->isPositiveAmountRemainingToBePaid($orderShop)) {
$this->entityManager->create($orderReductionCart);
$this->entityManager->flush();


+ 1
- 1
Builder/User/UserMerchantBuilder.php Прегледај датотеку

@@ -31,7 +31,7 @@ class UserMerchantBuilder

if (!$userMerchant) {
$userMerchantFactory = new UserMerchantFactory();
$userMerchant = $userMerchantFactory->create($user, $merchant);
$userMerchant = $userMerchantFactory->create($merchant, $user);

$this->entityManager->create($userMerchant);
$this->entityManager->flush();

+ 12
- 7
Form/Ticket/TicketFormType.php Прегледај датотеку

@@ -109,16 +109,21 @@ class TicketFormType extends AbstractType
'isValid' => true
]
),
'label' => 'field.default.order',
'label' => 'entity.default.fields.order',
'placeholder' => '-- Choisissez une commande --',
'required' => false,
'choice_label' => function ($orderShop, $key, $value) {
return 'Commande du ' . $orderShop->getValidationDate()->format(
'd/m/Y'
) . ' (' . number_format(
$this->priceSolver->getTotalWithTax($orderShop),
2
) . ' €)';

$dateString = '' ;
$dateObject = $orderShop->getValidationDate() ? $orderShop->getValidationDate() : $orderShop->getCreatedAt();

if($orderShop->getValidationDate()) {
$dateString .= 'du '.$dateObject->format('d/m/Y').' ' ;
}

return 'Commande ' . $dateString .
'(' . number_format($this->priceSolver->getTotalWithTax($orderShop), 2) .
' €)';
},
'translation_domain' => 'admin',
]

+ 11
- 6
Generator/OrderReferenceGenerator.php Прегледај датотеку

@@ -16,7 +16,7 @@ class OrderReferenceGenerator
$this->settingSolver = $settingSolver;
}

public function buildReference(OrderShopInterface $orderShop, \DateTime $distributionDate = null): string
public function buildReference(OrderShopInterface $orderShop, \DateTimeInterface $distributionDate = null): string
{
switch ($orderShop->getSection()->getCycleType()) {
case SectionModel::CYCLE_TYPE_DAY:
@@ -38,7 +38,7 @@ class OrderReferenceGenerator
'C' . $this->numberPad($orderShop->getCycleId(), 3);
}

public function buildReferenceCycleWeek(OrderShopInterface $orderShop, \DateTime $distributionDate): string
public function buildReferenceCycleWeek(OrderShopInterface $orderShop, \DateTimeInterface $distributionDate): string
{
return $this->getPrefixReference($orderShop) .
'S' . $distributionDate->format('W') .
@@ -46,15 +46,17 @@ class OrderReferenceGenerator
'A' . $distributionDate->format('y');
}

public function buildReferenceCycleMonth(OrderShopInterface $orderShop, \DateTime $distributionDate): string
{
public function buildReferenceCycleMonth(
OrderShopInterface $orderShop,
\DateTimeInterface $distributionDate
): string {
return $this->getPrefixReference($orderShop) .
'M' . $distributionDate->format('m') .
'C' . $this->numberPad($orderShop->getCycleId(), 4) .
'A' . $distributionDate->format('y');
}

public function buildReferenceCycleYear(OrderShopInterface $orderShop, \DateTime $distributionDate): string
public function buildReferenceCycleYear(OrderShopInterface $orderShop, \DateTimeInterface $distributionDate): string
{
return $this->getPrefixReference($orderShop) .
'C' . $this->numberPad($orderShop->getCycleId(), 5) .
@@ -63,7 +65,10 @@ class OrderReferenceGenerator

public function getPrefixReference(OrderShopInterface $orderShop): string
{
return $this->settingSolver->getSettingValue($orderShop->getSection(), SectionSettingDefinition::SETTING_REFERENCE_PREFIX);
return ''.$this->settingSolver->getSettingValue(
$orderShop->getSection(),
SectionSettingDefinition::SETTING_REFERENCE_PREFIX
);
}

public function numberPad($number, $length): string

+ 1
- 1
Repository/Order/OrderShopStore.php Прегледај датотеку

@@ -80,7 +80,7 @@ class OrderShopStore extends AbstractStore

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->orderBy('id');
$query->orderBy('id', 'DESC');
return $query;
}


+ 1
- 0
Resources/translations/admin.fr.yaml Прегледај датотеку

@@ -59,6 +59,7 @@ entity:
behaviorTaxRateChoices:
tax-excluded: TVA exclue
tax-included: Tva incluse
order: Commande

PointSale:
label: Point de vente

+ 2
- 2
Twig/StoreTwigExtension.php Прегледај датотеку

@@ -123,9 +123,9 @@ class StoreTwigExtension extends AbstractExtension
return $this->merchantResolver->getCurrent();
}

public function getUserMerchantCurrent(): UserMerchantInterface
public function getUserMerchantCurrent(): ?UserMerchantInterface
{
$this->merchantResolver->getUserMerchant();
return $this->merchantResolver->getUserMerchant();
}

public function getMerchantSetting(MerchantInterface $merchant, string $settingName): string

Loading…
Откажи
Сачувај