Browse Source

[Document] Correctif numéros de factures

packProduct
Guillaume 2 years ago
parent
commit
eff9a6eb87
3 changed files with 9 additions and 8 deletions
  1. +3
    -3
      Builder/File/DocumentBuilder.php
  2. +1
    -2
      Generator/DocumentReferenceGenerator.php
  3. +5
    -3
      Resources/views/admin/order/field/order_payment.html.twig

+ 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) {

+ 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) %}

Loading…
Cancel
Save