public function buildForm(FormBuilderInterface $builder, array $options) | public function buildForm(FormBuilderInterface $builder, array $options) | ||||
{ | { | ||||
$data = $options['data']; | |||||
$builder | $builder | ||||
->add('quantityOrder', NumberType::class) | ->add('quantityOrder', NumberType::class) | ||||
->add('product', HiddenType::class); | ->add('product', HiddenType::class); | ||||
public function configureOptions(OptionsResolver $resolver) | public function configureOptions(OptionsResolver $resolver) | ||||
{ | { | ||||
$resolver->setDefaults([ | |||||
'data_class' => $this->entityManager->getEntityName( | |||||
OrderProductInterface::class | |||||
), | |||||
]); | |||||
$resolver->setDefaults( | |||||
[ | |||||
'data_class' => $this->entityManager->getEntityName( | |||||
OrderProductInterface::class | |||||
), | |||||
] | |||||
); | |||||
} | } | ||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Form\Reduction; | |||||
use Lc\CaracoleBundle\Model\Config\TaxRateModel; | |||||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||||
use Symfony\Component\Form\AbstractType; | |||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||||
use Symfony\Component\Form\FormBuilderInterface; | |||||
use Symfony\Component\Form\FormEvent; | |||||
use Symfony\Component\Form\FormEvents; | |||||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||||
class BehaviorTaxRateType extends AbstractType | |||||
{ | |||||
protected TranslatorAdmin $translatorAdmin; | |||||
public function __construct(TranslatorAdmin $translatorAdmin) | |||||
{ | |||||
$this->translatorAdmin = $translatorAdmin; | |||||
} | |||||
public function buildForm(FormBuilderInterface $builder, array $options) | |||||
{ | |||||
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { | |||||
$builder = $event->getForm()->getParent(); | |||||
$builder->add('behaviorTaxRate', ChoiceType::class, [ | |||||
'required' => false, | |||||
'empty_data' => TaxRateModel::BEHAVIOR_TAX_RATE_INCLUDED, | |||||
'choices' => $this->translatorAdmin->transChoices( | |||||
TaxRateModel::getBehaviorTaxRateChoices(), | |||||
'TaxRate', | |||||
'behaviorTaxRate' | |||||
) | |||||
]); | |||||
}); | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Form\Reduction; | |||||
use Symfony\Component\Form\AbstractType; | |||||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | |||||
use Symfony\Component\Form\FormBuilderInterface; | |||||
use Symfony\Component\Form\FormEvent; | |||||
use Symfony\Component\Form\FormEvents; | |||||
class ValueType extends AbstractType | |||||
{ | |||||
public function buildForm(FormBuilderInterface $builder, array $options) | |||||
{ | |||||
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { | |||||
$builder = $event->getForm()->getParent(); | |||||
$builder->add('value', NumberType::class, [ | |||||
'required' => false | |||||
]); | |||||
}); | |||||
} | |||||
} |
{ | { | ||||
use PayoffTrait; | use PayoffTrait; | ||||
const TYPE_CREDIT = 'credit'; | const TYPE_CREDIT = 'credit'; | ||||
const TYPE_DEBIT = 'debit'; | const TYPE_DEBIT = 'debit'; | ||||
const MEAN_PAYMENT_CREDIT_CARD = 'cb'; | |||||
const MEAN_PAYMENT_CHEQUE = 'cheque'; | |||||
const MEAN_PAYMENT_CREDIT = 'credit'; | |||||
const MEAN_PAYMENT_TRANSFER = 'transfer'; | |||||
const MEAN_PAYMENT_CASH = 'cash'; | |||||
const MEAN_PAYMENT_GIFT = 'transfer-gift'; | |||||
/** | /** | ||||
* @ORM\Column(type="float", nullable=true) | * @ORM\Column(type="float", nullable=true) | ||||
*/ | */ | ||||
*/ | */ | ||||
protected $orderRefund; | protected $orderRefund; | ||||
public function __toString(){ | |||||
public function __toString() | |||||
{ | |||||
//Todo a écrire | //Todo a écrire | ||||
return $this->getType(); | return $this->getType(); | ||||
} | } |
abstract class OrderPaymentModel extends AbstractLightEntity implements OrderPayoffInterface | abstract class OrderPaymentModel extends AbstractLightEntity implements OrderPayoffInterface | ||||
{ | { | ||||
use OrderPayoffTrait; | use OrderPayoffTrait; | ||||
const MEAN_PAYMENT_CREDIT_CARD = 'cb'; | |||||
const MEAN_PAYMENT_CHEQUE = 'cheque'; | |||||
const MEAN_PAYMENT_CREDIT = 'credit'; | |||||
const MEAN_PAYMENT_TRANSFER = 'transfer'; | |||||
const MEAN_PAYMENT_CASH = 'cash'; | |||||
const MEAN_PAYMENT_GIFT = 'transfer-gift'; | |||||
} | } |
const DELIVERY_TYPE_HOME = 'home'; | const DELIVERY_TYPE_HOME = 'home'; | ||||
const DELIVERY_TYPE_POINTSALE = 'point-sale'; | const DELIVERY_TYPE_POINTSALE = 'point-sale'; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="orderShops", fetch="EAGER") | * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="orderShops", fetch="EAGER") | ||||
*/ | */ |
<?php | |||||
namespace Lc\CaracoleBundle\Solver\Order; | |||||
use Lc\CaracoleBundle\Model\Order\OrderPaymentModel; | |||||
class OrderPaymentSolver | |||||
{ | |||||
public function getMeanPaymentChoices() | |||||
{ | |||||
return [ | |||||
OrderPaymentModel::MEAN_PAYMENT_CREDIT_CARD, | |||||
OrderPaymentModel::MEAN_PAYMENT_CHEQUE, | |||||
OrderPaymentModel::MEAN_PAYMENT_CREDIT, | |||||
OrderPaymentModel::MEAN_PAYMENT_TRANSFER, | |||||
OrderPaymentModel::MEAN_PAYMENT_CASH, | |||||
OrderPaymentModel::MEAN_PAYMENT_GIFT, | |||||
]; | |||||
} | |||||
} |
class OrderShopPriceSolver | class OrderShopPriceSolver | ||||
{ | { | ||||
//TODO vérifier si les round sont cohérents | |||||
use PriceSolverTrait; | use PriceSolverTrait; | ||||
protected OrderProductPriceSolver $orderProductPriceResolver; | protected OrderProductPriceSolver $orderProductPriceResolver; | ||||
foreach ($orderShop->getOrderProducts() as $orderProduct) { | foreach ($orderShop->getOrderProducts() as $orderProduct) { | ||||
$total += $this->orderProductPriceResolver->getTotalWithReduction($orderProduct); | $total += $this->orderProductPriceResolver->getTotalWithReduction($orderProduct); | ||||
} | } | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
//Inclus les ReductionCatalog des OrderProducts | //Inclus les ReductionCatalog des OrderProducts | ||||
foreach ($orderShop->getOrderProducts() as $orderProduct) { | foreach ($orderShop->getOrderProducts() as $orderProduct) { | ||||
$total += $this->orderProductPriceResolver->getTotalMargin($orderProduct); | $total += $this->orderProductPriceResolver->getTotalMargin($orderProduct); | ||||
} | } | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
public function getMarginOrderProductsWithReductions(OrderShopInterface $orderShop, $cache = false): float | public function getMarginOrderProductsWithReductions(OrderShopInterface $orderShop, $cache = false): float | ||||
$total -= $totalReductionAmount; | $total -= $totalReductionAmount; | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
} | } | ||||
$total += $this->orderProductPriceResolver->getTotalBuyingPriceWithTax($orderProduct); | $total += $this->orderProductPriceResolver->getTotalBuyingPriceWithTax($orderProduct); | ||||
} | } | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
public function getTotalOrderProductsWithTaxByOrderProducts($orderProducts): float | public function getTotalOrderProductsWithTaxByOrderProducts($orderProducts): float | ||||
$total += $this->orderProductPriceResolver->getTotalWithTaxAndReduction($orderProduct); | $total += $this->orderProductPriceResolver->getTotalWithTaxAndReduction($orderProduct); | ||||
} | } | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
public function getTotalOrderProductsTaxes(OrderShopInterface $orderShop): float | public function getTotalOrderProductsTaxes(OrderShopInterface $orderShop): float | ||||
); | ); | ||||
} | } | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
public function getOrderProductsTaxesAsArray(OrderShopInterface $orderShop): array | public function getOrderProductsTaxesAsArray(OrderShopInterface $orderShop): array | ||||
]; | ]; | ||||
} | } | ||||
$orderProductsTaxes[$idTaxRate]['totalOrderProducts'] += $this->orderProductPriceResolver->getTotalWithReduction( | |||||
$orderProductsTaxes[$idTaxRate]['totalOrderProducts'] += $this->round($this->orderProductPriceResolver->getTotalWithReduction( | |||||
$orderProduct | $orderProduct | ||||
) / $this->getReductionsCoef($orderShop); | |||||
$orderProductsTaxes[$idTaxRate]['totalTaxes'] += $this->orderProductPriceResolver->getTotalTaxes( | |||||
) / $this->getReductionsCoef($orderShop)); | |||||
$orderProductsTaxes[$idTaxRate]['totalTaxes'] += $this->round($this->orderProductPriceResolver->getTotalTaxes( | |||||
$orderProduct | $orderProduct | ||||
) / $this->getReductionsCoef($orderShop); | |||||
) / $this->getReductionsCoef($orderShop)); | |||||
} | } | ||||
return $orderProductsTaxes; | return $orderProductsTaxes; | ||||
private function getTaxRateAverage(OrderShopInterface $orderShop): float | private function getTaxRateAverage(OrderShopInterface $orderShop): float | ||||
{ | { | ||||
return $this->getTotalOrderProductsWithTax($orderShop) / $this->getTotalOrderProducts($orderShop); | |||||
return $this->round($this->getTotalOrderProductsWithTax($orderShop) / $this->getTotalOrderProducts($orderShop)); | |||||
} | } | ||||
public function getTotalOrderProductsWithReductions(OrderShopInterface $orderShop, $cache = false) | public function getTotalOrderProductsWithReductions(OrderShopInterface $orderShop, $cache = false) | ||||
$total = $this->getTotalOrderProducts($orderShop); | $total = $this->getTotalOrderProducts($orderShop); | ||||
$total -= $this->getTotalReductionCartsAmount($orderShop); | $total -= $this->getTotalReductionCartsAmount($orderShop); | ||||
$total -= $this->getTotalReductionCreditsAmount($orderShop); | $total -= $this->getTotalReductionCreditsAmount($orderShop); | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
} | } | ||||
{ | { | ||||
$total = $this->getTotalOrderProducts($orderShop); | $total = $this->getTotalOrderProducts($orderShop); | ||||
$total -= $this->getTotalReductionCartsAmount($orderShop); | $total -= $this->getTotalReductionCartsAmount($orderShop); | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
public function getTotalReductionCartsAmount(OrderShopInterface $orderShop) | public function getTotalReductionCartsAmount(OrderShopInterface $orderShop) | ||||
$orderReductionCart | $orderReductionCart | ||||
); | ); | ||||
} | } | ||||
return $totalReductionAmount; | |||||
return $this->round($totalReductionAmount); | |||||
} | } | ||||
public function getTotalReductionCreditsAmount(OrderShopInterface $orderShop) | public function getTotalReductionCreditsAmount(OrderShopInterface $orderShop) | ||||
$orderReductionCredit | $orderReductionCredit | ||||
); | ); | ||||
} | } | ||||
return $totalReductionAmount; | |||||
return $this->round($totalReductionAmount); | |||||
} | } | ||||
public function getTotalOrderProductsWithTaxAndReductions(OrderShopInterface $orderShop, $cache = false) | public function getTotalOrderProductsWithTaxAndReductions(OrderShopInterface $orderShop, $cache = false) | ||||
$total = $this->getTotalOrderProductsWithTax($orderShop); | $total = $this->getTotalOrderProductsWithTax($orderShop); | ||||
$total -= $this->getTotalReductionCartsAmountWithTax($orderShop); | $total -= $this->getTotalReductionCartsAmountWithTax($orderShop); | ||||
$total -= $this->getTotalReductionCreditsAmountWithTax($orderShop); | $total -= $this->getTotalReductionCreditsAmountWithTax($orderShop); | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
} | } | ||||
{ | { | ||||
$total = $this->getTotalOrderProductsWithTax($orderShop); | $total = $this->getTotalOrderProductsWithTax($orderShop); | ||||
$total -= $this->getTotalReductionCartsAmountWithTax($orderShop); | $total -= $this->getTotalReductionCartsAmountWithTax($orderShop); | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
public function getTotalReductionCartsAmountWithTax(OrderShopInterface $orderShop) | public function getTotalReductionCartsAmountWithTax(OrderShopInterface $orderShop) | ||||
foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) { | foreach ($orderShop->getOrderReductionCarts() as $orderReductionCart) { | ||||
$totalReductionAmount += $this->getOrderProductsReductionCartAmountWithTax($orderShop, $orderReductionCart); | $totalReductionAmount += $this->getOrderProductsReductionCartAmountWithTax($orderShop, $orderReductionCart); | ||||
} | } | ||||
return $totalReductionAmount; | |||||
return $this->round($totalReductionAmount); | |||||
} | } | ||||
public function getTotalReductionCreditsAmountWithTax(OrderShopInterface $orderShop) | public function getTotalReductionCreditsAmountWithTax(OrderShopInterface $orderShop) | ||||
$orderReductionCredit | $orderReductionCredit | ||||
); | ); | ||||
} | } | ||||
return $totalReductionAmount; | |||||
return $this->round($totalReductionAmount); | |||||
} | } | ||||
public function getOrderProductsReductionCartAmountWithoutTax(OrderShopInterface $order, $orderReductionCart) | public function getOrderProductsReductionCartAmountWithoutTax(OrderShopInterface $order, $orderReductionCart) | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return $amount; | |||||
return $this->round($amount); | |||||
} | } | ||||
public function getOrderProductsReductionCartAmountWithTax(OrderShopInterface $order, $orderReductionCart) | public function getOrderProductsReductionCartAmountWithTax(OrderShopInterface $order, $orderReductionCart) | ||||
} | } | ||||
} | } | ||||
return $amount; | |||||
return $this->round($amount); | |||||
} | } | ||||
public function getOrderProductsReductionCreditAmountWithoutTax( | public function getOrderProductsReductionCreditAmountWithoutTax( | ||||
} | } | ||||
} | } | ||||
return $amount; | |||||
return $this->round($amount); | |||||
} | } | ||||
public function getOrderProductsReductionCreditAmountWithTax( | public function getOrderProductsReductionCreditAmountWithTax( | ||||
$amountWithTax = $orderReductionCredit->getValue(); | $amountWithTax = $orderReductionCredit->getValue(); | ||||
} | } | ||||
return $amountWithTax; | |||||
return $this->round($amountWithTax); | |||||
} | } | ||||
public function getTotalReductions(OrderShopInterface $orderShop) | public function getTotalReductions(OrderShopInterface $orderShop) | ||||
$total += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit); | $total += $this->getOrderProductsReductionCreditAmountWithoutTax($orderShop, $orderReductionCredit); | ||||
} | } | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
public function getTotalReductionsWithTax(OrderShopInterface $orderShop) | public function getTotalReductionsWithTax(OrderShopInterface $orderShop) | ||||
$total += $this->getOrderProductsReductionCreditAmountWithTax($orderShop, $orderReductionCredit); | $total += $this->getOrderProductsReductionCreditAmountWithTax($orderShop, $orderReductionCredit); | ||||
} | } | ||||
return $total; | |||||
return $this->round($total); | |||||
} | } | ||||
} | } | ||||
$products = $this->getProductsOnline($productFamily); | $products = $this->getProductsOnline($productFamily); | ||||
foreach ($products as $product) { | foreach ($products as $product) { | ||||
$titleProduct = $product->getTitleInherited(); | |||||
$titleProduct = $this->productSolver->getTitleInherited($product); | |||||
if (!isset($arrayCountProducts[$titleProduct])) { | if (!isset($arrayCountProducts[$titleProduct])) { | ||||
$arrayCountProducts[$titleProduct] = []; | $arrayCountProducts[$titleProduct] = []; | ||||
} | } | ||||
if (!in_array($product->getQuantityLabelInherited(), $arrayCountProducts[$titleProduct])) { | |||||
$arrayCountProducts[$titleProduct][] = $product->getQuantityLabelInherited(); | |||||
if (!in_array($this->productSolver->getQuantityLabelInherited($product), $arrayCountProducts[$titleProduct])) { | |||||
$arrayCountProducts[$titleProduct][] = $this->productSolver->getQuantityLabelInherited($product); | |||||
} | } | ||||
if (count($arrayCountProducts[$titleProduct]) > 1) { | if (count($arrayCountProducts[$titleProduct]) > 1) { |
public function getQuantityLabelInherited(ProductInterface $product) | public function getQuantityLabelInherited(ProductInterface $product) | ||||
{ | { | ||||
$quantity = $product->getQuantityInherited(); | |||||
$unit = $product->getUnitInherited(); | |||||
$quantity = $this->getQuantityInherited($product); | |||||
$unit = $this->getUnitInherited($product); | |||||
return $quantity . $unit->getWordingShort(); | return $quantity . $unit->getWordingShort(); | ||||
} | } | ||||
namespace Lc\CaracoleBundle\Transformer\Order; | namespace Lc\CaracoleBundle\Transformer\Order; | ||||
use App\Entity\Order\OrderShop; | |||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\CaracoleBundle\Resolver\OrderShopResolver; | use Lc\CaracoleBundle\Resolver\OrderShopResolver; | ||||
use Lc\CaracoleBundle\Resolver\ReductionResolver; | |||||
use Lc\CaracoleBundle\Solver\Order\OrderShopSolver; | use Lc\CaracoleBundle\Solver\Order\OrderShopSolver; | ||||
use Lc\CaracoleBundle\Solver\Price\PriceSolver; | use Lc\CaracoleBundle\Solver\Price\PriceSolver; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||||
class OrderShopTransformer | class OrderShopTransformer | ||||
{ | { | ||||
protected PriceSolver $priceSolver; | protected PriceSolver $priceSolver; | ||||
protected OrderShopSolver $orderShopSolver; | protected OrderShopSolver $orderShopSolver; | ||||
protected OrderShopResolver $orderShopResolver; | protected OrderShopResolver $orderShopResolver; | ||||
public function __construct(PriceSolver $priceSolver, OrderShopSolver $orderShopSolver, OrderShopResolver $orderShopResolver) | |||||
protected TranslatorAdmin $translatorAdmin; | |||||
public function __construct(PriceSolver $priceSolver, OrderShopSolver $orderShopSolver, OrderShopResolver $orderShopResolver, TranslatorAdmin $translatorAdmin) | |||||
{ | { | ||||
$this->priceSolver = $priceSolver; | $this->priceSolver = $priceSolver; | ||||
$this->orderShopSolver = $orderShopSolver; | $this->orderShopSolver = $orderShopSolver; | ||||
$this->orderShopResolver = $orderShopResolver; | $this->orderShopResolver = $orderShopResolver; | ||||
$this->translatorAdmin = $translatorAdmin; | |||||
} | } | ||||
// getOrderDatas | // getOrderDatas | ||||
return $data; | return $data; | ||||
} | } | ||||
public function getAsJsonObject(OrderShopInterface $orderShop): array | |||||
public function getAsArray(OrderShopInterface $orderShop): array | |||||
{ | { | ||||
$data['id'] = $orderShop->getId(); | $data['id'] = $orderShop->getId(); | ||||
$data['user'] = $orderShop->getUser()->getSummary(); | $data['user'] = $orderShop->getUser()->getSummary(); | ||||
return $data; | return $data; | ||||
} | } | ||||
public function getOrderReductionCartsInfosAsArray(OrderShop $order): array | |||||
{ | |||||
$data = array(); | |||||
foreach ($order->getOrderReductionCarts() as $orderReductionCart) { | |||||
$data[] = array( | |||||
'title' => $orderReductionCart->__toString(), | |||||
'id' => $orderReductionCart->getId(), | |||||
'orderReference' => $order->getReference(), | |||||
'amount' => $this->priceSolver->getOrderProductsReductionCartAmountWithTax( | |||||
$order, | |||||
$orderReductionCart | |||||
) | |||||
); | |||||
} | |||||
return $data; | |||||
} | |||||
public function getOrderPaymentsInfosAsArray(OrderShop $order): array | |||||
{ | |||||
$data = array(); | |||||
foreach ($order->getOrderPayments() as $orderPayment) { | |||||
$data[$orderPayment->getId()] = array( | |||||
'id' => $orderPayment->getId(), | |||||
'reference' => $orderPayment->getReference(), | |||||
'orderReference' => $order->getReference(), | |||||
'comment' => $orderPayment->getComment(), | |||||
'meanPayment' => $orderPayment->getMeanPayment(), | |||||
'meanPaymentText' => $this->translatorAdmin->trans( | |||||
'field.default.meanPaymentOptions.' . $orderPayment->getMeanPayment() | |||||
), | |||||
'paidAtText' => $orderPayment->getPaidAt()->format('d/m/Y'), | |||||
'paidAt' => $orderPayment->getPaidAt()->format('Y-m-d'), | |||||
'amount' => $orderPayment->getAmount(), | |||||
'editable' => $orderPayment->getEditable() | |||||
); | |||||
} | |||||
return $data; | |||||
} | |||||
public function getOrderStatusHistoriesInfosAsArray(OrderShop $order): array | |||||
{ | |||||
$data = array(); | |||||
foreach ($order->getOrderStatusHistories() as $orderStatusHistory) { | |||||
$data[$orderStatusHistory->getId()] = array( | |||||
'id' => $orderStatusHistory->getId(), | |||||
'createdAt' => $orderStatusHistory->getCreatedAt()->format('d-m-Y H:i'), | |||||
'createdBy' => $orderStatusHistory->getCreatedBy() ? $orderStatusHistory->getCreatedBy( | |||||
)->__toString() : 'aucun', | |||||
'orderStatus' => $orderStatusHistory->getOrderStatus()->getAlias(), | |||||
'origin' => $orderStatusHistory->getOrigin(), | |||||
'info' => $orderStatusHistory->__toString(), | |||||
); | |||||
} | |||||
return $data; | |||||
} | |||||
public function getOrderReductionCreditsInfosAsArray(OrderShop $order): array | |||||
{ | |||||
$data = array(); | |||||
foreach ($order->getOrderReductionCredits() as $orderReductionCredit) { | |||||
$data[] = array( | |||||
'title' => $orderReductionCredit->__toString(), | |||||
'id' => $orderReductionCredit->getId(), | |||||
'orderReference' => $order->getReference(), | |||||
'amount' => $this->priceSolver->getOrderProductsReductionCreditAmountWithTax( | |||||
$order, | |||||
$orderReductionCredit | |||||
) | |||||
); | |||||
} | |||||
return $data; | |||||
} | |||||
public function getOrderTicketsInfosAsArray(OrderShop $order): array | |||||
{ | |||||
$data = array(); | |||||
foreach ($order->getTickets() as $ticket) { | |||||
$data[$ticket->getId()] = array( | |||||
'id' => $ticket->getId(), | |||||
'date' => $ticket->getCreatedAt()->format('d/m/Y'), | |||||
'status' => $this->translatorAdmin->trans( | |||||
'field.Ticket.statusOptions.' . $ticket->getStatus() | |||||
), | |||||
'subject' => $ticket->getSubject(), | |||||
'orderReference' => $order->getReference(), | |||||
'link' => '', | |||||
); | |||||
} | |||||
return $data; | |||||
} | |||||
public function getOrderDocumentsInfosAsArray(OrderShop $order): array | |||||
{ | |||||
$data = array(); | |||||
foreach ($order->getDocuments() as $orderDocument) { | |||||
$data[$orderDocument->getId()] = array( | |||||
'id' => $orderDocument->getId(), | |||||
'date' => $orderDocument->getCreatedAt()->format('d/m/Y'), | |||||
'reference' => $orderDocument->getReference(), | |||||
'type' => $orderDocument->getType(), | |||||
'isSent' => $orderDocument->getIsSent(), | |||||
'orderReference' => $order->getReference(), | |||||
); | |||||
} | |||||
return $data; | |||||
} | |||||
} | } |