Pārlūkot izejas kodu

ManyToMany on ProductFamily/Section + gestion stock + adaptation import

packProduct
Fabien Normand pirms 3 gadiem
vecāks
revīzija
55ff4aed0c
12 mainītis faili ar 41 papildinājumiem un 35 dzēšanām
  1. +0
    -1
      Controller/Section/SectionAdminController.php
  2. +2
    -1
      Factory/Distribution/DistributionFactory.php
  3. +5
    -4
      Field/AssociationField.php
  4. +18
    -0
      Model/Distribution/DistributionModel.php
  5. +0
    -17
      Model/Section/SectionModel.php
  6. +6
    -0
      Repository/Distribution/DistributionRepositoryQuery.php
  7. +2
    -0
      Repository/Distribution/DistributionStore.php
  8. +2
    -1
      Repository/Product/ProductFamilyRepositoryQuery.php
  9. +1
    -4
      Repository/Section/SectionRepositoryQuery.php
  10. +0
    -6
      Repository/Section/SectionStore.php
  11. +5
    -0
      Resolver/SectionResolver.php
  12. +0
    -1
      Resources/translations/admin.fr.yaml

+ 0
- 1
Controller/Section/SectionAdminController.php Parādīt failu

CKEditorField::new('description') CKEditorField::new('description')
->hideOnIndex(), ->hideOnIndex(),
BooleanField::new('isDefault'), BooleanField::new('isDefault'),
BooleanField::new('isCommon'),
StatusField::new('status'), StatusField::new('status'),
], ],
$this->getSeoPanel(), $this->getSeoPanel(),

+ 2
- 1
Factory/Distribution/DistributionFactory.php Parādīt failu

class DistributionFactory extends 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 = new Distribution();


$distribution->setSection($section); $distribution->setSection($section);
$distribution->setCycleNumber($cycleNumber); $distribution->setCycleNumber($cycleNumber);
$distribution->setCycleType($cycleType);
$distribution->setYear($year); $distribution->setYear($year);


return $distribution; return $distribution;

+ 5
- 4
Field/AssociationField.php Parādīt failu

return $this; return $this;
} }


public function addAndWhere($whereClause, $parameter): self
public function addAndWhere($whereClause, $key, $value): self
{ {
$this->queryBuilderParameters['leftJoin'][] = [
$this->queryBuilderParameters['andWhere'][] = [
'whereClause' => $whereClause, 'whereClause' => $whereClause,
'parameter' => $parameter
'key' => $key,
'value' => $value
]; ];


return $this; return $this;


if (isset($param['andWhere'])) { if (isset($param['andWhere'])) {
foreach ($param['andWhere'] as $i => $whereClause) { foreach ($param['andWhere'] as $i => $whereClause) {
$qb->andWhere($whereClause['whereClause'])->setParamater($whereClause['parameter']);
$qb->andWhere($whereClause['whereClause'])->setParameter($whereClause['key'], $whereClause['value']);
} }
} }



+ 18
- 0
Model/Distribution/DistributionModel.php Parādīt failu

*/ */
protected $year; protected $year;


/**
* @ORM\Column(type="string", length=32)
*/
protected $cycleType;

public function getSection(): ?SectionInterface public function getSection(): ?SectionInterface
{ {
return $this->section; return $this->section;


return $this; return $this;
} }


public function getCycleType(): ?string
{
return $this->cycleType;
}

public function setCycleType(string $cycleType): self
{
$this->cycleType = $cycleType;

return $this;
}
} }

+ 0
- 17
Model/Section/SectionModel.php Parādīt failu

*/ */
protected $openings; protected $openings;


/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isCommon;

/** /**
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilySectionPropertyInterface", mappedBy="section") * @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilySectionPropertyInterface", mappedBy="section")
*/ */
return $this; return $this;
} }


public function getIsCommon(): ?bool
{
return $this->isCommon;
}

public function setIsCommon(?bool $isCommon): self
{
$this->isCommon = $isCommon;

return $this;
}

/** /**
* @return Collection|ProductFamilySectionPropertyInterface[] * @return Collection|ProductFamilySectionPropertyInterface[]
*/ */

+ 6
- 0
Repository/Distribution/DistributionRepositoryQuery.php Parādīt failu

->andWhere('.cycleNumber = :cycleNumber') ->andWhere('.cycleNumber = :cycleNumber')
->setParameter('cycleNumber', $cycleNumber); ->setParameter('cycleNumber', $cycleNumber);
} }
public function filterByCycleType(string $cycleType): self
{
return $this
->andWhere('.cycleType = :cycleType')
->setParameter('cycleType', $cycleType);
}
} }

+ 2
- 0
Repository/Distribution/DistributionStore.php Parādīt failu

public function getOneByCycleNumberYearAndSection( public function getOneByCycleNumberYearAndSection(
int $cycleNumber, int $cycleNumber,
int $year, int $year,
string $cycleType,
SectionInterface $section SectionInterface $section
): ?Distribution { ): ?Distribution {
$query = $this->createQuery(); $query = $this->createQuery();
$query->filterByCycleNumber($cycleNumber); $query->filterByCycleNumber($cycleNumber);
$query->filterByYear($year); $query->filterByYear($year);
$query->filterByCycleType($cycleType);
$query->filterBySection($section); $query->filterBySection($section);


return $query->findOne(); return $query->findOne();

+ 2
- 1
Repository/Product/ProductFamilyRepositoryQuery.php Parādīt failu

public function filterBySection(SectionInterface $section) public function filterBySection(SectionInterface $section)
{ {
$this->joinProductFamilySectionProperties(); $this->joinProductFamilySectionProperties();
return $this->andWhereSection('pfsp', $section);
$this->andWhereSection('pfsp', $section);
$this->andWhere('pfsp.status = 1');
} }





+ 1
- 4
Repository/Section/SectionRepositoryQuery.php Parādīt failu

return $this->andWhereEqual('isDefault', $isDefault); return $this->andWhereEqual('isDefault', $isDefault);
} }


public function filterByIsCommon(bool $isCommon)
{
return $this->andWhereEqual('isCommon', $isCommon);
}



} }

+ 0
- 6
Repository/Section/SectionStore.php Parādīt failu

// @TODO : à implémenter avec le nouveau système d'ouverture des commandes // @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();
}


} }

+ 5
- 0
Resolver/SectionResolver.php Parādīt failu

} }
} }


public function getDefault():SectionInterface
{
return $this->sectionStore->setMerchant($this->merchantResolver->getCurrent())->getOneDefault();
}



} }

+ 0
- 1
Resources/translations/admin.fr.yaml Parādīt failu

fields: fields:
cycle: Cycle de vente cycle: Cycle de vente
isDefault: Section par défaut isDefault: Section par défaut
isCommon: Section commune
TaxRate: TaxRate:
label: Règle de taxe label: Règle de taxe
label_plurial: Règles de taxes label_plurial: Règles de taxes

Notiek ielāde…
Atcelt
Saglabāt