Browse Source

Correctifs

packProduct
Guillaume 3 years ago
parent
commit
a78ab68f29
7 changed files with 31 additions and 20 deletions
  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 View File

} }


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


$this->entityManager->create($orderPayment); $this->entityManager->create($orderPayment);


$orderShop->addOrderReductionCart($orderReductionCart); $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->create($orderReductionCart);
$this->entityManager->flush(); $this->entityManager->flush();



+ 1
- 1
Builder/User/UserMerchantBuilder.php View File



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


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

+ 12
- 7
Form/Ticket/TicketFormType.php View File

'isValid' => true 'isValid' => true
] ]
), ),
'label' => 'field.default.order',
'label' => 'entity.default.fields.order',
'placeholder' => '-- Choisissez une commande --', 'placeholder' => '-- Choisissez une commande --',
'required' => false, 'required' => false,
'choice_label' => function ($orderShop, $key, $value) { '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', 'translation_domain' => 'admin',
] ]

+ 11
- 6
Generator/OrderReferenceGenerator.php View File

$this->settingSolver = $settingSolver; $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()) { switch ($orderShop->getSection()->getCycleType()) {
case SectionModel::CYCLE_TYPE_DAY: case SectionModel::CYCLE_TYPE_DAY:
'C' . $this->numberPad($orderShop->getCycleId(), 3); '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) . return $this->getPrefixReference($orderShop) .
'S' . $distributionDate->format('W') . 'S' . $distributionDate->format('W') .
'A' . $distributionDate->format('y'); 'A' . $distributionDate->format('y');
} }


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


public function buildReferenceCycleYear(OrderShopInterface $orderShop, \DateTime $distributionDate): string
public function buildReferenceCycleYear(OrderShopInterface $orderShop, \DateTimeInterface $distributionDate): string
{ {
return $this->getPrefixReference($orderShop) . return $this->getPrefixReference($orderShop) .
'C' . $this->numberPad($orderShop->getCycleId(), 5) . 'C' . $this->numberPad($orderShop->getCycleId(), 5) .


public function getPrefixReference(OrderShopInterface $orderShop): string 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 public function numberPad($number, $length): string

+ 1
- 1
Repository/Order/OrderShopStore.php View File



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



+ 1
- 0
Resources/translations/admin.fr.yaml View File

behaviorTaxRateChoices: behaviorTaxRateChoices:
tax-excluded: TVA exclue tax-excluded: TVA exclue
tax-included: Tva incluse tax-included: Tva incluse
order: Commande


PointSale: PointSale:
label: Point de vente label: Point de vente

+ 2
- 2
Twig/StoreTwigExtension.php View File

return $this->merchantResolver->getCurrent(); 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 public function getMerchantSetting(MerchantInterface $merchant, string $settingName): string

Loading…
Cancel
Save