Bläddra i källkod

Bon de commande producteur : Travail en cours

feature/export_comptable
Fab 4 år sedan
förälder
incheckning
98c1914a9b
2 ändrade filer med 41 tillägg och 44 borttagningar
  1. +2
    -2
      ShopBundle/Controller/Backend/OrderController.php
  2. +39
    -42
      ShopBundle/Services/Price/PriceUtils.php

+ 2
- 2
ShopBundle/Controller/Backend/OrderController.php Visa fil

@@ -19,7 +19,7 @@ use Lc\ShopBundle\Form\Backend\Order\DeleteOrderReductionCreditType;
use Lc\ShopBundle\Form\Backend\Order\OrderDeliveryAddressType;
use Lc\ShopBundle\Form\Backend\Order\OrderInvoiceAddressType;
use Lc\ShopBundle\Form\Backend\Order\OrderPaymentType;
use Lc\ShopBundle\Form\Backend\Order\PurchaseOrderProductsType;
use Lc\ShopBundle\Form\Backend\Order\OrderProductsType;
use Lc\ShopBundle\Form\Backend\Order\AddOrderReductionCartType;
use Lc\ShopBundle\Form\Backend\Order\AddOrderReductionCreditType;
use Lc\ShopBundle\Form\Backend\Order\OrderSendPaymentLink;
@@ -450,7 +450,7 @@ class OrderController extends AdminController
$parameters['form_delete_order_reduction_cart'] = $this->createCustomForm(DeleteOrderReductionCartType::class, 'deleteOrderReductionCart', $parameters)->createView();
$parameters['form_delete_order_reduction_credit'] = $this->createCustomForm(DeleteOrderReductionCreditType::class, 'deleteOrderReductionCredit', $parameters)->createView();
$parameters['form_add_product_to_order'] = $this->createCustomForm(AddPoductToOrderType::class, 'addProductToOrder', $parameters)->createView();
$parameters['form_order_products'] = $this->createCustomForm(PurchaseOrderProductsType::class, 'orderProducts', $parameters)->createView();
$parameters['form_order_products'] = $this->createCustomForm(OrderProductsType::class, 'orderProducts', $parameters)->createView();
$parameters['form_order_status'] = $this->createCustomForm(OrderStatusType::class, 'orderStatus', $parameters)->createView();
$parameters['form_order_invoice_address'] = $this->createCustomForm(OrderInvoiceAddressType::class, 'orderInvoiceAddress', $parameters)->createView();
$parameters['form_order_send_payment_link'] = $this->createCustomForm(OrderSendPaymentLink::class, 'orderSendPaymentLink', $parameters)->createView();

+ 39
- 42
ShopBundle/Services/Price/PriceUtils.php Visa fil

@@ -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;
}
}
}
}

Laddar…
Avbryt
Spara