Browse Source

Merge branch 'develop'

master
Guillaume Bourgeois 1 year ago
parent
commit
7a337a7edc
4 changed files with 58 additions and 7 deletions
  1. +38
    -0
      Builder/Order/OrderShopBuilder.php
  2. +9
    -3
      Resolver/SectionResolver.php
  3. +6
    -4
      Resources/views/admin/order/field/distribution.html.twig
  4. +5
    -0
      Solver/Order/OrderShopSolver.php

+ 38
- 0
Builder/Order/OrderShopBuilder.php View File

$persist = true $persist = true
): OrderShopInterface { ): OrderShopInterface {


// @TODO : intégrer la gestion des OrderPackProduct dans cette méthode

// TODO essayer de comprendre pourquoi on doit faire un refresh ici // TODO essayer de comprendre pourquoi on doit faire un refresh ici
$this->entityManager->refresh($orderShop1); $this->entityManager->refresh($orderShop1);
$this->entityManager->refresh($orderShop2); $this->entityManager->refresh($orderShop2);
return $productsSalesStatistic->getAsArray(); return $productsSalesStatistic->getAsArray();
} }


public function delete(OrderShopInterface $orderShop)
{
// delete OrderProduct
foreach($orderShop->getOrderProducts() as $orderProduct) {
$this->entityManager->delete($orderProduct);
}

// delete OrderPackProduct
foreach($orderShop->getOrderPackProducts() as $orderPackProduct) {
$this->entityManager->delete($orderPackProduct);
}

// delete OrderPayment
foreach($orderShop->getOrderPayments() as $orderPayment) {
$this->entityManager->delete($orderPayment);
}

// delete OrderReductionCarts
foreach($orderShop->getOrderReductionCarts() as $orderReductionCart) {
$this->entityManager->delete($orderReductionCart);
}

// delete OrderReductionCredits
foreach($orderShop->getOrderReductionCredits() as $orderReductionCredit) {
$this->entityManager->delete($orderReductionCredit);
}

// delete OrderStatusHistory
foreach($orderShop->getOrderStatusHistories() as $orderStatusHistory) {
$this->entityManager->delete($orderStatusHistory);
}

// delete OrderShop
$this->entityManager->delete($orderShop);


$this->entityManager->flush();
}
} }

+ 9
- 3
Resolver/SectionResolver.php View File

} }
} }


/*
* /!\ Cache désactivé car génération d'une erreur du type :
* "A new entity was found through the relationship 'App\Entity\Order\OrderShop#section' that was not configured to cascade persist operations for entity: Marché"
*
* Arrive sur les pages générées via le cache HTTP (CacheController.php)
*/
if ($sectionCurrent) { if ($sectionCurrent) {
$this->cacheSectionCurrent = $sectionCurrent;
//$this->cacheSectionCurrent = $sectionCurrent;
return $sectionCurrent; return $sectionCurrent;
} elseif ($returnVisitedIfOutOfSection && $currentVisitedSection) { } elseif ($returnVisitedIfOutOfSection && $currentVisitedSection) {
$this->cacheSectionVisited = $currentVisitedSection;
//$this->cacheSectionVisited = $currentVisitedSection;
return $currentVisitedSection; return $currentVisitedSection;
} elseif ($returnDefaultIfOutOfSections && $sectionDefault) { } elseif ($returnDefaultIfOutOfSections && $sectionDefault) {
$this->cacheSectionDefault = $sectionDefault;
//$this->cacheSectionDefault = $sectionDefault;
return $sectionDefault; return $sectionDefault;
} }



+ 6
- 4
Resources/views/admin/order/field/distribution.html.twig View File

{% endif %} {% endif %}
{% endif %} {% endif %}


{% if cycleType == "year" %}
A{{ distribution.cycleNumber }}
{% else %}
{{ labelCycleType ~ distribution.cycleNumber }}A{{ distribution.year|slice(2,2) }}
{% if cycleType is defined %}
{% if cycleType == "year" %}
A{{ distribution.cycleNumber }}
{% else %}
{{ labelCycleType ~ distribution.cycleNumber }}A{{ distribution.year|slice(2,2) }}
{% endif %}
{% endif %} {% endif %}

+ 5
- 0
Solver/Order/OrderShopSolver.php View File

} }
return $arrayComplementaryOrderShops; return $arrayComplementaryOrderShops;
} }
public function countValidComplementaryOrderShops(OrderShopInterface $orderShop): int
{
return count($this->getValidComplementaryOrderShops($orderShop));
}


public function getOrderStatusHistory(OrderShopInterface $orderShop, OrderStatusInterface $status) public function getOrderStatusHistory(OrderShopInterface $orderShop, OrderStatusInterface $status)
{ {

Loading…
Cancel
Save