Просмотр исходного кода

ssg sup 374-373-375 fixes

master
Dukai Károly 3 лет назад
Родитель
Сommit
e4f0690e0d
5 измененных файлов: 17 добавлений и 11 удалений
  1. +6
    -3
      modules/custom/arlista/src/Factory/EnabledGroupFactory.php
  2. +2
    -5
      modules/custom/arlista/src/Factory/ProductFactory.php
  3. +1
    -1
      modules/custom/arlista/src/Form/Calculation/CalculationEdit.php
  4. +2
    -2
      modules/custom/arlista/src/Form/EnabledGroup/EnabledGroupListForm.php
  5. +6
    -0
      modules/custom/arlista/src/Form/Product/ProductUploadedList.php

+ 6
- 3
modules/custom/arlista/src/Factory/EnabledGroupFactory.php Просмотреть файл

@@ -21,7 +21,7 @@ class EnabledGroupFactory extends AbstractFactory {
return new EnabledGroup();
}

public function updateSheetSettingsEnabledGroups(int $sheetSettingId, array $newGroups, string $componentBased = null): void {
public function updateSheetSettingsEnabledGroups(int $sheetSettingId, array $newGroups, bool $componentBased): void {
$activeGroups = $this->findAllEnabledGroups($sheetSettingId, $componentBased);
foreach ($activeGroups as $activeGroup) {
if ($activeGroup->isComponentBased() && $componentBased) {
@@ -45,13 +45,15 @@ class EnabledGroupFactory extends AbstractFactory {
}
}

public function findAllEnabledGroups(int $sheetSettingId = null, string $componentBased = null): array {
public function findAllEnabledGroups(int $sheetSettingId = null, bool $componentBased): array {
$list = [];
if ($componentBased) {
if ($sheetSettingId) {
if ($sheetSettingId !== null) {
\Drupal::messenger()->addStatus('not null'.$sheetSettingId.' '.$componentBased);
$list = $this->getConnection()
->select($this->getActiveTable(), 'w')
->fields('w')
->condition('w.status', Status::ACTIVE)
->condition('sheet_setting_id', $sheetSettingId)
->isNull('w.deleted_at')
->isNull('w.category_id')
@@ -59,6 +61,7 @@ class EnabledGroupFactory extends AbstractFactory {
->execute()
->fetchAll();
} else {
\Drupal::messenger()->addStatus('not null'.$sheetSettingId.' '.$componentBased);
$list = $this->getConnection()
->select($this->getActiveTable(), 'w')
->fields('w')

+ 2
- 5
modules/custom/arlista/src/Factory/ProductFactory.php Просмотреть файл

@@ -355,9 +355,6 @@ class ProductFactory extends AbstractFactory {
if ($product->getFabricName()) {
$needles[] = $product->getFabricName();
}
if (empty($needles)) {
return $existingProduct;
}
foreach ($fields as $field) {
if (!empty($existingProduct)) {
continue;
@@ -1050,7 +1047,7 @@ class ProductFactory extends AbstractFactory {
return $entities;
}

protected function insert(AbstractEntity $entity): Product {
protected function insert($entity): Product {
$id = $this->getConnection()
->insert($this->getActiveTable())
->fields([
@@ -1111,7 +1108,7 @@ class ProductFactory extends AbstractFactory {
return $entity;
}

protected function update(AbstractEntity $entity): Product {
protected function update($entity): Product {
$this->getConnection()
->update($this->getActiveTable())
->fields([

+ 1
- 1
modules/custom/arlista/src/Form/Calculation/CalculationEdit.php Просмотреть файл

@@ -241,7 +241,7 @@ class CalculationEdit extends ArlistaAbstractForm {

public function getEnabledCategoriesRenderedForm(array $form): array {
$this->categories = $this->getCategoryFactory()->findAllActive('name', 'ASC');
$enabledGroups = $this->getEnabledGroupFactory()->findAllEnabledGroups(null, null);
$enabledGroups = $this->getEnabledGroupFactory()->findAllEnabledGroups(null, false);
$selected = [];
/* @var $enabledGroup EnabledGroup */
foreach ($enabledGroups as $enabledGroup) {

+ 2
- 2
modules/custom/arlista/src/Form/EnabledGroup/EnabledGroupListForm.php Просмотреть файл

@@ -47,7 +47,7 @@ class EnabledGroupListForm extends ArlistaAbstractForm {
public function getEnableCategoriesForm(array $form, int $mid, int $sheetSettingId): array {

$categories = $this->getCategoryFactory()->findAllActive('name', 'ASC');
$enabledGroups = $this->getEnabledGroupFactory()->findAllEnabledGroups($sheetSettingId, null);
$enabledGroups = $this->getEnabledGroupFactory()->findAllEnabledGroups($sheetSettingId, false);
$selected = [];
/* @var $enabledGroup EnabledGroup */
foreach ($enabledGroups as $enabledGroup) {
@@ -190,7 +190,7 @@ class EnabledGroupListForm extends ArlistaAbstractForm {
unset($enabled[$key]);
}
}
$this->getEnabledGroupFactory()->updateSheetSettingsEnabledGroups($this->sheetSettingId, $enabled);
$this->getEnabledGroupFactory()->updateSheetSettingsEnabledGroups($this->sheetSettingId, $enabled, false);
$this->getCacheService()->resetCache([
'arlista_product_uploaded_list_form', $this->mid, $this->sheetSettingId, 'enabled_categories']);
\Drupal::messenger()->addStatus('Sikeres mentés!');

+ 6
- 0
modules/custom/arlista/src/Form/Product/ProductUploadedList.php Просмотреть файл

@@ -229,6 +229,12 @@ class ProductUploadedList extends ArlistaAbstractForm {
$enabledComponents[$component->getId()] = $component;
}
}
/* @var $enabledGroup EnabledGroup */
/*foreach($enabledGroups as $enabledGroup) {
if (isset($enabledGroups[$component->getId()])) {
$enabledComponents[$component->getId()] = $component;
}
}*/
$this->manufacturersList = $this->getComponentManufacturersList($enabledComponents);
$this->enabledComponents = $enabledComponents;
//$this->getCacheService()->setCachedDataByName([$this->getFormId(), $manufacturer->getId(),

Загрузка…
Отмена
Сохранить