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

Merge branch 'develop'

master
Guillaume Bourgeois преди 1 година
родител
ревизия
1f60ecb484
променени са 1 файла, в които са добавени 27 реда и са изтрити 1 реда
  1. +27
    -1
      backend/controllers/DistributionController.php

+ 27
- 1
backend/controllers/DistributionController.php Целия файл

@@ -137,7 +137,7 @@ class DistributionController extends BackendController
$json['products'] = $this->buildAjaxInfosResponseProducts($producer, $distribution, $productsArray, $ordersArray);
$json['distribution'] = $this->buildAjaxInfosResponseDistribution($distribution, $ordersArrayObject, $productsArray);
$json['orders'] = $this->buildAjaxInfosResponseOrders($ordersArray, $productsArray);
$json['points_sale'] = $pointSaleManager->findPointSalesByDistributionAsArray($distribution);
$json['points_sale'] = $this->buildAjaxInfosResponsePointsSale($distribution);
$json['delivery_notes'] = $this->buildAjaxInfosResponseDeliveryNotes($date);
$json['order_create'] = $this->buildAjaxInfosResponseOrderCreate($distribution, $productsArray);
$json['users'] = $userManager->findUsers();
@@ -149,6 +149,32 @@ class DistributionController extends BackendController
return $json;
}

public function buildAjaxInfosResponsePointsSale(Distribution $distribution)
{
$pointSaleManager = $this->getPointSaleManager();
$pointSaleDistributionManager = $this->getPointSaleDistributionManager();

$pointsSaleArray = $pointSaleManager->findPointSalesByDistributionAsArray($distribution);

// @TODO : à gérer autrement
foreach($pointsSaleArray as &$pointSaleArray) {
$idPointSale = $pointSaleArray['id'];
$pointSale = $pointSaleManager->findOnePointSaleById($idPointSale);
if(!isset($pointSaleArray['pointSaleDistribution']) || !$pointSaleArray['pointSaleDistribution'] || !count($pointSaleArray['pointSaleDistribution'])) {
$pointSaleDistribution = $pointSaleDistributionManager->createPointSaleDistributionIfNotExist($distribution, $pointSale);
$pointSaleArray['pointSaleDistribution'] = [
[
'id_distribution' => $pointSaleDistribution->id_distribution,
'id_point_sale' => $pointSaleDistribution->id_point_sale,
'delivery' => $pointSaleDistribution->delivery
]
];
}
}

return $pointsSaleArray;
}

public function buildAjaxInfosResponseProducts(Producer $producer, Distribution $distribution, array &$productsArray, array $ordersArray)
{
$distributionManager = $this->getDistributionManager();

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