ver. 0.277: ShopProduct factory, Dashboard, Update migration, legacy cleanup, admin\App

- ShopProduct factory: full migration (~40 ProductRepository methods, ~30 controller actions)
- Dashboard: Domain+DI migration (DashboardRepository + DashboardController)
- Update: Domain+DI migration (UpdateRepository + UpdateController, template rewrite)
- Renamed admin\Site to admin\App, removed dead fallback routing
- Removed all legacy folders: admin/controls, admin/factory, admin/view
- Newsletter: switched from admin\factory\Articles to ArticleRepository
- 414 tests, 1335 assertions passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 01:06:29 +01:00
parent be93a7e330
commit 74343b0f33
51 changed files with 4960 additions and 5403 deletions

View File

@@ -4,21 +4,43 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
---
## ver. 0.277 (2026-02-15) - Stabilizacja ShopOrder + Integrations + Global Search
## ver. 0.277 (2026-02-16) - ShopProduct factory, Dashboard, Update, legacy cleanup, admin\App
- **ShopProduct (factory)** - pelna migracja modulu #29 na Domain + DI
- NOWE: `ProductRepository` rozszerzony o ~40 metod: CRUD (countProducts, listForAdmin, findForAdmin, allProductsList, productCategoriesText, getParentId, productDefaultName), zapis (saveProduct + 9 prywatnych helperow), operacje (delete, duplicate, toggleStatus, updatePriceBrutto/Promo, updateCustomLabel), kombinacje (getPermutations, generateCombinations, deleteCombination, countCombinations, saveCombination*), zdjecia/pliki (deleteImage, updateImageAlt, saveImagesOrder, deleteFile, updateFileName, deleteNonassigned*), Google Feed XML (generateGoogleFeedXml, generateEAN), custom labels (customLabelSuggestions, saveCustomLabel, saveXmlName), updateCombinationPricesFromBase
- NOWE: `ShopProductController` rozszerzony o ~30 akcji: view_list, product_edit, save, duplicate_product, product_archive/unarchive, product_delete, change_product_status, product_change_price_brutto/promo, product_change_custom_label, product_custom_label_suggestions/save, ajax_product_url, generate_sku_code, product_combination, generate_combination, delete_combination, product_combination_*_save, image_delete, images_order_save, image_alt_change, product_file_delete, product_file_name_change, product_image_delete
- UPDATE: przepiecie zaleznosci zewnetrznych: `ProductArchiveController`, `order-details.php`, `cron.php`, `cron-xml.php`, `product-edit.php`, `mass-edit-custom-script.php`
- CLEANUP: usuniete `autoload/admin/controls/class.ShopProduct.php`, `autoload/admin/factory/class.ShopProduct.php`, `admin/ajax/shop.php` + require z `admin/ajax.php`
- **ShopOrder (stabilizacja po migracji)**
- FIX: `Domain\Order\OrderRepository::listForAdmin()` - poprawa zapytan SQL (count/list), bezpieczne fallbacki i poprawne zwracanie listy zamowien w `/admin/shop_order/list/`
- FIX: wyrównanie wysokości komórek w `components/table-list` (`vertical-align` + lokalny override dla `.text-right` w tabeli)
- **Integrations (cleanup)**
- CLEANUP: usunieta fasada `autoload/admin/factory/class.Integrations.php`
- UPDATE: przepięcie wywołań na `Domain\Integrations\IntegrationsRepository` w: `cron.php`, `shop\Order`, `admin\Controllers\ShopPaymentMethodController`, `admin\Controllers\ShopStatusesController`, `admin\Controllers\ShopTransportController`, `admin\controls\ShopProduct`
- UPDATE: przepięcie wywołań na `Domain\Integrations\IntegrationsRepository` w: `cron.php`, `shop\Order`, `admin\Controllers\ShopPaymentMethodController`, `admin\Controllers\ShopStatusesController`, `admin\Controllers\ShopTransportController`
- **Admin UX**
- NOWE: globalna wyszukiwarka w top-barze (obok "Wyczysc cache") dla produktow i zamowien
- NOWE: endpoint `/admin/settings/globalSearchAjax/` (`SettingsController::globalSearchAjax`)
- FIX: wsparcie wyszukiwania po pełnym imieniu i nazwisku (np. "Jan Kowalski") + poprawka escapingu SQL w `CONCAT_WS`
- **Dashboard** - migracja modulu #30 na Domain + DI
- NOWE: `Domain\Dashboard\DashboardRepository` (summaryOrders, summarySales, salesGrid, mostViewedProducts, bestSalesProducts, last24MonthsSales, lastOrders, Redis caching)
- NOWE: `admin\Controllers\DashboardController` (DI z DashboardRepository + ShopStatusRepository)
- CLEANUP: usuniete `autoload/admin/controls/class.Dashboard.php`, `autoload/shop/class.Dashboard.php`
- **Update** - migracja modulu #31 na Domain + DI
- NOWE: `Domain\Update\UpdateRepository` (update, runPendingMigrations, downloadAndApply, executeSql, deleteFiles, extractZip, saveLog)
- NOWE: `admin\Controllers\UpdateController` (DI z UpdateRepository)
- UPDATE: template `update/main-view.php` - usunieto `gridEdit` i `$.prompt()`, zastapiono panelami + `$.confirm()`/`$.alert()`
- CLEANUP: usuniete `autoload/admin/controls/class.Update.php`, `autoload/admin/factory/class.Update.php`, `autoload/admin/view/class.Update.php`
- **Legacy cleanup**
- CLEANUP: usunieto `autoload/admin/factory/class.Articles.php` (martwy kod, `articles_by_date_add` przeniesione do `ArticleRepository`)
- UPDATE: `front\factory\Newsletter` przepieta na `Domain\Article\ArticleRepository::articlesByDateAdd()`
- CLEANUP: usunieto `autoload/admin/view/class.Page.php`, logika przeniesiona do `admin\App::render()`
- CLEANUP: usuniete puste foldery `autoload/admin/controls/`, `autoload/admin/factory/`, `autoload/admin/view/`
- **admin\Site -> admin\App**
- UPDATE: klasa `admin\Site` przemianowana na `admin\App` (plik `App.php` bez przedrostka `class.`)
- UPDATE: refaktoring `App` — usunieto martwy fallback na `\admin\controls\`, uproszczono routing, ujednolicony code style
- TEST:
- Pelny suite: **OK (385 tests, 1246 assertions)**
- Test punktowy: `SettingsControllerTest` **OK (7 tests, 10 assertions)**
- NOWE: `DashboardControllerTest` (4), `DashboardRepositoryTest` (6), `UpdateControllerTest` (6), `UpdateRepositoryTest` (6)
- Pelny suite: **OK (414 tests, 1335 assertions)**
---

View File

@@ -347,5 +347,31 @@ Pelna dokumentacja testow: `TESTING.md`
- Przepieto zaleznosci `ShopProduct` z `admin\factory\ShopCategory` na `Domain\Category\CategoryRepository`.
- Usunieto preload `autoload/admin/factory/class.ShopCategory.php` z `libraries/grid/config.php`.
## Dodatkowa aktualizacja 2026-02-15 (ver. 0.277) - ShopProduct (factory)
- `Domain/Product/ProductRepository.php` rozszerzono o ~40 metod: CRUD, save, delete, duplicate, toggleStatus, updatePrice, kombinacje, zdjecia/pliki, Google Feed XML, custom labels.
- `admin/Controllers/ShopProductController.php` rozszerzono o ~30 akcji obslugujacych caly modul produktow.
- Konstruktor kontrolera teraz przyjmuje `ProductRepository` + `IntegrationsRepository`.
- Routing w `admin\Site` zaktualizowany (dodano `IntegrationsRepository`, blokada fallbacku na legacy).
- Przepieto zaleznosci zewnetrzne: `ProductArchiveController`, `order-details.php`, `cron.php`, `cron-xml.php`, `products-list-table.php`, `stock.php`.
- Przepieto endpointy AJAX z `admin/ajax.php` na kontroler: `product_file_delete`, `product_file_name_change`.
- Przepieto `cookie_categories` w widokach product-edit i mass-edit na `/admin/shop_category/cookie_categories/`.
- Usunieto legacy: `autoload/admin/controls/class.ShopProduct.php`, `autoload/admin/factory/class.ShopProduct.php`, `admin/ajax/shop.php`.
- Usunieto `require_once 'ajax/shop.php'` z `admin/ajax.php`.
## Dodatkowa aktualizacja 2026-02-16 (ver. 0.277) - Dashboard, Update, legacy cleanup, admin\App
- Dodano `Domain/Dashboard/DashboardRepository.php` (7 metod, Redis caching).
- Dodano `admin/Controllers/DashboardController.php` (DI z DashboardRepository + ShopStatusRepository).
- Dodano `Domain/Update/UpdateRepository.php` (update, runPendingMigrations, helper methods).
- Dodano `admin/Controllers/UpdateController.php` (DI z UpdateRepository).
- Przepisano `admin/templates/update/main-view.php` — usunieto `gridEdit`, `$.prompt()`, zastapiono panelami + `$.confirm()`.
- Usunieto `autoload/admin/factory/class.Articles.php` (martwy kod), przeniesiono `articles_by_date_add` do `ArticleRepository`.
- Przepieto `front\factory\Newsletter` na `ArticleRepository::articlesByDateAdd()`.
- Przeniesiono logike z `admin\view\Page::show()` do `admin\App::render()`.
- Przemianowano `admin\Site` na `admin\App` (plik `App.php`).
- Usunieto fallback na `\admin\controls\` w routing (martwy kod).
- Usunieto puste foldery: `autoload/admin/controls/`, `autoload/admin/factory/`, `autoload/admin/view/`.
- Usunieto stary plik `autoload/admin/class.Site.php`.
- Pelna migracja admin zakonczona — wszystkie moduly na Domain + DI + Controllers.
---
*Dokument aktualizowany: 2026-02-15*
*Dokument aktualizowany: 2026-02-16*

View File

@@ -130,7 +130,7 @@ grep -r "Product::getQuantity" .
| # | Modul | Wersja | Zakres |
|---|-------|--------|--------|
| 1 | Cache | 0.237 | CacheHandler, RedisConnection, clear_product_cache |
| 2 | Product | 0.238-0.252, 0.274 | getQuantity, getPrice, getName, archive/unarchive, allProductsForMassEdit, getProductsByCategory, applyDiscountPercent |
| 2 | Product | 0.238-0.252, 0.274, 0.277 | getQuantity, getPrice, getName, archive/unarchive, allProductsForMassEdit, getProductsByCategory, applyDiscountPercent, pelna migracja factory (CRUD, save, delete, duplicate, kombinacje, zdjecia/pliki, Google Feed XML) |
| 3 | Banner | 0.239 | find, delete, save, kontroler DI |
| 4 | Settings | 0.240/0.250 | saveSettings, getSettings, kontroler DI |
| 5 | Dictionaries | 0.251 | listForAdmin, find, save, delete, kontroler DI |
@@ -157,6 +157,11 @@ grep -r "Product::getQuantity" .
| 26 | ShopClients | 0.274 | DI kontroler + routing dla `list/details`, nowe listy na `components/table-list`, cleanup legacy controls/factory |
| 27 | ShopCategory | 0.275 | CategoryRepository + DI kontroler + routing, endpointy AJAX (`save_categories_order`, `save_products_order`, `cookie_categories`), cleanup legacy controls/factory/view |
| 28 | ShopOrder | 0.276 | OrderRepository + OrderAdminService + DI kontroler + routing + nowe widoki (`orders-list`, `order-details`, `order-edit`) + cleanup legacy controls/factory/view-list |
| 29 | ShopProduct (factory) | 0.277 | Pelna migracja factory: ProductRepository (CRUD, save, delete, duplicate, toggleStatus, updatePrice, kombinacje, zdjecia/pliki, Google Feed XML) + DI kontroler (list, edit, save, operacje, kombinacje, zdjecia/pliki) + routing + przepiecie zaleznosci (ProductArchive, order-details, cron, cron-xml, products-list-table, stock) + usunięcie legacy (controls, factory, ajax/shop.php) |
| 30 | Dashboard | 0.277 | DashboardRepository (7 metod, Redis caching) + DashboardController (DI) + cleanup legacy controls/shop |
| 31 | Update | 0.277 | UpdateRepository (update, runPendingMigrations, helper methods) + UpdateController (DI) + przepisany template (panele, $.confirm) + cleanup legacy controls/factory/view |
| 32 | Legacy cleanup | 0.277 | Usunieto admin/factory/Articles (martwy kod), admin/view/Page → App::render(), puste foldery controls/factory/view |
| 33 | admin\App | 0.277 | Rename Site → App, usunieto fallback na controls, uproszczony routing, plik App.php bez przedrostka class. |
### Product - szczegolowy status
- ✅ getQuantity (ver. 0.238)
@@ -166,19 +171,22 @@ grep -r "Product::getQuantity" .
- ✅ allProductsForMassEdit (ver. 0.274)
- ✅ getProductsByCategory (ver. 0.274)
- ✅ applyDiscountPercent (ver. 0.274)
- [ ] is_product_on_promotion
- [ ] getFromCache
- [ ] getProductImg
- ✅ countProducts, listForAdmin, findForAdmin, allProductsList, productCategoriesText, getParentId (ver. 0.277)
- ✅ saveProduct + helpery (ver. 0.277)
- ✅ delete, duplicate, toggleStatus, updatePriceBrutto/Promo, updateCustomLabel (ver. 0.277)
- ✅ getPermutations, generateCombinations, deleteCombination, countCombinations, saveCombination* (ver. 0.277)
- ✅ deleteImage, updateImageAlt, saveImagesOrder, deleteFile, updateFileName, generateGoogleFeedXml, generateEAN (ver. 0.277)
- ✅ updateCombinationPricesFromBase (ver. 0.277)
- [ ] is_product_on_promotion (frontend — osobna migracja)
- [ ] getFromCache (frontend — osobna migracja)
- [ ] getProductImg (frontend — osobna migracja)
### 📋 Do zrobienia
- ShopProduct (factory)
- Frontend: migracja `front\factory\ShopProduct`
## Kolejność refaktoryzacji (priorytet)
1-28: ✅ Cache, Product, Banner, Settings, Dictionaries, ProductArchive, Filemanager, Users, Pages, Integrations, ShopPromotion, ShopCoupon, ShopStatuses, ShopPaymentMethod, ShopTransport, ShopAttribute, ShopProductSets, ShopProducer, ShopProduct (mass_edit), ShopClients, ShopCategory, ShopOrder
Nastepne:
29. **ShopProduct (factory)**
1-33: ✅ Cache, Product, Banner, Settings, Dictionaries, ProductArchive, Filemanager, Users, Pages, Integrations, ShopPromotion, ShopCoupon, ShopStatuses, ShopPaymentMethod, ShopTransport, ShopAttribute, ShopProductSets, ShopProducer, ShopProduct (mass_edit), ShopClients, ShopCategory, ShopOrder, ShopProduct (factory), Dashboard, Update, Legacy cleanup, admin\App
## Form Edit System
@@ -279,7 +287,7 @@ tests/
│ └── UsersControllerTest.php
└── Integration/
```
**Lacznie: 338 testow, 1063 asercji**
**Lacznie: 390 testow, 1278 asercji**
Aktualizacja 2026-02-15 (ver. 0.273):
- dodano testy `tests/Unit/Domain/Producer/ProducerRepositoryTest.php`

View File

@@ -33,10 +33,16 @@ Alternatywnie (Git Bash):
## Aktualny stan suite
Ostatnio zweryfikowano: 2026-02-15
Ostatnio zweryfikowano: 2026-02-16
```text
OK (385 tests, 1246 assertions)
OK (414 tests, 1335 assertions)
```
Aktualizacja po migracji Dashboard + Update + legacy cleanup (2026-02-16, ver. 0.277):
```text
Pelny suite: OK (414 tests, 1335 assertions)
Nowe testy: DashboardControllerTest (4), DashboardRepositoryTest (6), UpdateControllerTest (6), UpdateRepositoryTest (6)
```
Aktualizacja po stabilizacji ShopOrder / Integrations / Global Search (2026-02-15, ver. 0.277):

View File

@@ -18,17 +18,17 @@ Aktualizacje znajdują się w folderze `updates/0.XX/` gdzie XX oznacza dziesią
## Procedura tworzenia nowej aktualizacji
## Status biezacej aktualizacji (ver. 0.276)
## Status biezacej aktualizacji (ver. 0.277)
- Wersja udostepniona: `0.276` (data: 2026-02-15).
- Wersja udostepniona: `0.277` (data: 2026-02-16).
- Pliki publikacyjne:
- `updates/0.20/ver_0.276.zip`
- `updates/0.20/ver_0.276_files.txt`
- `updates/0.20/ver_0.277.zip`
- `updates/0.20/ver_0.277_files.txt`
- Pliki metadanych aktualizacji:
- `updates/changelog.php` (dodany wpis `ver. 0.276`)
- `updates/versions.php` (`$current_ver = 276`)
- `updates/changelog.php` (dodany wpis `ver. 0.277`)
- `updates/versions.php` (`$current_ver = 277`)
- Weryfikacja testow przed publikacja:
- `OK (385 tests, 1246 assertions)`
- `OK (414 tests, 1335 assertions)`
### 1. Określ numer wersji
Sprawdź ostatnią wersję w `temp/` i zwiększ o 1.