Pārlūkot izejas kodu

Correctif mineur

packProduct
Fabien Normand pirms 3 gadiem
vecāks
revīzija
a676c398a6
1 mainītis faili ar 28 papildinājumiem un 5 dzēšanām
  1. +28
    -5
      Generator/OrderReferenceGenerator.php

+ 28
- 5
Generator/OrderReferenceGenerator.php Parādīt failu

@@ -18,18 +18,41 @@ class OrderReferenceGenerator

public function buildReference(OrderShopInterface $orderShop): string
{
$complementaryIndex = null;

if ($orderShop->getMainOrderShop()) {
$complementaryIndex = 1;
foreach ($orderShop->getMainOrderShop()->getComplementaryOrderShops() as $complementaryOrder) {
if ($complementaryOrder->isValid()) $complementaryIndex++;
}
$orderShop = $complementaryOrder->getMainOrderShop();

}

switch ($orderShop->getSection()->getCycleType()) {
case SectionModel::CYCLE_TYPE_DAY:
return $this->buildReferenceCycleDay($orderShop);
$reference = $this->buildReferenceCycleDay($orderShop);
break;
case SectionModel::CYCLE_TYPE_WEEK:
return $this->buildReferenceCycleWeek($orderShop);
$reference = $this->buildReferenceCycleWeek($orderShop,);
break;
case SectionModel::CYCLE_TYPE_MONTH:
return $this->buildReferenceCycleMonth($orderShop);
$reference = $this->buildReferenceCycleMonth($orderShop);
break;
case SectionModel::CYCLE_TYPE_YEAR:
return $this->buildReferenceCycleYear($orderShop);
$reference = $this->buildReferenceCycleYear($orderShop);
break;
default:
$reference = 'C' . $orderShop->getId();
break;
}

return 'C' . $orderShop->getId();
if($complementaryIndex){
$reference = $reference.'C'.$this->numberPad($complementaryIndex, 1);
}

return $reference;

}

public function buildReferenceCycleDay(OrderShopInterface $orderShop): string

Notiek ielāde…
Atcelt
Saglabāt