@@ -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(); | |||
@@ -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(); |
@@ -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', | |||
] |
@@ -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 |
@@ -80,7 +80,7 @@ class OrderShopStore extends AbstractStore | |||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||
{ | |||
$query->orderBy('id'); | |||
$query->orderBy('id', 'DESC'); | |||
return $query; | |||
} | |||
@@ -59,6 +59,7 @@ entity: | |||
behaviorTaxRateChoices: | |||
tax-excluded: TVA exclue | |||
tax-included: Tva incluse | |||
order: Commande | |||
PointSale: | |||
label: Point de vente |
@@ -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 |