Fabien Normand 2 лет назад
Родитель
Сommit
84035dfbfc
5 измененных файлов: 18 добавлений и 14 удалений
  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 Просмотреть файл

@@ -3,7 +3,6 @@
namespace Lc\CaracoleBundle\Builder\File;

use Lc\CaracoleBundle\Model\File\DocumentInterface;
use Lc\CaracoleBundle\Model\File\DocumentModel;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Generator\DocumentReferenceGenerator;
use Lc\CaracoleBundle\Solver\Address\AddressSolver;
@@ -23,8 +22,9 @@ class DocumentBuilder
{
$merchantAddress = $orderShop->getSection()->getMerchant()->getAddress();
$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->setBuyerAddress($buyerAddress);

+ 1
- 2
Generator/DocumentReferenceGenerator.php Просмотреть файл

@@ -11,7 +11,6 @@ use Lc\CaracoleBundle\Repository\File\DocumentStore;

class DocumentReferenceGenerator
{

protected DocumentStore $documentStore;

public function __construct(DocumentStore $documentStore)
@@ -19,7 +18,7 @@ class DocumentReferenceGenerator
$this->documentStore = $documentStore;
}

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

+ 3
- 1
Repository/File/DocumentStore.php Просмотреть файл

@@ -49,7 +49,9 @@ class DocumentStore extends AbstractStore

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

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

+ 5
- 3
Resources/views/admin/order/field/order_payment.html.twig Просмотреть файл

@@ -1,9 +1,11 @@
{% set value = field.value %}
{% set item = entity.instance %}
{% 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 %}

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

+ 6
- 5
Transformer/Order/OrderShopTransformer.php Просмотреть файл

@@ -112,11 +112,12 @@ class OrderShopTransformer
'orderReference' => $order->getReference(),
'comment' => $orderPayment->getComment(),
'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'),
'paidAt' => $orderPayment->getPaidAt()->format('Y-m-d'),
'amount' => $orderPayment->getAmount(),

Загрузка…
Отмена
Сохранить