@@ -0,0 +1,8 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Context ; | |||
interface DocumentUtilsInterface | |||
{ | |||
} |
@@ -61,10 +61,8 @@ class AdminController extends EasyAdminController | |||
$this->translator = $translator; | |||
} | |||
public function createCustomForm($class, $action, $parameters, $data = true) | |||
public function createCustomForm($class, $action, $parameters, $data = true, $options = array()) | |||
{ | |||
$options = array(); | |||
if ($data) $options['data'] = $parameters['entity']; | |||
$options['action'] = $this->generateUrl('easyadmin', array( | |||
'action' => $action, |
@@ -10,6 +10,8 @@ use Lc\ShopBundle\Context\OrderUtilsInterface; | |||
use Lc\ShopBundle\Services\Utils; | |||
use Lc\ShopBundle\Services\UtilsManager; | |||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | |||
use Symfony\Component\HttpFoundation\BinaryFileResponse; | |||
use Symfony\Component\HttpFoundation\StreamedResponse; | |||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | |||
use Symfony\Component\Security\Core\Security; | |||
use Symfony\Contracts\Translation\TranslatorInterface; | |||
@@ -36,7 +38,9 @@ class DocumentController extends AdminController | |||
} | |||
if($document && $orderShop) { | |||
$this->orderUtils->generateDocumentInvoiceOrderShop($orderShop, 'download') ; | |||
return new StreamedResponse(function () use ($orderShop) { | |||
$this->orderUtils->generateDocumentInvoiceOrderShop($orderShop, 'download') ; | |||
}); | |||
} | |||
else { | |||
throw new NotFoundHttpException('Document introuvable') ; |
@@ -57,6 +57,7 @@ class EditEventSubscriber implements EventSubscriberInterface | |||
public function updateCommonProperty(GenericEvent $event) | |||
{ | |||
/* $this->setUpdated($entity); | |||
$this->setAddressCreatedBy($entity) ;*/ | |||
} |
@@ -48,9 +48,9 @@ class AddressType extends AbstractType | |||
]) | |||
->add('lastname', TextType::class, ['required' => false]) | |||
->add('firstname', TextType::class, ['required' => false]) | |||
->add('address', TextareaType::class) | |||
->add('zip', TextType::class) | |||
->add('city', TextType::class) | |||
->add('address', TextType::class) | |||
->add('phone', CollectionType::class, [ | |||
'allow_add'=>true, | |||
'allow_delete'=>true, |
@@ -73,9 +73,11 @@ abstract class Document extends AbstractDocumentEntity implements FilterMerchant | |||
/** | |||
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="documents") | |||
* @ORM\JoinColumn(nullable=true) | |||
*/ | |||
protected $orderShops; | |||
/** | |||
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\OrderRefundInterface", mappedBy="document", cascade={"persist", "remove"}) | |||
*/ |
@@ -32,7 +32,6 @@ class UserRepository extends BaseRepository implements DefaultRepositoryInterfac | |||
return $this->createQueryBuilder('e') | |||
->where(':newsletter MEMBER OF e.newsletters') | |||
->setParameter('newsletter', $newsletter->getId()) | |||
->andWhere('e.enabled = 1') | |||
->innerJoin('e.userMerchants', 'um') | |||
->andWhere('um.merchant = :merchant AND um.active = 1') | |||
->setParameter('merchant', $newsletter->getMerchant()) |
@@ -21,6 +21,8 @@ group: | |||
default: Édition | |||
Général: Général | |||
Adresse: Adresse | |||
Supplier: | |||
contact: Personne de contact | |||
Reminder: | |||
title: Pense bête | |||
list: Pense bêtes | |||
@@ -278,6 +280,9 @@ field: | |||
codeHelp: Code utilisé pour retrouver l'ambassade dans le tunnel de commande (Non sensible à la casse) | |||
Supplier: | |||
user: Utilisateur lié | |||
contactName: Personne de contact (Nom et prénom) | |||
contactPhone: Téléphone | |||
contactEmail: Email de la personne de contact | |||
ProductFamily: | |||
taxRateInherited: Utiliser la TVA par défaut | |||
activeProducts: Activer les déclinaisons | |||
@@ -406,7 +411,7 @@ field: | |||
quantityProduct: Quantité (en rapport à l'unité) | |||
unit: Unité | |||
redeliverySupplierShort: Erreur producteur | |||
redeliverySupplier: Erreur producteur (Aura un prix à 0€ dans le prohain bon de commande producteur - vous devez cocher à recommander) | |||
redeliverySupplierMistake: Erreur producteur (Aura un prix à 0€ dans le prohain bon de commande producteur - vous devez cocher à recommander) | |||
redeliverySupplierOrderShort: À recommander au producteur | |||
redeliverySupplierOrder: À recommander au producteur (Sera affiché dans le prohain bon de commande producteur) | |||
deliveryType: Type de livraison |
@@ -21,15 +21,15 @@ | |||
<div class="col-6"> | |||
{{ form_row(form.firstname) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_row(form.address) }} | |||
</div> | |||
<div class="col-6"> | |||
{{ form_row(form.zip) }} | |||
</div> | |||
<div class="col-6"> | |||
{{ form_row(form.city) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_row(form.address) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_row(form.phone) }} | |||
</div> | |||
@@ -57,6 +57,12 @@ | |||
<div class="col-6"> | |||
{{ form_row(form.longitude) }} | |||
</div> | |||
<div class="col-6"> | |||
{{ form_row(form.latitudeOverride) }} | |||
</div> | |||
<div class="col-6"> | |||
{{ form_row(form.longitudeOverride) }} | |||
</div> | |||
{{ form_row(form.country) }} | |||
@@ -5,21 +5,24 @@ | |||
<div class="row"> | |||
<div class="col-8"> | |||
{{ macros.card_start('Merchant.delivery','light') }} | |||
<div class="col-12"> | |||
{{ form_row(form.merchantConfigs['image-zones']) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_row(form.merchantConfigs['downtime-per-customer']) }} | |||
</div> | |||
{% if form.merchantConfigs['image-zones'] is defined %} | |||
<div class="col-12"> | |||
{{ form_row(form.merchantConfigs['image-zones']) }} | |||
</div> | |||
{% endif %} | |||
{% if form.merchantConfigs['downtime-per-customer'] is defined %} | |||
<div class="col-12"> | |||
{{ form_row(form.merchantConfigs['downtime-per-customer']) }} | |||
</div> | |||
{% endif %} | |||
<div class="col-12"> | |||
{{ form_row(form.deliveryTaxRate) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_row(form.merchantConfigs['bike-delivery']) }} | |||
</div> | |||
<div class="col-12"> | |||
{{ form_row(form.merchantConfigs['bike-delivery-url-map']) }} | |||
</div> | |||
{% if form.merchantConfigs['bike-delivery-url-map'] is defined %} | |||
<div class="col-12"> | |||
{{ form_row(form.merchantConfigs['bike-delivery-url-map']) }} | |||
</div> | |||
{% endif %} | |||
{{ macros.card_end() }} | |||
</div> | |||
</div> |
@@ -29,7 +29,7 @@ class CsvGenerator | |||
protected $convertEncoding ; | |||
protected $fromEncoding ; | |||
protected $toEncoding ; | |||
protected $delimiter ; | |||
public function __construct() | |||
{ | |||
@@ -38,6 +38,7 @@ class CsvGenerator | |||
$this->convertEncoding = false ; | |||
$this->fromEncoding = 'UTF-8' ; | |||
$this->toEncoding = 'ISO-8859-1' ; | |||
$this->delimiter = ';' ; | |||
} | |||
public function enableConvertEncoding($toEncoding, $fromEncoding = null) | |||
@@ -53,7 +54,10 @@ class CsvGenerator | |||
public function encode($value) | |||
{ | |||
if($this->convertEncoding) { | |||
return mb_convert_encoding($value, $this->toEncoding, $this->fromEncoding) ; | |||
return mb_convert_encoding( | |||
$value, | |||
$this->toEncoding, | |||
$this->fromEncoding) ; | |||
} | |||
return $value ; | |||
@@ -119,7 +123,7 @@ class CsvGenerator | |||
$handle = fopen($path, 'w+'); | |||
foreach ($this->arrayToExport as $line) { | |||
fputcsv($handle, $line, ';', ' '); | |||
fputcsv($handle, $line, $this->getDelimiter(), "\""); | |||
} | |||
fclose($handle); | |||
} | |||
@@ -143,7 +147,10 @@ class CsvGenerator | |||
} | |||
public function getDelimiter() | |||
{ | |||
return $this->delimiter ; | |||
} | |||
@@ -67,12 +67,14 @@ class DocumentUtils | |||
if(isset($params['merchant'])) { | |||
$document->setMerchant($params['merchant']) ; | |||
} | |||
else { | |||
elseif(isset($params['order_shops'])) { | |||
$document->setMerchant($params['order_shops'][0]->getMerchant()) ; | |||
} | |||
foreach($params['order_shops'] as $orderShop) { | |||
$document->addOrderShop($orderShop) ; | |||
if(isset($params['order_shops'])) { | |||
foreach ($params['order_shops'] as $orderShop) { | |||
$document->addOrderShop($orderShop); | |||
} | |||
} | |||
$document->setType($params['type']) ; |
@@ -1,6 +1,6 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Services\Price ; | |||
namespace Lc\ShopBundle\Services\Price; | |||
use Lc\ShopBundle\Context\OrderProductInterface; | |||
use Lc\ShopBundle\Context\OrderShopInterface; | |||
@@ -10,59 +10,56 @@ use Lc\ShopBundle\Context\ProductPropertyInterface; | |||
class PriceUtils implements PriceUtilsInterface | |||
{ | |||
protected $productPriceUtils ; | |||
protected $orderProductPriceUtils ; | |||
protected $orderShopPriceUtils ; | |||
protected $productPriceUtils; | |||
protected $orderProductPriceUtils; | |||
protected $orderShopPriceUtils; | |||
public function __construct(ProductPriceUtils $productPriceUtils, OrderProductPriceUtils $orderProductPriceUtils, OrderShopPriceUtilsInterface $orderShopPriceUtils) | |||
{ | |||
$this->productPriceUtils = $productPriceUtils ; | |||
$this->orderProductPriceUtils = $orderProductPriceUtils ; | |||
$this->orderShopPriceUtils = $orderShopPriceUtils ; | |||
$this->productPriceUtils = $productPriceUtils; | |||
$this->orderProductPriceUtils = $orderProductPriceUtils; | |||
$this->orderShopPriceUtils = $orderShopPriceUtils; | |||
} | |||
public function __call($name, $arguments) | |||
{ | |||
$entity = $arguments[0] ; | |||
$service = '' ; | |||
if (strpos($name, 'apply') === false) { | |||
$entity = $arguments[0]; | |||
$service = ''; | |||
if($entity instanceof ProductPropertyInterface) { | |||
$service = 'productPriceUtils' ; | |||
} | |||
if($entity instanceof OrderProductInterface) { | |||
$service = 'orderProductPriceUtils' ; | |||
} | |||
if($entity instanceof OrderShopInterface || is_array($entity)) { | |||
$service = 'orderShopPriceUtils' ; | |||
} | |||
if(strlen($service) && $entity && method_exists($this->$service, $name)) { | |||
if(isset($arguments[1]) && isset($arguments[2]) && isset($arguments[3])) { | |||
return $this->$service->$name($entity, $arguments[1], $arguments[2], $arguments[3]) ; | |||
} | |||
elseif(isset($arguments[1]) && isset($arguments[2])) { | |||
return $this->$service->$name($entity, $arguments[1], $arguments[2]) ; | |||
} | |||
elseif(isset($arguments[1])) { | |||
return $this->$service->$name($entity, $arguments[1]) ; | |||
if ($entity instanceof ProductPropertyInterface) { | |||
$service = 'productPriceUtils'; | |||
} | |||
else { | |||
return $this->$service->$name($entity) ; | |||
if ($entity instanceof OrderProductInterface) { | |||
$service = 'orderProductPriceUtils'; | |||
} | |||
} | |||
else { | |||
if(!strlen($service)) { | |||
throw new \ErrorException("PriceUtils : le type d'entité n'est pas géré.") ; | |||
if ($entity instanceof OrderShopInterface || is_array($entity)) { | |||
$service = 'orderShopPriceUtils'; | |||
} | |||
else { | |||
if(!method_exists($this->$service, $name)) { | |||
throw new \ErrorException("PriceUtils : la méthode ".$name." du service ".$service." n'existe pas.") ; | |||
if (strlen($service) && $entity && method_exists($this->$service, $name)) { | |||
if (isset($arguments[1]) && isset($arguments[2]) && isset($arguments[3])) { | |||
return $this->$service->$name($entity, $arguments[1], $arguments[2], $arguments[3]); | |||
} elseif (isset($arguments[1]) && isset($arguments[2])) { | |||
return $this->$service->$name($entity, $arguments[1], $arguments[2]); | |||
} elseif (isset($arguments[1])) { | |||
return $this->$service->$name($entity, $arguments[1]); | |||
} else { | |||
return $this->$service->$name($entity); | |||
} | |||
} else { | |||
if (!strlen($service)) { | |||
throw new \ErrorException("PriceUtils : le type d'entité n'est pas géré."); | |||
} else { | |||
if (!method_exists($this->$service, $name)) { | |||
throw new \ErrorException("PriceUtils : la méthode " . $name . " du service " . $service . " n'existe pas."); | |||
} | |||
} | |||
} | |||
} | |||
return false ; | |||
return false; | |||
} | |||
} | |||
} | |||
} |
@@ -3,6 +3,7 @@ | |||
namespace Lc\ShopBundle\Services ; | |||
use Lc\ShopBundle\Context\DeliveryUtilsInterface; | |||
use Lc\ShopBundle\Context\DocumentUtilsInterface; | |||
use Lc\ShopBundle\Context\MerchantUtilsInterface; | |||
use Lc\ShopBundle\Context\OrderUtilsInterface; | |||
use Lc\ShopBundle\Context\PriceUtilsInterface; | |||
@@ -35,7 +36,7 @@ class UtilsManager | |||
PriceUtilsInterface $priceUtils, | |||
DeliveryUtilsInterface $deliveryUtils, | |||
CreditUtils $creditUtils, | |||
DocumentUtils $documentUtils, | |||
DocumentUtilsInterface $documentUtils, | |||
MailUtils $mailUtils, | |||
TicketUtils $ticketUtils, | |||
PointLocationUtils $pointLocationUtils, | |||
@@ -97,7 +98,7 @@ class UtilsManager | |||
return $this->creditUtils ; | |||
} | |||
public function getDocumentUtils(): DocumentUtils | |||
public function getDocumentUtils(): DocumentUtilsInterface | |||
{ | |||
return $this->documentUtils ; | |||
} |
@@ -13,6 +13,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | |||
use Symfony\Component\Form\FormFactoryInterface; | |||
use Symfony\Component\HttpFoundation\RequestStack; | |||
use Symfony\Component\HttpKernel\KernelInterface; | |||
use Symfony\Component\Routing\RouterInterface; | |||
use Symfony\Component\Security\Core\Security; | |||
use Twig\Extension\AbstractExtension; | |||
use Twig\TwigFilter; | |||
@@ -31,9 +32,11 @@ class FrontendTwigExtension extends AbstractExtension | |||
protected $liipCacheHelper; | |||
protected $parameterBag; | |||
protected $kernel; | |||
protected $router ; | |||
public function __construct(EntityManagerInterface $em, Security $security, MerchantUtilsInterface $merchantUtils, | |||
FormFactoryInterface $formFactory, RequestStack $requestStack, ParameterBagInterface $parameterBag, KernelInterface $kernel) | |||
FormFactoryInterface $formFactory, RequestStack $requestStack, ParameterBagInterface $parameterBag, | |||
KernelInterface $kernel, RouterInterface $router) | |||
{ | |||
$this->em = $em; | |||
$this->security = $security; | |||
@@ -45,6 +48,7 @@ class FrontendTwigExtension extends AbstractExtension | |||
$this->productFamilyRepository = $this->em->getRepository($this->em->getClassMetadata(ProductFamilyInterface::class)->getName()); | |||
$this->parameterBag = $parameterBag; | |||
$this->kernel = $kernel; | |||
$this->router = $router ; | |||
} | |||
public function getFunctions() |