@@ -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); |
@@ -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) { |
@@ -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); |
@@ -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) %} |
@@ -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(), |