| @@ -10,4 +10,5 @@ themes | |||
| /* | |||
| !README.txt | |||
| !.gitignore | |||
| !/modules | |||
| !/modules | |||
| !update.sql | |||
| @@ -1,22 +1,46 @@ | |||
| - axico id starts from 1 instead of 0 | |||
| - axico id can be higher than 999, as 1000 and 1001 etc, starting numbers will still have 3 characters, like ABCCBA001 | |||
| - new product now can be added trough a file to the uplodaded products, as if it was inside the excel file | |||
| - newly added product can be confirmed as ACTIVATED | |||
| - saving a newly added product redirects on its self for further editing that allows inspecting its generated details as well | |||
| - user is informed if no product can be found in the excel file | |||
| - files now can have up to 25 sheets instead of 20 | |||
| - default warranty can be set and saved in config form | |||
| - axico id warranty entities can be listed and edited | |||
| - axico id warranty entities can be refreshed from axic id table | |||
| - new axico id warranties are stored with default warranty from drupal config | |||
| - after saving a new product category or component, a new axico id warranty is stored with default warranty from config | |||
| - products garancia field is filled trough | |||
| -- Változás napló 2023-01-19 | |||
| - az axico id 0 helyett 1-től kezdődik | |||
| - az axico id nagyobb lehet 999-nél, például 1000 és 1001 stb., | |||
| a kezdő számok továbbra is 3 karakterből állnak, mint például az ABCCBA001, | |||
| - új termék mostantól egy fájlon keresztül hiba nélkül hozzáadható a | |||
| feltöltött termékek listájához, mintha az az aktiv excel fájlban lett volna eredetileg is, | |||
| - az ilyen módon, újonnan hozzáadott termék AKTIVÁLHATÓ, mint az élő adatbázisban szereplő termék, | |||
| - az ilyen módon, újonnan hozzáadott termék mentése önmagára irányít át további szerkesztésre, | |||
| amely lehetővé teszi a generált adatok részleteinek ellenőrzését is, | |||
| - a felhasználó értesítést kap, ha az excel fájlban nem található termék, | |||
| - FIGYELEM: az excel fájl formázása fennakadásokat okozhat, ezért célszerű eltávolitani | |||
| minden formázást az összes oszlopról, különösen az árat illetőleg, | |||
| csak számok szerepeljenek benne, pl 123.12 . Ezt, a cella oszlopot kijelölve a | |||
| format: Text/Number, General segítségével tudjuk elérni. | |||
| Semmiféleképpen sem legyen financial vagy currency jellegű az oszlop celláinak formázása, | |||
| - a fájlok 20 helyett legfeljebb 25 munkalapból állhatnak, | |||
| - az alapértelmezett garanciaérték (hónapokban) beállítható és elmenthető konfigurációs formában, | |||
| - az axico id garanciális entitások listázhatók és szerkeszthetők, | |||
| - az axico id garanciális entitások frissíthetők az axico id táblázatból | |||
| (ezt csak 1x kell elvégezni a frissítés után, újra importálás során feltöltődik minden komponens és termékcsoport mentése után), | |||
| - az új axico id garancia entitások a drupal config alapértelmezett jótállási értékével vannak tárolva, | |||
| - új termékkategória vagy komponens mentésekor új axico id garancia kerül tárolásra | |||
| a konfigurációból származó alapértelmezett garancia értékkel, | |||
| - a termékek garancia mezője az alábbi munkafolyamatokban töltődik be: | |||
| a.) excel import, garancia és korábbi jótállás be van állítva: | |||
| - alapértelmezett jótállási érték a konfigurációból (ha nincs megadva az excel fájlban), | |||
| - a korábbi garancia 0-ra van állítva, | |||
| b.) ismert termék - a termékek összehasonlítása munkafolyamatban, | |||
| az ismert termékek axico id garancia entitása alapján | |||
| c.) új termék - kategóriafrissítésről vagy komponens frissítésről | |||
| d.) termék hozzáadása vagy szerkesztése | |||
| - a termékek "Frissitendo" jelzéssel lesznek ellátva, ha a korábbi garancia eltér a korábbi jótállástól | |||
| - a garanciális változásokat a rendszer felismeri és megjeleníti a feltöltött termékek listájában, | |||
| kék (korábbi) vagy zöld (módosított) egész értékkel jelölve (hónapokban az egérmutatót a zöld bal/jobb nyilakon jelzik), | |||
| ha az aktuális garancia (lásd fentebb a módszereket) eltér a korábbi garancia értéktől, | |||
| - a garanciális változtatásokat is szinkronizálni kell a Correcttel, | |||
| @@ -30,7 +30,8 @@ services: | |||
| arguments: ['@database', '@current_user', '@datetime.time'] | |||
| arlista.product.factory: | |||
| class: Drupal\arlista\Factory\ProductFactory | |||
| arguments: ['@database', '@current_user', '@datetime.time', '@arlista.axico-id.factory', '@arlista.category.factory', '@arlista.component.factory', '@arlista.manufacturer.factory', '@arlista.calculation.factory','@arlista.cache-service'] | |||
| arguments: ['@database', '@current_user', '@datetime.time', '@arlista.axico-id.factory', '@arlista.category.factory', '@arlista.component.factory', '@arlista.manufacturer.factory', '@arlista.calculation.factory','@arlista.cache-service', | |||
| '@arlista.warranty.factory'] | |||
| arlista.product.service: | |||
| class: Drupal\arlista\Service\ProductService | |||
| arguments: ['@arlista.product.factory','@arlista.file.factory'] | |||
| @@ -39,4 +40,5 @@ services: | |||
| arguments: ['@database', '@current_user', '@datetime.time'] | |||
| arlista.spread-sheet.factory: | |||
| class: Drupal\arlista\Factory\SpreadSheetFactory | |||
| arguments: ['@arlista.component.factory','@arlista.manufacturer.factory','@arlista.category.factory'] | |||
| arguments: ['@arlista.component.factory','@arlista.manufacturer.factory', | |||
| '@arlista.category.factory', '@config.factory'] | |||
| @@ -663,15 +663,7 @@ class Product extends AbstractEntity { | |||
| } | |||
| public function isProductWarrantyChanged(Product $product): bool { | |||
| return false; | |||
| /** | |||
| * TODO delete or change this | |||
| */ | |||
| /* if ($product->getPrevWarranty()) { | |||
| return $this->warranty != $product->getPrevWarranty(); | |||
| } | |||
| return false; */ | |||
| return $this->warranty != $product->getPrevWarranty(); | |||
| } | |||
| } | |||
| @@ -525,14 +525,6 @@ class AxicoIdFactory extends AbstractFactory { | |||
| ->fetchAll(); | |||
| return $axicoIds; | |||
| /*$distinct = []; | |||
| foreach ($axicoIds as $axicoId){ | |||
| if(!isset($distinct[$axicoId->getName()])){ | |||
| $distinct[$axicoId->getName()] = $axicoId->getName(); | |||
| } | |||
| } | |||
| return $distinct;*/ | |||
| } | |||
| } | |||
| @@ -22,6 +22,8 @@ class AxicoIdWarrantyFactory extends AbstractFactory | |||
| { | |||
| $entity = new AxicoIdWarranty(); | |||
| $entity->setDefaultWarranty($this->config->get('default_warranty')); | |||
| return $entity; | |||
| } | |||
| protected function insert(AbstractEntity $entity): AxicoIdWarranty | |||
| @@ -108,4 +110,10 @@ class AxicoIdWarrantyFactory extends AbstractFactory | |||
| return $this->load($data); | |||
| } | |||
| public function findByProductAxicoIdName(string $productAxicoId): AxicoIdWarranty { | |||
| $productAxicoId = preg_replace('/[0-9]+/', '', $productAxicoId); | |||
| return $this->findByAxicoIdName($productAxicoId); | |||
| } | |||
| } | |||
| @@ -24,6 +24,7 @@ use Drupal\arlista\Factory\CategoryFactory; | |||
| use Drupal\arlista\Factory\ComponentFactory; | |||
| use Drupal\arlista\Factory\ManufacturerFactory; | |||
| use Drupal\arlista\Factory\CalculationFactory; | |||
| use Drupal\arlista\Factory\AxicoIdWarrantyFactory; | |||
| use Drupal\arlista\Service\CacheService; | |||
| use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; | |||
| use Drupal\arlista\Entity\PackingMaterial; | |||
| @@ -40,12 +41,14 @@ class ProductFactory extends AbstractFactory { | |||
| private ManufacturerFactory $manufacturerFactory; | |||
| private CacheService $cacheService; | |||
| private CalculationFactory $calculationFactory; | |||
| private AxicoIdWarrantyFactory $axicoIdWarrantyFactory; | |||
| private array $fontAwesomeIcons = []; | |||
| public function __construct(Connection $connection, AccountInterface $currentUser, | |||
| TimeInterface $time, AxicoIdFactory $axicoIdFactory, CategoryFactory $categoryFactory, | |||
| ComponentFactory $componentFactory, ManufacturerFactory $manufacturerFactory, | |||
| CalculationFactory $calculationFactory, CacheService $cacheService) { | |||
| CalculationFactory $calculationFactory, CacheService $cacheService, | |||
| AxicoIdWarrantyFactory $axicoIdWarrantyFactory) { | |||
| parent::__construct($connection, $currentUser, $time, 'uploaded_product'); | |||
| $this->axicoIdFactory = $axicoIdFactory; | |||
| $this->categoryFactory = $categoryFactory; | |||
| @@ -53,6 +56,7 @@ class ProductFactory extends AbstractFactory { | |||
| $this->manufacturerFactory = $manufacturerFactory; | |||
| $this->calculationFactory = $calculationFactory; | |||
| $this->cacheService = $cacheService; | |||
| $this->axicoIdWarrantyFactory = $axicoIdWarrantyFactory; | |||
| $this->setFontAwesomeIcons(); | |||
| } | |||
| @@ -276,6 +280,11 @@ class ProductFactory extends AbstractFactory { | |||
| $product->setCalculation($calculation); | |||
| $product->calculatePrices(); | |||
| } | |||
| // Axico Id is set from existing product data | |||
| $axicoIdWarranty = $this->axicoIdWarrantyFactory->findByProductAxicoIdName($product->getAxicoId()); | |||
| $product->setWarranty($axicoIdWarranty->getDefaultWarranty()); | |||
| /* | |||
| * Detect product data changes in | |||
| * 1 price | |||
| @@ -404,6 +413,7 @@ class ProductFactory extends AbstractFactory { | |||
| if ($result['revokeAxicoId']) { | |||
| $product->setParentCategoryId(null); | |||
| $product->setParentComponentId(null); | |||
| $product->setWarranty(0); | |||
| $product = $this->save($product); | |||
| $result['optionValues'][$product->getId()] = $revokeAxicoIdselectOptionValue; | |||
| $result['revokedProducts'][$product->getId()] = $product; | |||
| @@ -425,6 +435,8 @@ class ProductFactory extends AbstractFactory { | |||
| */ | |||
| if (!empty($existingProduct->getAxicoId())) { | |||
| $product->copyBaseProperties($existingProduct); | |||
| $axicoIdWarranty = $this->axicoIdWarrantyFactory->findByProductAxicoIdName($existingProduct->getAxicoId()); | |||
| $product->setWarranty($axicoIdWarranty->getDefaultWarranty()); | |||
| $product->setWorkFlow(WorkFlow::NUMBERED); | |||
| $product = $this->save($product); | |||
| $result['axicoId'][$product->getId()] = $product->getAxicoId(); | |||
| @@ -486,6 +498,8 @@ class ProductFactory extends AbstractFactory { | |||
| $product->setAxicoId($existingAxicoIdEntity->getNextAxicoIdName() . $this->getAxicoIdFactory()->addZeros($existingAxicoIdEntity->getCurrentCount())); | |||
| $product->setWorkFlow(WorkFlow::NUMBERED); | |||
| $axicoIdWarranty = $this->axicoIdWarrantyFactory->findByProductAxicoIdName($product->getAxicoId()); | |||
| $product->setWarranty($axicoIdWarranty->getDefaultWarranty()); | |||
| $product = $this->save($product); | |||
| $result['axicoId'][$product->getId()] = $product->getAxicoId(); | |||
| @@ -526,6 +540,8 @@ class ProductFactory extends AbstractFactory { | |||
| $product->setAxicoId($newAxicoIdEntity->getNextAxicoIdName() . $this->getAxicoIdFactory()->addZeros($newAxicoIdEntity->getCurrentCount())); | |||
| $product->setWorkFlow(WorkFlow::NUMBERED); | |||
| $axicoIdWarranty = $this->axicoIdWarrantyFactory->findByProductAxicoIdName($product->getAxicoId()); | |||
| $product->setWarranty($axicoIdWarranty->getDefaultWarranty()); | |||
| $product = $this->save($product); | |||
| $result['axicoId'][$product->getId()] = $product->getAxicoId(); | |||
| @@ -16,6 +16,7 @@ use Drupal\arlista\Entity\Category; | |||
| use Drupal\arlista\Entity\PackingMaterial; | |||
| use Drupal\arlista\Entity\MeasureUnit; | |||
| use Drupal\arlista\Factory\CategoryFactory; | |||
| use Drupal\Core\Config\ConfigFactoryInterface; | |||
| use PhpOffice\PhpSpreadsheet\Cell\DataType; | |||
| class SpreadSheetFactory extends AbstractSpreadSheetFactory { | |||
| @@ -31,10 +32,13 @@ class SpreadSheetFactory extends AbstractSpreadSheetFactory { | |||
| * Class constructor. | |||
| */ | |||
| public function __construct(ComponentFactory $componentFactory, | |||
| ManufacturerFactory $manufacturerFactory, CategoryFactory $categoryFactory) { | |||
| ManufacturerFactory $manufacturerFactory, CategoryFactory $categoryFactory, | |||
| ConfigFactoryInterface $configFactory) { | |||
| $this->componentFactory = $componentFactory; | |||
| $this->manufacturerFactory = $manufacturerFactory; | |||
| $this->categoryFactory = $categoryFactory; | |||
| $this->config = $configFactory->get('arlista.settings'); | |||
| } | |||
| public function getComponentFactory(): ComponentFactory { | |||
| @@ -177,10 +181,12 @@ class SpreadSheetFactory extends AbstractSpreadSheetFactory { | |||
| return $result; | |||
| } | |||
| // Add default warranty value from config | |||
| private function findWarrantyData(Product $product): Product { | |||
| if (empty($product->getWarranty())) { | |||
| $product->setWarranty(60); | |||
| $product->setPrevWarranty(60); | |||
| $product->setWarranty($this->config->get('default_warranty')); | |||
| $product->setPrevWarranty($this->config->get('default_warranty')); | |||
| return $product; | |||
| } | |||
| $product->setPrevWarranty($product->getWarranty()); | |||
| @@ -199,7 +199,7 @@ class ProductAdd extends ArlistaAbstractForm { | |||
| '#weight' => 130, | |||
| ]; | |||
| $form = $this->getSifField($form, $product, 75); | |||
| $form['items_wrapper']['sif']['#required'] = false; | |||
| $form['sif']['#required'] = false; | |||
| $form['items_wrapper']['listable'] = [ | |||
| '#title' => 'Listázható', | |||
| '#type' => 'checkbox', | |||
| @@ -114,9 +114,9 @@ | |||
| <span class="changed-data">{{ icons['change'] }}</span> | |||
| <div class="product-changes"> | |||
| {% if product.warranty is not same as(product.prevWarranty) and product.prevWarranty is not empty %} | |||
| <!-- <span>Garancia</span> | |||
| <span>Garancia</span> | |||
| <span class="previous-value">{{ product.prevWarranty }}</span> | |||
| <span class="new-value">{{ product.warranty }}</span> --> | |||
| <span class="new-value">{{ product.warranty }}</span> | |||
| {% endif %} | |||
| {% if product.notes is not same as(product.prevNotes) and product.prevNotes is not empty %} | |||
| <span>Megjegyzések</span> | |||
| @@ -0,0 +1,15 @@ | |||
| -- Update 2023-01-19 | |||
| CREATE TABLE IF NOT EXISTS `arlista_manager_axico_id_warranty` ( | |||
| `axico_id_name` varchar(128) DEFAULT NULL, | |||
| `default_warranty` int NOT NULL, | |||
| `created_at` datetime NOT NULL, | |||
| `created_by` int NOT NULL, | |||
| `modified_by` int DEFAULT NULL, | |||
| `modified_at` datetime DEFAULT NULL, | |||
| `deleted_at` datetime DEFAULT NULL, | |||
| `id` int NOT NULL AUTO_INCREMENT, | |||
| `status` tinyint NOT NULL DEFAULT '1', | |||
| `sif` varchar(32) DEFAULT NULL, | |||
| primary key (id) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | |||