Quellcode durchsuchen

[Administration] Distribution : correctif chargement pointSaleDistribution

feature/souke
Guillaume Bourgeois vor 1 Jahr
Ursprung
Commit
d930f24203
2 geänderte Dateien mit 28 neuen und 4 gelöschten Zeilen
  1. +27
    -1
      backend/controllers/DistributionController.php
  2. +1
    -3
      backend/web/js/vuejs/distribution-index.js

+ 27
- 1
backend/controllers/DistributionController.php Datei anzeigen

@@ -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();

+ 1
- 3
backend/web/js/vuejs/distribution-index.js Datei anzeigen

@@ -266,9 +266,7 @@ var app = new Vue({
this.countActivePointsSale = 0;
this.setIdActivePointSale(0);
for (var i = 0; i < this.pointsSale.length; i++) {
if (this.pointsSale[i].pointSaleDistribution
&& 0 in this.pointsSale[i].pointSaleDistribution
&& this.pointsSale[i].pointSaleDistribution[0].delivery == 1) {
if (this.pointsSale[i].pointSaleDistribution[0].delivery == 1) {
this.countActivePointsSale++;
this.setIdActivePointSale(this.pointsSale[i].id);
}

Laden…
Abbrechen
Speichern