Преглед на файлове

Edition commande backoffice (travail en cours)

feature/export_comptable
Fab преди 4 години
родител
ревизия
0f9749aa7f
променени са 2 файла, в които са добавени 13 реда и са изтрити 15 реда
  1. +12
    -14
      ShopBundle/Controller/Admin/OrderController.php
  2. +1
    -1
      ShopBundle/Services/OrderUtils.php

+ 12
- 14
ShopBundle/Controller/Admin/OrderController.php Целия файл

@@ -25,13 +25,13 @@ use Symfony\Component\Security\Core\Security;

class OrderController extends AdminController
{
protected $orderUtils;
/*protected $orderUtils;

public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, Utils $utils, MerchantUtilsInterface $merchantUtils, MailjetTransport $mailjetTransport, OrderUtilsInterface $orderUtils)
{
$this->orderUtils = $orderUtils;
parent::__construct($security, $userManager, $em, $utils, $merchantUtils, $mailjetTransport);
}
}*/

public function updateEntity($entity)
{
@@ -144,10 +144,10 @@ class OrderController extends AdminController
$formAddProductToOrder = $this->createForm(AddPoductToOrderType::class);

$formAddProductToOrder->handleRequest($this->request);
if($formAddProductToOrder->get('product')->getData() == null) {
if ($formAddProductToOrder->get('product')->getData() == null) {
$response['status'] = 'error';
$response['message'] = 'Vous devez choisir un produit dans la liste';
}else if($formAddProductToOrder->get('quantity')->getData() == null){
} else if ($formAddProductToOrder->get('quantity')->getData() == null) {
$response['status'] = 'error';
$response['message'] = 'Vous devez entrer une quantité';

@@ -161,7 +161,7 @@ class OrderController extends AdminController

$response['status'] = 'success';
$response['message'] = 'Le produit a bien été ajouté à la commande';
}else{
} else {
$response['status'] = 'error';
$response['message'] = 'Une erreur est survenue';
}
@@ -184,14 +184,14 @@ class OrderController extends AdminController


if ($formOrderProducts->isSubmitted() && $formOrderProducts->isValid()) {
// dump($formOrderProducts->get('orderProducts')->getData());
foreach($orderShop->getOrderProducts() as $orderProduct){
// dump($formOrderProducts->get('orderProducts')->getData());
foreach ($orderShop->getOrderProducts() as $orderProduct) {


if($orderProduct->getQuantityOrder() <= 0) {
$response['niche'] = $orderProduct->getQuantityOrder() ;
if ($orderProduct->getQuantityOrder() <= 0) {
$response['niche'] = $orderProduct->getQuantityOrder();
$this->em->remove($orderProduct);
}else{
} else {
//dump($orderProduct);
$this->em->persist($orderProduct);
}
@@ -200,7 +200,7 @@ class OrderController extends AdminController
$this->em->flush();
$response['status'] = 'success';
$response['message'] = 'La commande a bien été modifié';
}else{
} else {
$response['status'] = 'error';
$response['message'] = 'Une erreur est survenue';
}
@@ -210,8 +210,6 @@ class OrderController extends AdminController
}




public function renderOrderShopTemplate($actionName, $templatePath, array $parameters = [])
{
if ($actionName == 'show') {
@@ -300,7 +298,7 @@ class OrderController extends AdminController
'entity' => $entity,
'fields' => $fields,
'delete_form' => $deleteForm->createView(),
'order'=> $this->orderUtils->getOrderAsJsonObject($entity)
'order' => $this->orderUtils->getOrderAsJsonObject($entity)

];


+ 1
- 1
ShopBundle/Services/OrderUtils.php Целия файл

@@ -217,7 +217,7 @@ class OrderUtils
$data['orderProducts'][$i]['priceWithTax'] = $this->priceUtils->getPriceWithTax($orderProduct);
$data['orderProducts'][$i]['priceWithTaxAndReduction'] = $this->priceUtils->getPriceWithTaxAndReduction($orderProduct);
$data['orderProducts'][$i]['quantity'] = $orderProduct->getQuantityOrder();
$data['orderProducts'][$i]['totalWithTaxAndReduction'] = $this->priceUtils->getTotalWithTaxAndReductionByOrderProducts(array($orderProduct));
$data['orderProducts'][$i]['totalWithTaxAndReduction'] = $this->priceUtils->getTotalOrderProductsWithTaxAndReduction(array($orderProduct));
$i++;
}
}

Loading…
Отказ
Запис