@@ -49,7 +49,6 @@ abstract class SectionAdminController extends AbstractAdminController | |||
CKEditorField::new('description') | |||
->hideOnIndex(), | |||
BooleanField::new('isDefault'), | |||
BooleanField::new('isCommon'), | |||
StatusField::new('status'), | |||
], | |||
$this->getSeoPanel(), |
@@ -9,12 +9,13 @@ use Lc\SovBundle\Factory\AbstractFactory; | |||
class DistributionFactory extends AbstractFactory | |||
{ | |||
public function create(int $cycleNumber, int $year, SectionInterface $section):Distribution | |||
public function create(int $cycleNumber, int $year, string $cycleType, SectionInterface $section):Distribution | |||
{ | |||
$distribution = new Distribution(); | |||
$distribution->setSection($section); | |||
$distribution->setCycleNumber($cycleNumber); | |||
$distribution->setCycleType($cycleType); | |||
$distribution->setYear($year); | |||
return $distribution; |
@@ -92,11 +92,12 @@ final class AssociationField implements FieldInterface | |||
return $this; | |||
} | |||
public function addAndWhere($whereClause, $parameter): self | |||
public function addAndWhere($whereClause, $key, $value): self | |||
{ | |||
$this->queryBuilderParameters['leftJoin'][] = [ | |||
$this->queryBuilderParameters['andWhere'][] = [ | |||
'whereClause' => $whereClause, | |||
'parameter' => $parameter | |||
'key' => $key, | |||
'value' => $value | |||
]; | |||
return $this; | |||
@@ -147,7 +148,7 @@ final class AssociationField implements FieldInterface | |||
if (isset($param['andWhere'])) { | |||
foreach ($param['andWhere'] as $i => $whereClause) { | |||
$qb->andWhere($whereClause['whereClause'])->setParamater($whereClause['parameter']); | |||
$qb->andWhere($whereClause['whereClause'])->setParameter($whereClause['key'], $whereClause['value']); | |||
} | |||
} | |||
@@ -35,6 +35,11 @@ abstract class DistributionModel implements DistributionInterface, EntityInterfa | |||
*/ | |||
protected $year; | |||
/** | |||
* @ORM\Column(type="string", length=32) | |||
*/ | |||
protected $cycleType; | |||
public function getSection(): ?SectionInterface | |||
{ | |||
return $this->section; | |||
@@ -70,4 +75,17 @@ abstract class DistributionModel implements DistributionInterface, EntityInterfa | |||
return $this; | |||
} | |||
public function getCycleType(): ?string | |||
{ | |||
return $this->cycleType; | |||
} | |||
public function setCycleType(string $cycleType): self | |||
{ | |||
$this->cycleType = $cycleType; | |||
return $this; | |||
} | |||
} |
@@ -90,11 +90,6 @@ abstract class SectionModel extends AbstractFullEntity implements FilterMerchant | |||
*/ | |||
protected $openings; | |||
/** | |||
* @ORM\Column(type="boolean", nullable=true) | |||
*/ | |||
protected $isCommon; | |||
/** | |||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilySectionPropertyInterface", mappedBy="section") | |||
*/ | |||
@@ -409,18 +404,6 @@ abstract class SectionModel extends AbstractFullEntity implements FilterMerchant | |||
return $this; | |||
} | |||
public function getIsCommon(): ?bool | |||
{ | |||
return $this->isCommon; | |||
} | |||
public function setIsCommon(?bool $isCommon): self | |||
{ | |||
$this->isCommon = $isCommon; | |||
return $this; | |||
} | |||
/** | |||
* @return Collection|ProductFamilySectionPropertyInterface[] | |||
*/ |
@@ -28,4 +28,10 @@ class DistributionRepositoryQuery extends AbstractRepositoryQuery | |||
->andWhere('.cycleNumber = :cycleNumber') | |||
->setParameter('cycleNumber', $cycleNumber); | |||
} | |||
public function filterByCycleType(string $cycleType): self | |||
{ | |||
return $this | |||
->andWhere('.cycleType = :cycleType') | |||
->setParameter('cycleType', $cycleType); | |||
} | |||
} |
@@ -39,11 +39,13 @@ class DistributionStore extends AbstractStore | |||
public function getOneByCycleNumberYearAndSection( | |||
int $cycleNumber, | |||
int $year, | |||
string $cycleType, | |||
SectionInterface $section | |||
): ?Distribution { | |||
$query = $this->createQuery(); | |||
$query->filterByCycleNumber($cycleNumber); | |||
$query->filterByYear($year); | |||
$query->filterByCycleType($cycleType); | |||
$query->filterBySection($section); | |||
return $query->findOne(); |
@@ -38,7 +38,8 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery | |||
public function filterBySection(SectionInterface $section) | |||
{ | |||
$this->joinProductFamilySectionProperties(); | |||
return $this->andWhereSection('pfsp', $section); | |||
$this->andWhereSection('pfsp', $section); | |||
$this->andWhere('pfsp.status = 1'); | |||
} | |||
@@ -20,9 +20,6 @@ class SectionRepositoryQuery extends AbstractRepositoryQuery | |||
return $this->andWhereEqual('isDefault', $isDefault); | |||
} | |||
public function filterByIsCommon(bool $isCommon) | |||
{ | |||
return $this->andWhereEqual('isCommon', $isCommon); | |||
} | |||
} |
@@ -76,11 +76,5 @@ class SectionStore extends AbstractStore | |||
// @TODO : à implémenter avec le nouveau système d'ouverture des commandes | |||
} | |||
public function getOnlineWithoutCommon($query = null) | |||
{ | |||
$query = $this->createDefaultQuery($query); | |||
$query->filterByIsCommon(false); | |||
return $query->find(); | |||
} | |||
} |
@@ -76,5 +76,10 @@ class SectionResolver | |||
} | |||
} | |||
public function getDefault():SectionInterface | |||
{ | |||
return $this->sectionStore->setMerchant($this->merchantResolver->getCurrent())->getOneDefault(); | |||
} | |||
} |
@@ -105,7 +105,6 @@ entity: | |||
fields: | |||
cycle: Cycle de vente | |||
isDefault: Section par défaut | |||
isCommon: Section commune | |||
TaxRate: | |||
label: Règle de taxe | |||
label_plurial: Règles de taxes |