瀏覽代碼

Correctif mineur

packProduct
Fabien Normand 3 年之前
父節點
當前提交
a676c398a6
共有 1 個文件被更改,包括 28 次插入5 次删除
  1. +28
    -5
      Generator/OrderReferenceGenerator.php

+ 28
- 5
Generator/OrderReferenceGenerator.php 查看文件

@@ -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

Loading…
取消
儲存