Browse Source

Merge branch 'develop' of https://forge.laclic.fr/Laclic/CaracoleBundle into develop

packProduct
Fabien Normand 2 years ago
parent
commit
84035dfbfc
5 changed files with 18 additions and 14 deletions
  1. +3
    -3
      Builder/File/DocumentBuilder.php
  2. +1
    -2
      Generator/DocumentReferenceGenerator.php
  3. +3
    -1
      Repository/File/DocumentStore.php
  4. +5
    -3
      Resources/views/admin/order/field/order_payment.html.twig
  5. +6
    -5
      Transformer/Order/OrderShopTransformer.php

+ 3
- 3
Builder/File/DocumentBuilder.php View File

namespace Lc\CaracoleBundle\Builder\File; namespace Lc\CaracoleBundle\Builder\File;


use Lc\CaracoleBundle\Model\File\DocumentInterface; use Lc\CaracoleBundle\Model\File\DocumentInterface;
use Lc\CaracoleBundle\Model\File\DocumentModel;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Generator\DocumentReferenceGenerator; use Lc\CaracoleBundle\Generator\DocumentReferenceGenerator;
use Lc\CaracoleBundle\Solver\Address\AddressSolver; use Lc\CaracoleBundle\Solver\Address\AddressSolver;
{ {
$merchantAddress = $orderShop->getSection()->getMerchant()->getAddress(); $merchantAddress = $orderShop->getSection()->getMerchant()->getAddress();
$buyerAddress = $orderShop->getInvoiceAddress(); $buyerAddress = $orderShop->getInvoiceAddress();
//TODO a discuter, doit on garder le lien avec merchant pr la référence ou le mettre par section ? Est-ce que le nom de cette fonction est approprié. on fait une invoice et ça s'appele initFromOrderShop
$document->setReference($this->documentReferenceGenerator->buildReference($orderShop->getSection()->getMerchant(), $document->getType())) ;

// @TODO a discuter, doit on garder le lien avec merchant pr la référence ou le mettre par section ? Est-ce que le nom de cette fonction est approprié. on fait une invoice et ça s'appele initFromOrderShop
$document->setReference($this->documentReferenceGenerator->buildReference($orderShop->getSection()->getMerchant(), $document->getType(), $orderShop)) ;


$document->setMerchantAddress($merchantAddress); $document->setMerchantAddress($merchantAddress);
$document->setBuyerAddress($buyerAddress); $document->setBuyerAddress($buyerAddress);

+ 1
- 2
Generator/DocumentReferenceGenerator.php View File



class DocumentReferenceGenerator class DocumentReferenceGenerator
{ {

protected DocumentStore $documentStore; protected DocumentStore $documentStore;


public function __construct(DocumentStore $documentStore) public function __construct(DocumentStore $documentStore)
$this->documentStore = $documentStore; $this->documentStore = $documentStore;
} }


public function buildReference(MerchantInterface $merchant, string $documentType)
public function buildReference(MerchantInterface $merchant, string $documentType, OrderShopInterface $orderShop = null)
{ {
$prefix = ''; $prefix = '';
if ($documentType == DocumentModel::TYPE_DELIVERY_NOTE) { if ($documentType == DocumentModel::TYPE_DELIVERY_NOTE) {

+ 3
- 1
Repository/File/DocumentStore.php View File



$query $query
->filterByReference($reference) ->filterByReference($reference)
->orderBy('createdAt', 'ASC');
->orderBy('createdAt', 'ASC')
->innerJoin('.orderShops', 'orderShops')
;


if(!is_null($type)) { if(!is_null($type)) {
$query->filterByType($type); $query->filterByType($type);

+ 5
- 3
Resources/views/admin/order/field/order_payment.html.twig View File

{% set value = field.value %} {% set value = field.value %}
{% set item = entity.instance %} {% set item = entity.instance %}
{% for val in value %} {% for val in value %}
<span class="badge badge-success">
{{ val.meanPayment|sov_trans_admin_choice('meanPayment', 'OrderPayment') }}
</span>
{% if val.meanPayment %}
<span class="badge badge-success">
{{ val.meanPayment|sov_trans_admin_choice('meanPayment', 'OrderPayment') }}
</span>
{% endif %}
{% endfor %} {% endfor %}


{% set is_paid = order_shop_container.resolver.isPaid(item) %} {% set is_paid = order_shop_container.resolver.isPaid(item) %}

+ 6
- 5
Transformer/Order/OrderShopTransformer.php View File

'orderReference' => $order->getReference(), 'orderReference' => $order->getReference(),
'comment' => $orderPayment->getComment(), 'comment' => $orderPayment->getComment(),
'meanPayment' => $orderPayment->getMeanPayment(), 'meanPayment' => $orderPayment->getMeanPayment(),
'meanPaymentText' => $this->translatorAdmin->transChoice(
'OrderPayment',
'meanPayment',
$orderPayment->getMeanPayment()
),
'meanPaymentText' => $orderPayment->getMeanPayment() ?
$this->translatorAdmin->transChoice(
'OrderPayment',
'meanPayment',
$orderPayment->getMeanPayment()
) : '',
'paidAtText' => $orderPayment->getPaidAt()->format('d/m/Y'), 'paidAtText' => $orderPayment->getPaidAt()->format('d/m/Y'),
'paidAt' => $orderPayment->getPaidAt()->format('Y-m-d'), 'paidAt' => $orderPayment->getPaidAt()->format('Y-m-d'),
'amount' => $orderPayment->getAmount(), 'amount' => $orderPayment->getAmount(),

Loading…
Cancel
Save