43 Commits

Author SHA1 Message Date
Jacek
d3e3724cfb fix: Apilo email z danymi zamówienia + infinite retry co 30 min dla order jobów
- Email notyfikacji zawiera numer zamówienia, klienta, datę, kwotę
- Order joby (send_order, sync_payment, sync_status) ponawiane w nieskończoność co 30 min
- Rozróżnienie PONAWIANY vs TRWAŁY BŁĄD w emailu
- Cleanup stuck jobów po udanym wysłaniu zamówienia
- +2 testy infinite retry w CronJobRepositoryTest

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 11:23:02 +01:00
Jacek
5598888716 security: faza 4 - ochrona CSRF panelu administracyjnego
- Nowa klasa \Shared\Security\CsrfToken (generate/validate/regenerate)
- Token CSRF we wszystkich formularzach edycji (form-edit.php)
- Walidacja CSRF w FormRequestHandler::handleSubmit()
- Token CSRF w formularzu logowania i formularzach 2FA
- Walidacja CSRF w App::special_actions() dla żądań POST
- Regeneracja tokenu po udanym logowaniu (bezpośrednia i przez 2FA)
- Fix XSS: htmlspecialchars na $alert w unlogged-layout.php
- 7 nowych testów CsrfTokenTest (817 testów łącznie)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 10:06:40 +01:00
Jacek
c7be154d57 feat: ochrona przed podwójnym składaniem zamówienia (order submit token)
Token CSRF w sesji zapobiega duplikowaniu zamówień przy wielokrotnym
kliknięciu przycisku. Przy duplikacie przekierowanie do istniejącego
zamówienia. JS naprawiony — nasłuch na submit formularza zamiast click.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:50:21 +01:00
Jacek
34916b2dad feat: API produktów - nowe pola new_to_date i additional_message (v0.332)
- ProductRepository::getProductForApi() eksportuje new_to_date, additional_message,
  additional_message_required, additional_message_text
- ProductsApiController obsługuje te pola w PUT/PATCH
- Zaktualizowana dokumentacja API.md i CHANGELOG

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 22:08:12 +01:00
52119a0724 feat: database-backed cron job queue replacing JSON file system
Replace file-based JSON cron queue with DB-backed job queue (pp_cron_jobs,
pp_cron_schedules). New Domain\CronJob module: CronJobType (constants),
CronJobRepository (CRUD, atomic fetch, retry/backoff), CronJobProcessor
(orchestration with handler registration). Priority ordering guarantees
apilo_send_order (40) runs before sync tasks (50). Includes cron.php auth
protection, race condition fix in fetchNext, API response validation,
and DI wiring across all entry points. 41 new tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 13:29:11 +01:00
702e3a94be ver. 0.318: shopPRO export produktów + nowe API endpoints
- NEW: IntegrationsRepository::shopproExportProduct() — eksport produktu do
  zdalnej instancji shopPRO (pola główne, tłumaczenia, custom fields, zdjęcia)
- NEW: sendImageToShopproApi() — wysyłka zdjęć przez API shopPRO (base64 POST)
- REFACTOR: shopproImportProduct() — wydzielono shopproDb() i
  missingShopproSetting(); dodano security_information, producer_id,
  custom fields, alt zdjęcia
- NEW: AttributeRepository::ensureAttributeForApi() i
  ensureAttributeValueForApi() — idempotent find-or-create dla słowników
- NEW: API POST dictionaries/ensure_attribute — utwórz lub znajdź atrybut
- NEW: API POST dictionaries/ensure_attribute_value — utwórz lub znajdź wartość
- NEW: API POST products/upload_image — przyjmuje base64, zapisuje plik i DB
- NEW: IntegrationsController::shoppro_product_export() — akcja admina
- NEW: przycisk "Eksportuj do shopPRO" w liście produktów
- NEW: pole API key w ustawieniach integracji shopPRO

Tests: 765 tests, 2153 assertions — all green

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 11:43:17 +01:00
3ae0bc95e0 ver. 0.310: logi integracji w panelu admin
Nowa zakladka "Logi" w sekcji Integracje - podglad tabeli pp_log
z paginacja, sortowaniem, filtrami i rozwijalnym kontekstem JSON.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 09:54:09 +01:00
efcf06969c ver. 0.308: kolory statusow zamowien + poprawki bezpieczenstwa
- Kolorowe badge statusow na liscie zamowien (pp_shop_statuses.color)
- Walidacja hex koloru z DB (regex), sanityzacja HTML transport
- Polaczenie 2 zapytan SQL w jedno orderStatusData()
- Path-based form submit w table-list.php (admin URL routing)
- 11 nowych testow (750 total, 2114 assertions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 20:57:56 +01:00
f16f5ce8f8 ver. 0.306: hide transport methods with no available payment methods
When all payment methods for a transport are filtered out by
min_order_amount/max_order_amount limits, the transport is now hidden
from the basket. Prevents showing delivery options with empty payment
method lists (e.g. "Kurier - płatność przy odbiorze" when COD exceeds
max amount).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 17:09:38 +01:00
9de4afec9a ver. 0.304: Configurable payment method order amount limits
Replace hardcoded PayPo condition (id=6, 40-1000 PLN) with generic
min/max order amount columns on pp_shop_payment_methods. Admin form
fields added, frontend basket checkout filters dynamically. Cache
invalidation on save. 4 new tests (734 total, 2080 assertions).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 15:26:51 +01:00
1fc36e4403 ver. 0.302: REST API product variants, attributes dictionary, attribute filtering
- Add variant CRUD endpoints (variants, create_variant, update_variant, delete_variant)
- Add dictionaries/attributes endpoint with multilingual names and values
- Add attribute_* filter params for product list filtering by attribute values
- Enrich product detail attributes with translated names (attribute_names, value_names)
- Include variants array in product detail response for parent products
- Add price_brutto validation on product create
- Batch-load attribute/value translations (4 queries instead of N+1)
- Add 43 new unit tests (730 total, 2066 assertions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:42:52 +01:00
b409806f02 ver. 0.300: Manifest-based update system with checksum verification and file backup
Replaces the manual ZIP packaging workflow with an automated build script.
UpdateRepository now supports both manifest JSON format (new) and legacy
_sql.txt/_files.txt format (fallback), enabling a smooth transition for
existing client instances.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 23:30:58 +01:00
ebab220f7e ver. 0.297: REST API products endpoint — list, get, create, update
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 22:39:48 +01:00
9cac0d1eeb ver. 0.296: REST API for ordersPRO — orders management, dictionaries, API key auth
- New API layer: ApiRouter, OrdersApiController, DictionariesApiController
- Orders API: list (with filters/pagination/updated_since), details, change status, set paid/unpaid
- Dictionaries API: order statuses, transport methods, payment methods
- X-Api-Key authentication via pp_settings.api_key
- OrderRepository: listForApi(), findForApi(), touchUpdatedAt()
- updated_at column on pp_shop_orders for polling support
- api.php: skip session for API requests, route to ApiRouter
- SettingsController: api_key field in system tab
- 30 new tests (666 total, 1930 assertions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 20:25:07 +01:00
21efe28464 ver. 0.295: Admin order product editing — add/remove/modify products, AJAX search, stock adjustment
- Order product CRUD in admin panel (add, delete, edit quantity/prices)
- AJAX product search endpoint for order edit form
- Automatic stock adjustment when editing order products
- Transport cost recalculation based on free delivery threshold
- Fix: promo price = 0 when equal to base price (no real promotion)
- Clean up stale temp/ build artifacts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 19:30:38 +01:00
054b1b4a34 ver. 0.293: Code review fixes — 6 repositories, 16 fixes
- ArticleRepository: SQL injection fix (addslashes→parameterized), DRY refactor topArticles/newsListArticles
- AttributeRepository: dead class_exists('\S') blocking cache/temp clear
- CategoryRepository: dead class_exists('\S') blocking SEO link generation (critical)
- BannerRepository: parameterize $today in SQL + null guard on query()
- BasketCalculator: null guard checkProductQuantityInStock + optional DI params
- PromotionRepository: null guard on $basket (production fatal)
- OrderRepository/ShopBasketController/ajax.php: explicit DI in BasketCalculator callers

614 tests, 1821 assertions (+4 new)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 01:07:39 +01:00
29821bccf2 Refactor code structure for improved readability and maintainability 2026-02-18 08:28:02 +01:00
69e78ca248 ver. 0.294: Remove all 12 legacy autoload/shop/ classes (~2363 lines)
Complete Domain-Driven Architecture migration:
- Phase 1-4: Transport, ProductSet, Coupon, Shop, Search, Basket,
  ProductCustomField, Category, ProductAttribute, Promotion
- Phase 5: Order (~562 lines) + Product (~952 lines)
- ~20 Product methods migrated to ProductRepository
- Apilo sync migrated to OrderAdminService
- Production hotfixes: stale Redis cache (prices 0.00), unqualified
  Product:: refs in LayoutEngine, object->array template conversion
- AttributeRepository::getAttributeValueById() Redis cache added

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 02:05:39 +01:00
d2444500e9 ver. 0.293: front\controls\Site + front\view\Site → front\App + front\LayoutEngine
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:21:44 +01:00
89d9e61bec ver. 0.292: ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend migration to Domain
Full migration of front\factory\ — entire directory removed (all 20 classes migrated).
ProductRepository +20 frontend methods, PromotionRepository +5 applyType methods,
TransportRepository +4 cached methods, PaymentMethodRepository +cached frontend methods.
Fix: broken transports_list() in ajax.php replaced with forPaymentMethod().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 21:55:16 +01:00
827b903e1e ver. 0.291: ShopProducer frontend migration to Domain + Controllers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 20:32:07 +01:00
46ff934d42 ver. 0.290: ShopCoupon + ShopOrder frontend migration to Domain + Controllers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:54:21 +01:00
d29d396197 ver. 0.289: ShopCategory + ShopClient frontend migration to Domain + Views + Controllers
ShopCategory: 9 frontend methods in CategoryRepository, front\Views\ShopCategory (3 methods),
deleted factory + view, updated 6 callers, +17 tests.

ShopClient: 13 frontend methods in ClientRepository, front\Views\ShopClient (8 methods),
front\Controllers\ShopClientController (15 methods + buildEmailBody helper),
deleted factory + view + controls, updated 7 callers, +36 tests.

Security fix: removed hardcoded password bypass 'Legia1916'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 10:41:40 +01:00
437d4c78dc ver. 0.288: BasketCalculator + ShopBasketController migration, cms\Layout removal
- Migrate front\factory\ShopBasket → Domain\Basket\BasketCalculator (4 static methods, 18 callers updated)
- Migrate front\controls\ShopBasket → front\Controllers\ShopBasketController (camelCase, instance methods)
- Add snake_case→camelCase action dispatch for new controllers in Site::route()
- Update title()/page_title() to check front\Controllers\ before fallback
- Remove cms\Layout class (replaced by $layoutsRepo->find())
- Add 8 tests for BasketCalculator (484 tests, 1528 assertions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:38:45 +01:00
3b50ba7990 ver. 0.287: Scontainers + ShopAttribute frontend migration to Domain
- Scontainers: frontScontainerDetails() with Redis cache in ScontainersRepository
- Scontainers: new front\Views\Scontainers VIEW, deleted factory + view legacy
- ShopAttribute: frontAttributeDetails(), frontValueDetails() with Redis cache in AttributeRepository
- ShopAttribute: clearFrontCache() per attribute/value + language
- ShopAttribute: deleted front\factory\ShopAttribute, updated 4 callers
- Tests: 476 OK, 1512 assertions (+6 frontend tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 08:47:21 +01:00
8162df7356 ver. 0.286: Layouts, Menu, Pages frontend migration to Domain
- Add 6 frontend methods to LayoutsRepository (Redis cache, 3-level fallback)
- Add 6 frontend methods to PagesRepository (Redis cache, recursive pages)
- Create front\Views\Menu (clean VIEW replacing front\view\Menu)
- Delete front\factory\Layouts, Menu, Pages + front\view\Menu + dead submenu.php
- Fix null $lang_id TypeError in check_url_params() (remove string type hint + ?? '')
- Optimize Helpers::htacces() from 3 layout calls to 1
- Tests: 470 OK, 1484 assertions (+16 new)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 08:21:53 +01:00
8e97413361 ver. 0.282: Banners frontend migration, Cache cleanup, Shared\Cache namespace
- Banners frontend: front\Views\Banners (new), BannerRepository +2 frontend methods,
  front\view\Site przepięty, usunięte front\factory\Banners i front\view\Banners
- Cache cleanup: eliminacja legacy class.Cache.php (file-based cache),
  13 metod front\factory przepiętych z \Cache::fetch/store na CacheHandler
- Shared\Cache namespace: CacheHandler i RedisConnection przeniesione do Shared\Cache\,
  60 odwołań CacheHandler i 12 odwołań RedisConnection przepiętych,
  usunięte backward-compat wrappery class.CacheHandler.php i class.RedisConnection.php
- Naprawione rozbieżności kluczy cache (random_products, category_name)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 21:25:50 +01:00
0402dbee76 ver. 0.280: Articles frontend migration, class.Article removal, Settings facade cleanup
- Add 8 frontend methods to ArticleRepository (with Redis cache)
- Create front\Views\Articles (rendering + utility methods)
- Rewire front\view\Site::show() and front\controls\Site::route() to repo + Views
- Update 5 article templates to use \front\Views\Articles::
- Convert front\factory\Articles and front\view\Articles to facades
- Remove class.Article (entity + static methods migrated to repo + Views)
- Remove front\factory\Settings facade (already migrated)
- Fix: eliminate global $lang from articleNoindex(), inline page sort query
- Tests: 450 OK, 1431 assertions (+13 new)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:52:03 +01:00
c910982abf ver. 0.279: Newsletter frontend migration, Languages facade elimination, bug fix newsletter_unsubscribe
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:11:38 +01:00
782dd35d5b ver. 0.278: Settings + Languages frontend migration, bug fix get_single_settings_value
- Add cached frontend methods to existing Domain repositories (allSettings, getSingleValue, defaultLanguage, activeLanguages, translations)
- Convert front\factory\Settings and Languages to facades delegating to Domain repositories
- Fix get_single_settings_value() - was hardcoded to 'firm_name', now uses $param correctly
- Add CacheHandler stub methods (get/set/exists) to test bootstrap
- Establish architectural rule: Domain classes are shared between admin and frontend

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 13:50:27 +01:00
c8469f4371 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>
2026-02-16 01:06:29 +01:00
d012a694c2 ver. 0.276: ShopOrder migration, Integrations cleanup, global admin search 2026-02-15 16:41:48 +01:00
0a2d13090f docs: complete 0.275 documentation updates 2026-02-15 15:36:31 +01:00
6c87e4615a refactor(shop_category): migrate admin module to Domain+DI with routing and ajax cleanup 2026-02-15 15:32:39 +01:00
df24da8915 ver. 0.274 - ShopClients Domain+DI migration 2026-02-15 15:03:24 +01:00
eb8e8fed36 ver. 0.274 - ShopProduct mass_edit + tree UI cleanup 2026-02-15 11:41:04 +01:00
3bac7616e7 ver. 0.273 - ShopProducer refactor + cleanup 6 factory facades
- Domain\Producer\ProducerRepository (CRUD + frontend)
- admin\Controllers\ShopProducerController (DI)
- Nowe widoki: producers-list, producer-edit (table-list/form-edit)
- shop\Producer -> fasada do ProducerRepository
- Przepiecie ShopProduct factory na TransportRepository
- Usuniete 6 pustych factory facades: Languages, Newsletter, Scontainers, ShopProducer, ShopTransport, Layouts
- Usuniete legacy: controls\ShopProducer, stare szablony
- Testy: 338 tests, 1063 assertions OK
2026-02-15 10:46:55 +01:00
fe51a1f4c4 ver. 0.272 - ShopProductSets refactor + update package
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:29:21 +01:00
e51ac7f82b ver. 0.271 - ShopAttribute refactor + update package 2026-02-14 21:12:17 +01:00
34e23338da ver. 0.270 - Apilo payment/status sync hardening 2026-02-14 20:27:01 +01:00
6543f8dc31 feat: Add Transport module with repository, controller, and views
- Implemented TransportRepository for managing transport data with methods for listing, finding, saving, and retrieving transport costs.
- Created ShopTransportController to handle transport-related actions, including listing, editing, and saving transports.
- Added views for transport management: transports list and transport edit forms.
- Introduced JavaScript for responsive tabs in transport edit view.
- Updated testing suite with comprehensive unit tests for TransportRepository and ShopTransportController.
- Increased test coverage with new assertions and scenarios for transport functionalities.
2026-02-14 20:16:18 +01:00
9c23e7f16b ver. 0.269: ShopPaymentMethod refactor + Apilo keepalive 2026-02-14 15:22:02 +01:00
847fdbbf3f refactor(shop-statuses): migrate to DI, restructure docs into docs/ folder (0.268)
- Migrate ShopStatuses module to Domain + DI architecture
- Add ShopStatusRepository, ShopStatusesController with color picker
- Convert front\factory\ShopStatuses to facade
- Add FormFieldType::COLOR with HTML5 color picker
- Move documentation files to docs/ folder (PROJECT_STRUCTURE, REFACTORING_PLAN, CHANGELOG, FORM_EDIT_SYSTEM, TESTING, DATABASE_STRUCTURE)
- Tests: 254 tests, 736 assertions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 10:43:31 +01:00