diff --git a/.paul/PROJECT.md b/.paul/PROJECT.md index 78a600ee..a997ec6d 100644 --- a/.paul/PROJECT.md +++ b/.paul/PROJECT.md @@ -1,30 +1,31 @@ -# Project: interblue.pl +# PROJECT — interblue.pl -## Description -Bieżące poprawki i rozwój istniejącego sklepu PrestaShop 1.7.x — elektronika oświetleniowa B2C. +**Projekt:** interblue.pl +**Utworzono:** 2026-05-20 +**Typ:** Sklep e-commerce PrestaShop 1.7.x -## Core Value -Klienci B2C mogą kupić elektronikę oświetleniową online. +## Krotki opis -## Requirements +Sklep internetowy oparty na PrestaShop 1.7.x z wlasnym motywem `InterBlue` i rozbudowanym zestawem modulow (130+). Kod jest zywa instalacja PrestaShop wdrazana na produkcje przez FTP. -### Must Have -- [To be defined during planning] +## Wartosc biznesowa -### Should Have -- [To be defined during planning] +- Sprzedaz online w sklepie interblue.pl. +- Integracje z marketplace'ami (Allegro, Empik) i platnoscia/wysylka (DPD, InPost, Poczta Polska, Paczka w Ruchu, BaseLinker). +- One-page checkout (`onepagecheckoutps`) jako sciezka konwersji. -### Nice to Have -- [To be defined during planning] +## Aktualny status -## Constraints -- PrestaShop 1.7.x — zmiany muszą być kompatybilne z tą wersją -- Deployment przez FTP (brak CI/CD) -- Cache PrestaShop musi być czyszczony ręcznie po zmianach PHP/override +- Sklep produkcyjny, kod utrzymywany w jednym repozytorium (gałąź `main`). +- Wdrazanie zmian: edycja lokalna -> Live Sass Compiler dla SCSS -> reczny upload przez SFTP/FTP Sync. +- Po zmianach w PHP/override/szablonach wymagane czyszczenie cache PrestaShop. -## Success Criteria -- Klienci B2C mogą kupić elektronikę oświetleniową online -- [To be refined during planning] +## Trwale wymagania i ograniczenia ---- -*Created: 2026-04-27* +- PrestaShop 1.7.x — zmiany przez hooks i overrides, nie edycje rdzenia. +- Override `override/classes/order/Order.php` wspoldzielony przez moduly `AddOrderExtraFields` i `modrefchange` — konflikty wymagaja uwagi. +- Po aktualizacji `empikmarketplace` nadpisywany jest widok katalogu produktow w adminie (`views/PrestaShop/Admin/Product/CatalogPage/Lists/`). +- Sciezka admina: `admin658c34/` (security through obscurity). +- Lokalizacja podstawowa: polska; tlumaczenia przez `$this->l('...')` w modulach. +- Wdrozenia: brak CI/CD; FTP reczny — kazda zmiana wymaga swiadomego uploadu. +- Cache: `var/cache/` musi byc czyszczony po zmianach w klasach, overrides, szablonach. diff --git a/.paul/ROADMAP.md b/.paul/ROADMAP.md deleted file mode 100644 index 3a266253..00000000 --- a/.paul/ROADMAP.md +++ /dev/null @@ -1,25 +0,0 @@ -# Roadmap: interblue.pl - -## Overview -Bieżące poprawki i rozwój istniejącego sklepu PrestaShop 1.7.x (interblue.pl) — elektronika oświetleniowa B2C. - -## Current Milestone -**v0.1 Initial Release** (v0.1.0) -Status: In progress -Phases: 0 of 1 complete - -## Phases - -| Phase | Name | Plans | Status | Completed | -|-------|------|-------|--------|-----------| -| 1 | order-source-api | 1 | Planning | - | - -## Phase Details - -### Phase 1: order-source-api -**Goal:** Add `order_source` virtual field to PrestaShop webservice API orders endpoint. -**Scope:** Extend `override/classes/order/Order.php` with a getter that returns `$this->module` as `order_source`. -**Plans:** 01-01-PLAN.md - ---- -*Roadmap updated: 2026-04-27* diff --git a/.paul/STATE.md b/.paul/STATE.md index 5a860ccf..ca18b859 100644 --- a/.paul/STATE.md +++ b/.paul/STATE.md @@ -1,54 +1,33 @@ -# Project State +# STATE — interblue.pl -## Project Reference +**Aktualizacja:** 2026-05-20 +**Tryb:** plan-first (`.paul/plans/`) -See: .paul/PROJECT.md (updated 2026-04-27) +## Aktywna praca -**Core value:** Klienci B2C mogą kupić elektronikę oświetleniową online -**Current focus:** Bieżące poprawki — faza 1 zamknięta +Brak aktywnego planu. Katalog `.paul/plans/` jest pusty. -## Current Position +## Sugerowane nastepne dzialanie -Milestone: v0.1 Initial Release -Phase: 1 of 1 (order-source-api) — Complete -Plan: 01-01 complete -Status: Loop zamknięty — gotowy na nowy PLAN -Last activity: 2026-04-27 — UNIFY 01-01 zakończony +1. `$paul-map-codebase` — pelne mapowanie kodu i Quality Radar dla 130+ modulow, overrides i motywu. +2. `$paul-plan [opis pracy]` — jezeli zadanie jest juz znane (np. fix override, integracja modulu, zmiana w szablonie). -Progress: -- Milestone: [██░░░░░░░░] 20% -- Phase 1: [██████████] 100% +## Kontekst legacy (opcjonalny) -## Loop Position +- Roadmap/milestones nie sa wymagane w trybie plan-first. +- Wczesniejsze artefakty `.paul/phases/`, `.paul/docs/` z poprzedniej inicjalizacji zostaly usuniete (widoczne w `git status` jako `D`). -Current loop state: -``` -PLAN ──▶ APPLY ──▶ UNIFY - ✓ ✓ ✓ [Loop complete — ready for next PLAN] -``` +## Quality Radar -## Accumulated Context +- Wlaczony, lekki tryb (codebase-memory-mcp). +- `jscpd` i `ast-grep` wylaczone domyslnie — uruchamiane na zadanie. -### Decisions -- `order_source` to prawdziwe pole DB w `ps_orders` (ENUM: 'Allegro', 'Sklep int.', 'Telefonicznie') - - Dodana przez moduł `AddOrderExtraFields` (ALTER TABLE ps_orders ADD order_source) - - Widoczna w adminie przez moduł `ordersextracolumns` - - Webservice eksponuje pole automatycznie przez $definition — nie potrzeba webserviceParameters -- Lokalny override/classes/order/Order.php zsynchronizowany z AddOrderExtraFields/_overrides/Order-modrefchange.php -- Zamówienia sprzed 2023-04-20 mają order_source=null w API (ordersextracolumns wypełniało tę datę warunkowo) +### Codebase Mapped +Date: 2026-05-20 +Documents: `.paul/codebase/` (stack, architecture, conventions, testing, integrations, db_schema, impact_map, quality_risks, tooling_status) +Quality Radar: degraded (codebase-memory-mcp nie zaindeksowal repo; jscpd/ast-grep disabled by policy) -### Deferred Issues -- Dostawca powinien obsłużyć null w order_source dla starszych zamówień po stronie swojej aplikacji - -### Blockers/Concerns -Brak - -## Session Continuity - -Last session: 2026-04-27 -Stopped at: UNIFY 01-01 zakończony, faza 1 kompletna -Next action: Nowy /paul:plan dla kolejnej poprawki lub zakończenie milestone -Resume file: .paul/phases/01-order-source-api/01-01-SUMMARY.md - ---- -*STATE.md — Updated after every significant action* +### Krytyczne ustalenia (do $paul-plan) +- `.vscode/ftp-kr.json` zawiera plaintext credentials FTP — pilne wycofanie z repo i zmiana hasla. +- `.gitignore` jest pusty — ryzyko commitowania logow i feedow. +- `modules/AddOrderExtraFields` ma blad skladniowy w SQL ALTER i nadpisuje override w install(). diff --git a/.paul/changelog/2026-04-27.md b/.paul/changelog/2026-04-27.md deleted file mode 100644 index 4dfdbbb1..00000000 --- a/.paul/changelog/2026-04-27.md +++ /dev/null @@ -1,11 +0,0 @@ -# 2026-04-27 - -## Co zrobiono - -- [Faza 1, Plan 01] Dodano pole `order_source` do odpowiedzi webservice API PrestaShop (`/api/orders/`) -- Zsynchronizowano `override/classes/order/Order.php` z wersją AddOrderExtraFields (dodano `$order_source` i wpis w `$definition`) -- Zewnętrzna aplikacja dostawcy może teraz filtrować zamówienia po źródle (Allegro / Sklep int. / Telefonicznie) - -## Zmienione pliki - -- `override/classes/order/Order.php` diff --git a/.paul/codebase/architecture.md b/.paul/codebase/architecture.md index 05aba85a..b8f1228e 100644 --- a/.paul/codebase/architecture.md +++ b/.paul/codebase/architecture.md @@ -1,141 +1,58 @@ -# Architecture +# Architektura — interblue.pl -**Analysis Date:** 2026-04-27 +**Aktualizacja:** 2026-05-20 -## Pattern Overview +## Punkty wejścia -**Overall:** PrestaShop 1.7.x MVC Monolith with Hook System and Override Mechanism +- **Frontend:** `index.php` (front controller PS), routing przez `Dispatcher` rdzenia. +- **Backend (BO):** katalog admina o niestandardowej nazwie `admin658c34/` (security through obscurity). +- **Konsola/cron:** `custom-cron.php`, `custom-script.php` w roocie. Brak jednolitego command-bus — skrypty operacyjne uruchamiane bezpośrednio. +- **Importy/eksporty:** `import-products.php`, `export.php`, `export-csv.php`. -**Key Characteristics:** -- Hook-based extensibility (modules register to hooks, PrestaShop fires them) -- Override mechanism (modules replace core classes by copying to `override/`) -- Smarty MVC — controllers prepare data, templates render it -- 133 modules active, many with overrides and custom hooks -- Symfony components embedded (service container, YAML) in PS 1.7 core +## Warstwy -## Layers +1. **Smarty FO** — `themes/InterBlue/templates/` (catalog, checkout, customer, cms, layouts, _partials). +2. **Symfony BO** — częściowe wykorzystanie nowszych wzorców PS 1.7 (PageTemplate w `app/`, `src/`). +3. **CQRS dla Order** — `src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php` implementuje `src/Core/Domain/Order/QueryHandler/GetOrderForViewingHandlerInterface.php`; rezultaty w `src/Core/Domain/Order/QueryResult/`. +4. **Klasy ObjectModel** — rdzeń PS + overrides w `override/classes/`. +5. **Moduły** — 133 sztuki, każdy z własną klasą głównego pliku oraz potencjalnie `controllers/`, `views/`, `classes/`. -**Core PrestaShop Layer:** -- Purpose: Framework, models, standard controllers -- Contains: `classes/` (models), `controllers/` (base front/admin), `config/` -- Key entry: `config/config.inc.php`, `config/bootstrap.php` +## Flow zamówienia (kluczowy) -**Override Layer:** -- Purpose: Replace core classes/controllers without touching core files -- Contains: `override/classes/`, `override/controllers/`, `override/modules/` -- Critical overrides: `override/classes/order/Order.php`, `override/classes/Hook.php`, `override/classes/Dispatcher.php` -- Depends on: Core layer -- Risk: Multiple modules contributing to same override file +- One-page checkout: `modules/onepagecheckoutps/` + override `override/controllers/front/OrderController.php`. +- Override `override/classes/order/Order.php` dodaje pole `order_source` (enum `Allegro`/`Sklep int.`/`Telefonicznie`) i emituje hooks PRZED przypisaniem numerów dokumentów: + - `actionBeforeAddOrder` + - `actionBeforeAddOrderInvoice` + - `actionBeforeAddDeliveryNumber` +- Hooks używane przez `modules/modrefchange/` do zmiany schematu numeracji. +- Override generowany automatycznie podczas instalacji `modules/AddOrderExtraFields/`: + - jeśli `modrefchange` jest zainstalowany → kopiowany `_overrides/classes/order/Order-modrefchange.php`, + - w przeciwnym razie → `_overrides/classes/order/Order.php`. +- Dodatkowe overrides na klasach zamówień: `OrderCarrier.php`, `OrderHistory.php`, `OrderInvoice.php`, `OrderPayment.php` w `override/classes/order/`. +- Backup wersji starego flow: `override/controllers/front/OrderController.php_BK-OPC-PTS_2020-01-21` (legacy, do usunięcia/audytu). -**Module Layer:** -- Purpose: Business features, marketplace integrations, shipping, payments -- Contains: `modules/` (133 modules) -- Custom modules: `modules/customfeaturetab/`, `modules/AddOrderExtraFields/` -- Hook registrations in each module's `install()` method -- Depends on: Override layer + Core layer +## Granice modułów / kluczowe integracje -**Theme Layer:** -- Purpose: Frontend rendering -- Contains: `themes/InterBlue/templates/` (Smarty .tpl) -- Assets: `themes/InterBlue/assets/css/`, `themes/InterBlue/assets/js/` -- Depends on: Module layer (hook output inserted into templates) +- **Marketplace:** `x13allegro`, `marzaallegro` (Allegro); `empikmarketplace`; `baselinker` (multi-platform sync). +- **Płatności:** `imoje`, `paybynet`, `przelewy24`, `ps_wirepayment`, `ps_cashondelivery`, `ps_checkpayment`. +- **Kurierzy:** `dpdpoland`, `GeisLogistic`, `sensbitinpost`, `sensbitpaczkawruchu`, `sensbitpocztapolska`, `sensbitfedex`. +- **Analityka/SEO:** `cdc_googletagmanager`, `seigitagmanager`, `pdgoogleanalytycs4pro`, `pdgooglemerchantcenterpro`, `gsitemap`, `fsadvancedurl`. +- **UX/marketing:** `revsliderprestashop`, `stbanner`, `ps_imageslider`, `cookiesplus`, `uecookie`, `psgdpr`, `referralprogram`, `sendinblue`, `ekomiratingsandreviews`, `ekomiSff`. -**CQRS Extension Layer (src/):** -- Purpose: Modern query handling for Order domain -- Contains: `src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php` -- Interface: `src/Core/Domain/Order/QueryHandler/GetOrderForViewingHandlerInterface.php` -- Result objects: `src/Core/Domain/Order/QueryResult/` -- Pattern: Adapter bridging legacy PrestaShop to CQRS +## Custom domain -## Data Flow +- **Custom Feature Tab** (`modules/customfeaturetab/`) — własne tabele: + - `ps_custom_feature_tab` (id_feature, id_feature_value, position, active), + - `ps_custom_feature_tab_lang` (title, content per język). + Hook: `displayProductExtraContent`. BO controller `AdminCustomFeatureTab` pod `AdminCatalog`. +- **AddOrderExtraFields** (`modules/AddOrderExtraFields/`) — dodaje kolumnę `order_source` do `ps_orders` i podmienia override `Order.php`. -**Frontend HTTP Request:** -1. HTTP request hits `index.php` -2. `Dispatcher` (overridden by fsadvancedurl) matches URL to controller -3. Front controller executes (e.g., `ProductController`) -4. Controller loads model data, fires hooks -5. Smarty renders `.tpl` template with data -6. Module hook outputs inserted at hook positions -7. Response returned +## Override modułów -**Order Creation:** -1. Customer submits checkout (via `onepagecheckoutps` — `override/controllers/front/OrderController.php`) -2. `PaymentModule::validateOrder()` called (overridden in `modules/AddOrderExtraFields/override/classes/PaymentModule.php`) -3. `actionBeforeAddOrder` hook fires (`override/classes/order/Order.php` — modrefchange) -4. Order saved to DB with `order_source` field (Allegro/Sklep int./Telefonicznie) -5. `actionBeforeAddOrderInvoice`, `actionBeforeAddDeliveryNumber` hooks fire -6. x13allegro module checks if Allegro order, suppresses customer emails if so +`override/modules/` zawiera customizacje: `ps_categorytree`, `ps_emailalerts`, `ps_imageslider` — należy traktować jako lokalne fork-i, które blokują czystą aktualizację tych modułów. -**State Management:** -- Stateless HTTP requests — all state in MySQL database -- Session: PrestaShop cookie-based session -- Cache: Memcached for compiled templates/config +## Cache -## Key Abstractions - -**Module:** -- Purpose: Self-contained feature unit -- Examples: `modules/customfeaturetab/customfeaturetab.php`, `modules/x13allegro/x13allegro.php` -- Pattern: Class extending `Module`, implements `install()`/`uninstall()`, registers hooks - -**ObjectModel:** -- Purpose: ORM for PrestaShop database tables -- Examples: `modules/customfeaturetab/classes/CustomFeatureTabRule.php` -- Pattern: Class extending `ObjectModel` with static `$definition` array - -**Override:** -- Purpose: Replace core functionality without modifying core files -- Examples: `override/classes/order/Order.php` extends `OrderCore` -- Pattern: `class X extends XCore` in `override/` directory - -**Hook:** -- Purpose: Extension point for modules -- Execution intercepted: `override/classes/Hook.php` (cookiesplus GDPR filter) -- Custom hooks: `actionBeforeAddOrder`, `actionBeforeAddOrderInvoice`, `actionBeforeAddDeliveryNumber` - -## Entry Points - -**Frontend:** -- URL routing: `override/classes/Dispatcher.php` (fsadvancedurl module) -- Product pages: `override/controllers/front/ProductController.php` -- Checkout: `override/controllers/front/OrderController.php` (onepagecheckoutps) - -**Admin Panel:** -- URL: `/admin658c34/` (randomized for security) -- Custom admin tabs registered by modules (e.g., "Karty cech produktu") - -**Background Scripts:** -- `custom-cron.php` — Scheduled tasks -- `export.php`, `export-csv.php` — Data exports -- `import-products.php` — Bulk product import - -## Error Handling - -**Strategy:** Mix — PrestaShop global error handler + per-module ad-hoc - -**Patterns:** -- Custom modules use minimal error handling -- `die()` calls found in empikmarketplace admin controllers -- No global exception handling in custom modules -- Cache clear required after PHP class changes - -## Cross-Cutting Concerns - -**Caching:** -- Memcached for compiled Smarty templates and PS config -- LiteSpeed cache module (`modules/litespeedcache/`) -- Manual purge required after changes - -**Translation:** -- `$this->l('Text')` in all module PHP files -- Primary locale: Polish (`pl-PL`) -- No separate `.php` language files in custom modules - -**Security:** -- Admin URL obfuscation: `admin658c34/` -- Cookie consent: cookiesplus module intercepts Hook execution - ---- - -*Architecture analysis: 2026-04-27* -*Update when major patterns change* +- PS cache: `var/cache//` + indeks klas `class_index.php`. +- Po zmianach w `override/`, `classes/`, `controllers/`, szablonach → wymagane czyszczenie cache w BO (Advanced Parameters → Performance). +- Możliwy `litespeedcache` (`modules/litespeedcache/`) — warstwa HTTP cache, dodatkowo do wewnętrznego cache PS. diff --git a/.paul/codebase/concerns.md b/.paul/codebase/concerns.md deleted file mode 100644 index 00bf2564..00000000 --- a/.paul/codebase/concerns.md +++ /dev/null @@ -1,146 +0,0 @@ -# Codebase Concerns - -**Analysis Date:** 2026-04-27 - -## Tech Debt - -**Override Chain Fragility — Order Processing:** -- Issue: Three modules (modrefchange, AddOrderExtraFields, x13allegro) all modify `Order` class through overlapping overrides -- Files: `override/classes/order/Order.php`, `modules/modrefchange/override/classes/order/Order.php`, `modules/AddOrderExtraFields/_overrides/classes/order/Order-modrefchange.php` -- Why: Each module added override independently without documentation of interdependencies -- Impact: Hook execution order undocumented; disabling modrefchange orphans hooks; AddOrderExtraFields install copies override file (fragile) -- Fix approach: Document hook execution order, add comments to override file explaining all contributing modules - -**Payment Module Logic Bug:** -- Issue: Operator precedence bug in order source detection -- Files: `modules/AddOrderExtraFields/override/classes/PaymentModule.php` (line ~350) -- Code: `if (!$order->module == 'x13allegro')` — evaluates as `!(false) == 'x13allegro'` not as intended -- Impact: Order source may be incorrectly set in edge cases -- Fix approach: Change to `if ($order->module !== 'x13allegro')` - -**One-Page Checkout Controller Duplication:** -- Issue: `override/controllers/front/OrderController.php` (root, 653 lines) and `modules/onepagecheckoutps/public/override/controllers/front/OrderController.php` both exist; PS loads root override only -- Files: `override/controllers/front/OrderController.php`, `modules/onepagecheckoutps/public/override/controllers/front/OrderController.php` -- Impact: Module override is silently ignored; confusion when updating module -- Fix approach: Document that root override is authoritative; remove or flag module copy - -## Known Bugs - -**Die() Calls in Empikmarketplace:** -- Symptoms: Admin pages may crash without user-friendly error -- Files: `modules/empikmarketplace/controllers/admin/AdminEmpikOffersController.php`, `modules/empikmarketplace/controllers/admin/AdminEmpikProductsController.php`, `modules/empikmarketplace/controllers/front/cron.php` -- Workaround: None — admin must retry operation -- Root cause: Missing try/catch and error recovery in module controllers - -**Dev Mode IP Hardcoded:** -- Symptoms: Debug mode silently enabled for traffic from specific IP -- Files: `config/defines.inc.php` (line 28) -- Risk: Exposes debug info if that IP is compromised or reused -- Fix: Move dev detection to environment variable or remove entirely - -## Security Considerations - -**Dispatcher URL Parsing — Potential Injection:** -- Risk: Regex in `override/classes/Dispatcher.php` (line 69) parses raw `$_GET` without sanitization -- Files: `override/classes/Dispatcher.php` -- Current mitigation: PrestaShop built-in URL sanitization may catch most cases -- Recommendations: Audit regex patterns, validate extracted values before use - -**Admin Path Obfuscation Only:** -- Risk: `admin658c34/` relies on obscurity alone (no 2FA, IP restriction visible) -- Files: `admin658c34/` -- Current mitigation: Randomized folder name -- Recommendations: Enable 2FA if supported, IP-restrict admin if hosting allows - -**Order Source Enum Hardcoded:** -- Risk: `order_source` enum in `ps_orders` only allows ('Allegro', 'Sklep int.', 'Telefonicznie') — new order sources require DB migration -- Files: `modules/AddOrderExtraFields/AddOrderExtraFields.php` -- Recommendations: Consider VARCHAR with application-level validation instead of enum - -## Performance Bottlenecks - -**Empikmarketplace Admin Views:** -- Problem: Module overrides admin product catalog list views with custom Twig templates -- Files: `modules/empikmarketplace/views/PrestaShop/Admin/Product/CatalogPage/Lists/list.html.twig`, `products_table.html.twig` -- Impact: Admin product list may be slower or behave unexpectedly after empikmarketplace updates -- Improvement: Keep module updated; test after each module upgrade - -**No Indexes on Custom Feature Tab:** -- Problem: `ps_custom_feature_tab` has no index on `id_feature` or `id_feature_value` -- Files: `modules/customfeaturetab/customfeaturetab.php` (table creation SQL) -- Impact: Slow queries when many products loaded (full table scan per product) -- Fix: `ALTER TABLE ps_custom_feature_tab ADD INDEX (id_feature, id_feature_value)` - -## Fragile Areas - -**Override Load Order:** -- Files: All files in `override/classes/` and `override/controllers/` -- Why fragile: PrestaShop loads overrides alphabetically; installing new modules with overlapping overrides can silently fail or corrupt class index -- Safe modification: Always clear `var/cache/*/class_index.php` after adding/modifying overrides -- Test coverage: None - -**Hook System Intercept (cookiesplus):** -- Files: `override/classes/Hook.php` -- Why fragile: cookiesplus intercepts ALL hook execution for GDPR consent; if module corrupts its config, hooks may silently fail site-wide -- Common failure: Module misconfiguration blocks legitimate module output -- Safe modification: Test in staging if possible before enabling - -## Scaling Limits - -**PrestaShop 1.7.x End of Life:** -- Current capacity: Working for current traffic -- Risk: No official security patches available for 1.7.x -- Impact: Accumulating unpatched vulnerabilities in core and 45+ vendor dependencies -- Scaling path: Plan migration to PrestaShop 8.x (significant effort) - -**No CI/CD — Manual FTP Deployment:** -- Current: Changes deployed manually via FTP from VSCode -- Risk: Human error, no rollback mechanism, no pre-deploy validation -- Impact: Broken deployments require manual FTP rollback - -## Dependencies at Risk - -**PrestaShop 1.7.x:** -- Risk: End of life — no more security fixes -- Impact: All custom modules, theme, overrides would need migration -- Migration plan: PrestaShop 8.x upgrade (breaking changes in module APIs) - -**x13allegro (Allegro API):** -- Risk: Allegro REST API versioning — module may need updates when API changes -- Impact: Allegro order sync breaks if module not updated -- Migration plan: Keep module updated; monitor x13.pl module updates - -**onepagecheckoutps (v1.0.1):** -- Risk: Old version, complex OrderController override (653 lines) -- Impact: Checkout flow breaks on PS updates -- Migration plan: Test and update before any PS core updates - -## Missing Critical Features - -**No Automated Testing:** -- Problem: Zero automated tests for custom modules -- Blocks: Confidence in refactoring, PS upgrade path verification -- Implementation complexity: Medium (PHPUnit setup per module) - -**No Staging Environment:** -- Problem: Changes go directly to production -- Current workaround: Test manually in production during low-traffic hours -- Blocks: Safe testing of marketplace integrations, checkout changes -- Implementation complexity: Medium (duplicate hosting setup) - -**No Rollback Mechanism:** -- Problem: No automated rollback for failed deployments -- Current workaround: Restore via FTP from backup -- Blocks: Confidence in deploying risky changes - -## Database Design Issues - -**utf8 vs utf8mb4:** -- Files: `modules/customfeaturetab/customfeaturetab.php` (CREATE TABLE uses `utf8`) -- Risk: Cannot store 4-byte Unicode characters (some emoji, rare CJK) -- Fix: Migrate custom tables to `utf8mb4` charset - ---- - -*Concerns audit: 2026-04-27* -*Update as issues are fixed or new ones discovered* diff --git a/.paul/codebase/conventions.md b/.paul/codebase/conventions.md index 9b45a572..6f4d496b 100644 --- a/.paul/codebase/conventions.md +++ b/.paul/codebase/conventions.md @@ -1,123 +1,52 @@ -# Coding Conventions +# Konwencje — interblue.pl -**Analysis Date:** 2026-04-27 +**Aktualizacja:** 2026-05-20 -## Naming Patterns +## Język i lokalizacja -**Files:** -- Module main file: `{modulename}.php` (lowercase, no hyphens) -- ObjectModel classes: PascalCase — `CustomFeatureTabRule.php` -- Admin controllers: `Admin{Name}Controller.php` -- Templates: `{page-name}.tpl` (kebab-case) +- Język podstawowy: polski. Tłumaczenia przez `$this->l('...')` w modułach. +- Treści Markdown w `.paul/` po polsku (zgodnie z language policy PAUL). +- Komentarze w kodzie modułów custom — często po polsku (np. `AddOrderExtraFields`). -**Classes:** -- Modules: PascalCase matching folder — `class CustomFeatureTab extends Module` -- ObjectModels: PascalCase — `class CustomFeatureTabRule extends ObjectModel` -- Overrides: same name as core — `class Order extends OrderCore` -- Admin controllers: `class AdminCustomFeatureTabController extends ModuleAdminController` +## PHP / PrestaShop -**Methods:** -- camelCase for all methods: `install()`, `getMatchingRules()`, `installDb()` -- Hook methods: `hook{HookName}()` — e.g., `hookDisplayProductExtraContent($params)` -- AJAX handlers: `ajaxProcess{ActionName}()` — e.g., `ajaxProcessGetFeatureValues()` -- Private helpers: underscore prefix — `_installDb()`, `_uninstallDb()` +- Klasy override rozszerzają wariant rdzeniowy z sufiksem `Core` (np. `class Order extends OrderCore`). +- Moduły w `modules//.php`, klasa o nazwie modułu (CamelCase z dopasowaniem do nazwy katalogu — często mieszane np. `AddOrderExtraFields`, `customfeaturetab`). +- Bazowe tabele DB: prefiks `_DB_PREFIX_`, silnik z `_MYSQL_ENGINE_`. +- Hooks rejestrowane w `install()` (`registerHook('hookName')`). +- Wymóg `if (!defined('_PS_VERSION_')) exit;` na początku każdego pliku modułu. +- Wersje modułów określane w `config.xml` (``) i w konstruktorze klasy (`$this->version`). -**Variables:** -- camelCase: `$featureValue`, `$tabContent` -- Constants: `UPPER_SNAKE_CASE` — `_DB_PREFIX_`, `_PS_VERSION_`, `_MYSQL_ENGINE_` +## Struktura modułu -## Code Style +- `.php` — klasa główna. +- `config.xml` — metadane (nazwa, wersja, autor, opis). +- `classes/` — własne ObjectModel/serwisy (np. `modules/customfeaturetab/classes/CustomFeatureTabRule.php`). +- `controllers/` — front/admin controllers. +- `views/templates/` — Smarty templates (FO/BO/hooks). +- `_overrides/` — pliki override kopiowane do `override/` podczas instalacji (jak w `AddOrderExtraFields`). +- `translations/` — tłumaczenia. -**PHP:** -- Indentation: 4 spaces (custom modules); some legacy (AddOrderExtraFields) uses 2 spaces -- No strict line length limit observed -- Every PHP file begins with: `if (!defined('_PS_VERSION_')) exit;` +## Frontend / SCSS -**SCSS:** -- Tool: VSCode Live Sass Compiler -- Compile directives at top: `// out: custom.css, compress: true, sourceMap: true` -- Variables: `$cOrange: #ff7100;`, `$cBlue: #218fff;` -- Section separators: `/** Sekcja *****/` comment blocks (Polish labels) -- Comments in Polish -- Output: compressed CSS with sourcemap +- Edytuj `themes/InterBlue/assets/css/custom.scss` lub `theme.scss`. +- Live Sass Compiler kompiluje do CSS skompresowanego + sourcemap; nie commituj artefaktów ręcznie modyfikowanych. +- Szablony Smarty nadpisują pliki classic theme w `themes/InterBlue/templates/`. +- Domyślny layout: full-width; kategorie używają lewej kolumny. -**JavaScript:** -- jQuery as primary framework: `$()`, `$(function() { ... })` -- camelCase variables: `scrollTrigger`, `backToTop`, `phoneBox` -- Polish comments for feature descriptions -- Event handlers: `$(element).on('event', handler)` +## Wdrożenia -## PrestaShop-Specific Patterns +- Zmiany lokalne → SFTP/FTP Sync ręcznie (`.vscode/ftp-kr.json`). +- Brak CI/CD, brak `git push → deploy`. +- `autoUpload: true` w `ftp-kr.json` powoduje upload na zapis — łatwe do przeoczenia przy eksperymentach. -**Translations:** -- Always use: `$this->l('Text to translate')` — never hardcode user-facing strings -- Primary locale: Polish (`pl-PL`) -- Example: `$this->displayName = $this->l('Karty cech produktu');` +## Hooks i overrides -**Module `__construct()`:** -```php -$this->name = 'customfeaturetab'; -$this->tab = 'front_office_features'; -$this->version = '1.0.0'; -$this->bootstrap = true; -$this->ps_versions_compliancy = array('min' => '1.7.0.0', 'max' => _PS_VERSION_); -parent::__construct(); // always AFTER property assignment -``` +- Preferuj hooks zamiast edycji rdzenia. +- Override tylko gdy hook nie pokrywa potrzeby. +- Współdzielone overrides (np. `Order.php`) wymagają świadomej synchronizacji wielu modułów (`AddOrderExtraFields` + `modrefchange`). -**Install method pattern:** -```php -public function install() { - return parent::install() - && $this->registerHook('displayProductExtraContent') - && $this->_installDb(); -} -``` +## Logi i artefakty operacyjne -**Database queries:** -- Direct execution: `Db::getInstance()->execute($sql)` or `Db::getInstance()->executeS($sql)` -- Always use `_DB_PREFIX_` for table names -- Always use `_MYSQL_ENGINE_` for CREATE TABLE statements -- Backtick-escape table/column names in SQL - -**ObjectModel `$definition`:** -```php -public static $definition = [ - 'table' => 'custom_feature_tab', - 'primary' => 'id_custom_feature_tab', - 'multilang' => true, - 'fields' => [ - 'id_feature' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedId'], - 'active' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'], - // lang fields: - 'title' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'], - ], -]; -``` - -**Smarty templates:** -- Extend layouts: `{extends file='page.tpl'}` -- Blocks: `{block name='page_content'}{/block}` -- Unescaped HTML: `{$variable nofilter}` -- Loop: `{foreach from=$items item=item}{/foreach}` - -## Import Organization - -No enforced import order — standard PHP `require_once` or PrestaShop autoloader. - -## Error Handling - -- Standard pattern: return `false` from `install()`/`uninstall()` on failure -- Some legacy modules use `die()` for errors (avoid in new code) -- No exception handling standard in custom modules - -## Comments - -- File headers with author/copyright in legacy modules -- Polish comments in SCSS and JS for section descriptions -- `/** Comment */` doc-style for public methods in newer custom modules -- PrestaShop security check at top of every file: `if (!defined('_PS_VERSION_')) exit;` - ---- - -*Convention analysis: 2026-04-27* -*Update when patterns change* +- Logi tekstowe w roocie (`log.txt`, `order.log`) — produkcyjne, łatwo trafiają na FTP. Pilnować, by nie commitować świeżych snapshotów. +- Feedy XML (`google-merchant_id-1.xml`, ~16 MB) zostają w repo — duże binaria w gicie. diff --git a/.paul/codebase/db_schema.md b/.paul/codebase/db_schema.md index baa855e4..98bed050 100644 --- a/.paul/codebase/db_schema.md +++ b/.paul/codebase/db_schema.md @@ -1,88 +1,72 @@ -# Database Schema +# Schemat bazy danych — interblue.pl -**Analysis Date:** 2026-04-27 +**Aktualizacja:** 2026-05-20 -## Connection +Sklep używa standardowego schematu PrestaShop 1.7.7 z prefiksem `_DB_PREFIX_` (zwykle `ps_`). Schemat rdzenia nie jest powielany w repo — pełna definicja w instalatorze PS. -- Host: `dedyk75.cyber-folks.pl` -- Database: `interblue_sklep` -- Table prefix: `ps_` -- Engine: InnoDB -- Charset: UTF-8 (note: custom tables use `utf8` not `utf8mb4`) -- Cache: Memcached +## Modyfikacje custom -## Core PrestaShop Tables (selected) +### `ps_orders` (rdzeń PS) — kolumna `order_source` -Standard PrestaShop tables present (not listed exhaustively — see PS docs): -- `ps_orders` — Orders (modified by AddOrderExtraFields, see below) -- `ps_order_history` — Order status history -- `ps_order_invoice` — Invoices -- `ps_order_payment` — Payment records (modified by AddOrderExtraFields) -- `ps_product` — Products -- `ps_product_lang` — Product translations -- `ps_cart` — Shopping carts -- `ps_customer` — Customers +Dodawana przez `modules/AddOrderExtraFields/AddOrderExtraFields.php::install()`: -## Custom Tables (Added by Modules) +```sql +ALTER TABLE `ps_orders` ADD `order_source` enum('Allegro', 'Sklep int.', 'Telefonicznie') NULL DEFAULT +``` -### `ps_custom_feature_tab` — Feature Tab Rules -Created by: `modules/customfeaturetab/customfeaturetab.php` +Uwagi: +- Wartości enum są **hardkodowane** w SQL — zmiana wymaga migracji. +- Override `override/classes/order/Order.php` deklaruje pole `$order_source` na klasie (nie w definicji ObjectModel) — pole nie jest persistowane przez `ObjectModel::save()`, tylko przez ręczne UPDATE lub przez hook. +- `install()` w `AddOrderExtraFields` ma pomyłkowy średnik po `if (!Db::getInstance()->execute(...));` — patrz `quality_risks.md`. -| Column | Type | Notes | -|--------|------|-------| -| id_custom_feature_tab | INT UNSIGNED | PRIMARY KEY, AUTO_INCREMENT | -| id_feature | INT UNSIGNED | Feature ID from ps_feature | -| id_feature_value | INT UNSIGNED | Feature value ID | -| position | INT UNSIGNED | Display order | -| active | TINYINT(1) | Enable/disable | -| date_add | DATETIME | | -| date_upd | DATETIME | | +### `ps_custom_feature_tab` -### `ps_custom_feature_tab_lang` — Feature Tab Content (Multilang) -Created by: `modules/customfeaturetab/customfeaturetab.php` +Tworzone przez `modules/customfeaturetab/customfeaturetab.php::installDb()`: -| Column | Type | Notes | -|--------|------|-------| -| id_custom_feature_tab | INT UNSIGNED | FK → ps_custom_feature_tab | -| id_lang | INT UNSIGNED | FK → ps_lang | -| title | VARCHAR(255) | Tab title | -| content | TEXT | Tab HTML content | +```sql +CREATE TABLE `ps_custom_feature_tab` ( + `id_custom_feature_tab` INT(11) UNSIGNED AUTO_INCREMENT, + `id_feature` INT(11) UNSIGNED NOT NULL, + `id_feature_value` INT(11) UNSIGNED NOT NULL, + `position` INT(11) UNSIGNED NOT NULL DEFAULT 0, + `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, + `date_add` DATETIME NOT NULL, + `date_upd` DATETIME NOT NULL, + PRIMARY KEY (`id_custom_feature_tab`), + INDEX `idx_feature_value` (`id_feature`, `id_feature_value`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +``` -Primary key: (id_custom_feature_tab, id_lang) +### `ps_custom_feature_tab_lang` -## Modified Core Tables (by Modules) +```sql +CREATE TABLE `ps_custom_feature_tab_lang` ( + `id_custom_feature_tab` INT(11) UNSIGNED NOT NULL, + `id_lang` INT(11) UNSIGNED NOT NULL, + `title` VARCHAR(255) NOT NULL, + `content` TEXT, + PRIMARY KEY (`id_custom_feature_tab`, `id_lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +``` -### `ps_orders` — Order Source Field -Added by: `modules/AddOrderExtraFields/AddOrderExtraFields.php` +## Tabele modułów zewnętrznych -| Column | Type | Notes | -|--------|------|-------| -| order_source | ENUM('Allegro', 'Sklep int.', 'Telefonicznie') | Added via ALTER TABLE | +Większość modułów (`x13allegro`, `empikmarketplace`, `baselinker`, kurierów, płatności) tworzy własne tabele w `install()`. Lista konkretna wymaga inspekcji `modules//.php` lub `modules//sql/`. -Logic: Set in `modules/AddOrderExtraFields/override/classes/PaymentModule.php` -- 'Allegro' — when `$order->module == 'x13allegro'` -- 'Sklep int.' — default for web store orders -- 'Telefonicznie' — manual phone orders (set manually in admin) +Przykład: `modules/productcomments/install.sql` — jedyny obecnie wykryty plik `.sql` poza migracjami custom. -### `ps_order_payment` — Card Payment Field -Added by: `override/classes/order/OrderPayment.php` -- Additional field for storing card payment type (max 254 chars) +## ORM-y -## Migration Approach +- Standard: `ObjectModel` PS oraz `Db::getInstance()->execute/query/getRow`. +- Lekki ORM w roocie: `medoo.php` (~38 KB) — używany w skryptach operacyjnych (`custom-script.php`, `import-products.php`, `export*.php`). Nie wpływa na rdzeń PS, ale stanowi alternatywną ścieżkę dostępu do DB. -- No migration framework — DDL executed in module `install()` methods -- ALTER TABLE statements in `AddOrderExtraFields.php` -- CREATE TABLE in `customfeaturetab.php` -- No rollback scripts (uninstall drops custom tables) -- No version tracking for schema changes +## Migracje -## Known Issues +- Brak narzędzia migracyjnego (np. Doctrine Migrations). +- Migracje zaszyte w `install()` modułów (np. `AddOrderExtraFields` wykonuje ALTER + dosypywanie override w jednym kroku). +- Brak rollbacku — `uninstall()` zwykle tylko `DROP TABLE` lub pełne `parent::uninstall()`. -- Custom tables use `utf8` charset (should be `utf8mb4` for full Unicode/emoji support) -- `ps_custom_feature_tab` has no index on `id_feature` or `id_feature_value` (potential slow queries on large catalogs) -- `order_source` enum requires ALTER TABLE to add new order sources +## Zalecane sprawdzenia ---- - -*DB schema: 2026-04-27* -*Update when modules add/modify tables* +- Pełna lista tabel custom w `ps_*` na produkcji (`SHOW TABLES LIKE 'ps_custom%'`, `SHOW COLUMNS FROM ps_orders LIKE 'order_source'`). +- Audyt rozmiaru `log.txt`/`order.log` vs odpowiadające tabele logów PS (`ps_log`, `ps_orders_state_history`). diff --git a/.paul/codebase/impact_map.md b/.paul/codebase/impact_map.md new file mode 100644 index 00000000..4afd2b33 --- /dev/null +++ b/.paul/codebase/impact_map.md @@ -0,0 +1,86 @@ +# Impact Map — interblue.pl + +**Aktualizacja:** 2026-05-20 +**Tryb skanu:** full (radar lekki — codebase-memory-mcp nie indeksował repo; inspekcja ręczna + grep) + +Mapa pokazuje gdzie typowe zmiany propagują się w kodzie. + +## Domeny i powiązane pliki + +### Zamówienia / checkout + +- Override klas: `override/classes/order/Order.php`, `override/classes/order/OrderCarrier.php`, `override/classes/order/OrderHistory.php`, `override/classes/order/OrderInvoice.php`, `override/classes/order/OrderPayment.php`. +- Override front controller: `override/controllers/front/OrderController.php` (one-page checkout). +- Backup legacy: `override/controllers/front/OrderController.php_BK-OPC-PTS_2020-01-21` (do usunięcia/audytu). +- CQRS rozszerzenia: `src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php`, `src/Core/Domain/Order/QueryHandler/GetOrderForViewingHandlerInterface.php`, `src/Core/Domain/Order/QueryResult/OrderShippingForViewing.php`, `src/Core/Domain/Order/QueryResult/OrderShippingAddressForViewing.php`. +- Moduły wpływające: `modules/onepagecheckoutps/`, `modules/modrefchange/`, `modules/AddOrderExtraFields/`, `modules/ordersextracolumns/`, `modules/deleteordersfree/`, `modules/addcolumninlist/`. +- DB: tabela `ps_orders` (kolumna `order_source` dodana przez `AddOrderExtraFields`). +- Hooks: `actionBeforeAddOrder`, `actionBeforeAddOrderInvoice`, `actionBeforeAddDeliveryNumber`. +- Logi: `order.log`. + +### Karta produktu + +- Templates: `themes/InterBlue/templates/catalog/product.tpl` (i partials w `themes/InterBlue/templates/catalog/_partials/`). +- Override: `override/controllers/front/ProductController.php`, `override/classes/Product.php`. +- Moduły rozszerzeń: `modules/customfeaturetab/` (zakładki cech), `modules/cmsproducts/`, `modules/cmsproductspro/`, `modules/ppbrandslider/`, `modules/productcomments/`, `modules/ekomiratingsandreviews/`. +- Hook integracji: `displayProductExtraContent`. +- DB: `ps_custom_feature_tab`, `ps_custom_feature_tab_lang`. + +### Lista produktów / katalog (FO) + +- Templates: `themes/InterBlue/templates/catalog/listing/`, `themes/InterBlue/templates/catalog/_partials/`. +- Override: `override/controllers/front/CategoryController.php`, `override/controllers/front/ManufacturerController.php`, `override/controllers/front/SupplierController.php`, `override/controllers/front/CmsController.php`. +- Filtry/wyszukiwanie: `modules/amazzingfilter/`, `modules/ps_facetedsearch/`, `modules/ps_searchbar/`, `modules/boproductfinder/`. + +### Lista produktów (BO) + +- ⚠ Konflikt: `modules/empikmarketplace/views/PrestaShop/Admin/Product/CatalogPage/Lists/list.html.twig`, `products_table.html.twig`. +- Powiązane: `modules/ordersextracolumns/`, `modules/addcolumninlist/`, `modules/adminmenu/`. + +### Płatności + +- Moduły: `modules/imoje/`, `modules/przelewy24/`, `modules/paybynet/`, `modules/ps_wirepayment/`, `modules/ps_cashondelivery/`, `modules/ps_checkpayment/`. +- Override: `override/classes/order/OrderPayment.php`. + +### Wysyłka / kurierzy + +- Moduły: `modules/dpdpoland/`, `modules/sensbitinpost/`, `modules/sensbitpaczkawruchu/`, `modules/sensbitpocztapolska/`, `modules/sensbitfedex/`, `modules/GeisLogistic/`, `modules/sposoby_dostawy/`. +- Override: `override/classes/order/OrderCarrier.php`. + +### Marketplace / sync + +- `modules/x13allegro/`, `modules/marzaallegro/`, `modules/empikmarketplace/`, `modules/baselinker/`. +- Feedy: `allegro-prices.txt`, `google-merchant_id-1.xml`. + +### Skrypty operacyjne (root) + +- `import-products.php`, `export.php`, `export-csv.php`, `custom-cron.php`, `custom-script.php`, `info.php`, `medoo.php`. +- Wpływ: dostęp do DB poza warstwą ObjectModel — łatwo zepsuć spójność. + +### Motyw / wygląd + +- SCSS źródła: `themes/InterBlue/assets/css/custom.scss`, `theme.scss`. +- JS: `themes/InterBlue/assets/js/core.js`, `themes/InterBlue/assets/js/_libraries/`, `themes/InterBlue/assets/js/classic/`, `themes/InterBlue/assets/js/InterBlue/`. +- Smarty: `themes/InterBlue/templates/`. + +### Cache i wydajność + +- `modules/litespeedcache/`, `modules/psoptimizer/`, `modules/pshowlazyimg/`, `modules/stlazyloading/`, `modules/x13webp/`. +- `.htaccess` (~89 KB) — reguły rewrite/cache HTTP. + +### Admin + +- `admin658c34/themes/` — custom skin BO. +- `modules/adminmenu/`, `modules/hooksmanager/`, `modules/dashactivity/`, `modules/dashgoals/`, `modules/dashproducts/`, `modules/dashtrends/`. + +## Ukryte sprzężenia + +- `Order.php` override jest generowany w `install()` modułu `AddOrderExtraFields` — reinstalacja modułu nadpisuje plik bez warning. +- Override `override/controllers/front/OrderController.php` zawiera markery `KEY_OPC_1.0.1` od `onepagecheckoutps` — aktualizacja modułu może wymagać ręcznej migracji override. +- `modrefchange` zmienia format numerów faktur poprzez hooks emitowane w `Order::add()` (override) — wyłączenie modułu zostawia hooks "puste" ale override nadal jest. +- 130+ modułów współdzieli hooks `displayHeader`, `displayHome`, `displayFooter` — zmiana kolejności może wpłynąć na render. +- Brak `.gitignore` poza pustym plikiem → ryzyko commitowania danych operacyjnych (`log.txt`, `order.log`, feedy). + +## Ścieżki weryfikacji manualnej + +Patrz `testing.md` → sekcja "Weryfikacja manualna". diff --git a/.paul/codebase/integrations.md b/.paul/codebase/integrations.md index e7f44497..fe8492f3 100644 --- a/.paul/codebase/integrations.md +++ b/.paul/codebase/integrations.md @@ -1,115 +1,70 @@ -# External Integrations +# Integracje — interblue.pl -**Analysis Date:** 2026-04-27 +**Aktualizacja:** 2026-05-20 -## Marketplaces +## Marketplace -**Allegro:** -- x13allegro (v7.4.0) - Primary Allegro integration, order sync, product listing - - Module: `modules/x13allegro/x13allegro.php` - - Sync script: `modules/x13allegro/sync.php` - - Suppresses customer emails for Allegro orders -- marzaallegro (v1.0.0) - Allegro pricing/markup module - - Module: `modules/marzaallegro/` +- **Allegro** — `modules/x13allegro/`, `modules/marzaallegro/` (kalkulacja marży), feed cen `allegro-prices.txt`. +- **Empik Marketplace** — `modules/empikmarketplace/`. ⚠ Nadpisuje widok listy produktów w BO (`views/PrestaShop/Admin/Product/CatalogPage/Lists/list.html.twig`, `products_table.html.twig`). +- **BaseLinker** — `modules/baselinker/` (synchronizacja stanów, zamówień, multi-channel). -**Empik:** -- empikmarketplace (v2.3.0 by Waynet) - EmpikPlace integration - - Module: `modules/empikmarketplace/empikmarketplace.php` - - PSR-4 autoload: `Empik\Marketplace\` - - Overrides admin product catalog views: - `modules/empikmarketplace/views/PrestaShop/Admin/Product/CatalogPage/Lists/list.html.twig` +## Płatności -## Shipping / Logistics +- `modules/imoje/` — iMoje (ING). +- `modules/przelewy24/` — Przelewy24. +- `modules/paybynet/` — PayByNet. +- Wbudowane: `ps_wirepayment` (przelew), `ps_cashondelivery` (pobranie), `ps_checkpayment`. -**DPD Polska:** -- Module: `modules/dpdpoland/` (v4.5.0) +## Kurierzy -**InPost:** -- Module: `modules/sensbitinpost/` (v5.9.2) - InPost ShipX API +- `modules/dpdpoland/` — DPD PL. +- `modules/sensbitinpost/` — InPost (Paczkomaty, Kurier). +- `modules/sensbitpaczkawruchu/` — Paczka w Ruchu. +- `modules/sensbitpocztapolska/` — Poczta Polska. +- `modules/sensbitfedex/` — FedEx. +- `modules/GeisLogistic/` — Geis. +- `modules/sposoby_dostawy/` — custom konfigurator metod dostawy. -**Poczta Polska:** -- Module: `modules/sensbitpocztapolska/` (v5.6.2) +## Analityka i SEO -**Paczka w Ruchu:** -- Module: `modules/sensbitpaczkawruchu/` +- `modules/cdc_googletagmanager/`, `modules/seigitagmanager/` — GTM. +- `modules/pdgoogleanalytycs4pro/` — GA4. +- `modules/pdgooglemerchantcenterpro/` — Google Merchant Center; feed `google-merchant_id-1.xml` w roocie (~16 MB). +- `modules/gsitemap/` — sitemap. +- `modules/fsadvancedurl/` — zaawansowane przyjazne URL. +- `modules/gmcatseconddesc/` — drugie opisy kategorii. -**FedEx:** -- Module: `modules/sensbitfedex/` +## E-mail i komunikacja -**Geis Logistic:** -- Module: `modules/GeisLogistic/` +- `modules/sendinblue/` — Sendinblue (Brevo). +- `modules/ekomiratingsandreviews/`, `modules/ekomiSff/` — eKomi (recenzje). +- `modules/productcomments/` — natywne komentarze produktów. +- `modules/contactform/`, `modules/ps_emailalerts/`, `modules/ps_emailsubscription/`. -## Payment Gateways +## UI/UX i marketing -**Przelewy24:** -- Module: `modules/przelewy24/` (v1.3.96) - Polish online payments +- `modules/revsliderprestashop/` — Slider Revolution. +- `modules/stbanner/`, `modules/ps_imageslider/`, `modules/ps_banner/`. +- `modules/cookiesplus/`, `modules/uecookie/`, `modules/psgdpr/` — RODO / cookies. +- `modules/referralprogram/` — program poleceń. +- `modules/onepagecheckoutps/` — one-page checkout (krytyczny dla konwersji). -**iMoje (ING Bank):** -- Module: `modules/imoje/` (v1.3.4) - Visa, MasterCard, BLIK +## Wydajność -**Native PrestaShop:** -- Cash on delivery: `modules/ps_cashondelivery/` -- Wire transfer: `modules/ps_wirepayment/` -- Check payment: `modules/ps_checkpayment/` +- `modules/litespeedcache/` — LiteSpeed Cache (HTTP cache na serwerze). +- `modules/psoptimizer/`, `modules/pshowlazyimg/`, `modules/stlazyloading/`, `modules/x13webp/` — optymalizacje assetów. -## Order Management +## Pliki konfiguracyjne i klucze -**BaseLinker:** -- Module: `modules/baselinker/` (v0.0.25) - Multi-channel order management - - Integration via webservice API +- `.vscode/ftp-kr.json` — dane FTP (⚠ plaintext — patrz `quality_risks.md`). +- Konfiguracje modułów trzymane w tabeli `ps_configuration` (standard PS). +- Brak `.env`/`.env.local` — konfiguracja środowiskowa przez `config/settings.inc.php` (na serwerze produkcyjnym). -**One-Page Checkout:** -- Module: `modules/onepagecheckoutps/` (v1.0.1 by PresTeamShop) - - Overrides: `override/controllers/front/OrderController.php` (653 lines) +## Zewnętrzne API (typowo) -## Analytics & Tracking - -**Google Tag Manager:** -- Module: `modules/cdc_googletagmanager/` - -**Google Analytics 4:** -- Module: `modules/pdgoogleanalytycs4pro/` (uses Guzzle HTTP client) - -**Google Merchant Center:** -- Module: `modules/pdgooglemerchantcenterpro/` - -**eKomi Ratings:** -- Module: `modules/ekomiratingsandreviews/` - -## SEO & URL - -**Advanced URLs:** -- Module: `modules/fsadvancedurl/` - Custom URL rewriting - - Overrides: `override/classes/Dispatcher.php`, `override/classes/Link.php` - -**Sitemap:** -- Module: `modules/gsitemap/` - -## Performance & Caching - -**LiteSpeed Cache:** -- Module: `modules/litespeedcache/` - - Override: `override/classes/Media.php` - -**PS Optimizer + Lazy Images + WebP:** -- `modules/psoptimizer/`, `modules/pshowlazyimg/`, `modules/x13webp/` - -## Cookie Consent - -**Cookies Plus:** -- Module: `modules/cookiesplus/` - - Override: `override/classes/Hook.php` - intercepts hook execution for GDPR consent - -## Environment Configuration - -**Production:** -- DB: `app/config/parameters.php` (credentials, memcached config) -- Admin: `admin658c34/` (obfuscated path) -- Deployment: FTP via `.vscode/ftp-kr.json` - -**No staging environment detected.** - ---- - -*Integration audit: 2026-04-27* -*Update when adding/removing external services* +- Allegro REST API (przez `x13allegro`). +- Empik Marketplace API (`empikmarketplace`). +- BaseLinker API. +- API kurierów (DPD, InPost ShipX, PP, PwR). +- API płatności (iMoje, Przelewy24). +- Google APIs (GA4, GMC, GTM). diff --git a/.paul/codebase/quality_risks.md b/.paul/codebase/quality_risks.md new file mode 100644 index 00000000..9c0a8321 --- /dev/null +++ b/.paul/codebase/quality_risks.md @@ -0,0 +1,108 @@ +# Quality Risks — interblue.pl + +**Aktualizacja:** 2026-05-20 +**Tryb skanu:** full (codebase-memory-mcp: degraded — nie indeksowano repo automatycznie; jscpd/ast-grep: disabled by policy). Inspekcja ręczna + grep. + +## 🔴 Krytyczne + +### Sekret w repo + +- `.vscode/ftp-kr.json` zawiera **plaintext credentials FTP** do `ftp.interblue.pl` (user `project-pro@interblue.pl`, hasło widoczne, port 21 — brak FTPS). Plik jest w repo. +- Rekomendacja: usunąć z gita (`git rm --cached`), dodać do `.gitignore`, zmienić hasło FTP, rozważyć migrację na SFTP/FTPS, użyć VS Code SecretStorage lub `.env` pomijany przez VCS. + +### Brak `.gitignore` + +- `.gitignore` istnieje, ale jest pusty (`-rw-r--r-- ... 0 ...gitignore`). +- Skutek: ryzyko commitowania `var/cache/`, `log.txt` (1 MB+), `order.log`, feedów (`google-merchant_id-1.xml` ~16 MB), backupów `.htaccess.bck`, `OrderController.php_BK-OPC-PTS_2020-01-21`. + +## 🟠 Wysokie + +### Override `Order.php` zarządzany przez instalator modułu + +- `modules/AddOrderExtraFields/AddOrderExtraFields.php::install()` kopiuje plik override z `_overrides/classes/order/Order.php` lub `Order-modrefchange.php` zależnie od obecności `modrefchange`. +- Skutki: + - reinstalacja modułu nadpisuje ewentualne ręczne modyfikacje override, + - brak migracji w drugą stronę przy odinstalowaniu `modrefchange`, + - `uninstall()` w `AddOrderExtraFields` nie usuwa override ani kolumny `order_source`. + +### Błąd składniowy w SQL migracji `AddOrderExtraFields` + +Plik `modules/AddOrderExtraFields/AddOrderExtraFields.php` zawiera: + +```php +if (!Db::getInstance()->execute( + 'ALTER TABLE ' . _DB_PREFIX_ . 'orders ADD `order_source` enum(\'Allegro\', \'Sklep int.\', \'Telefonicznie\') NULL DEFAULT' +)); +return true; +``` + +Problemy: +- `NULL DEFAULT` bez wartości po `DEFAULT` — SQL jest niepoprawny. +- Średnik po `if (...)` — warunek nic nie robi, `return true` jest wykonywany niezależnie od wyniku. +- Brak rollbacku w `uninstall()` (`uninstall()` tylko `parent::uninstall()`). + +### Hardkodowane wartości enum dla `order_source` + +- Lista źródeł zamówień (`'Allegro', 'Sklep int.', 'Telefonicznie'`) zaszyta w SQL i prawdopodobnie w UI modułu. +- Dodanie nowego źródła wymaga ALTER TABLE + edycji kodu/szablonów. +- Pole `$order_source` w override `Order.php` nie jest w `$definition['fields']` — nie persistuje się przez `save()`. + +### Override generowane w trybie kopiowania pliku + +- `modules/AddOrderExtraFields/_overrides/` to "magazyn" plików kopiowanych do `override/` — odbiera kontrolę PrestaShop, który normalnie scala overrides. + +### Plik backup w `override/` + +- `override/controllers/front/OrderController.php_BK-OPC-PTS_2020-01-21` — backup z 2020. Wpływa na class index/auto-loader? Prawdopodobnie nie (rozszerzenie nie-`.php`), ale niejasny status. + +### Nadpisanie BO list view przez `empikmarketplace` + +- `modules/empikmarketplace/views/PrestaShop/Admin/Product/CatalogPage/Lists/list.html.twig` i `products_table.html.twig` nadpisują widok katalogu produktów w BO. +- Po aktualizacji modułu zmiany ręczne znikają. + +## 🟡 Średnie + +### Duplikaty/legacy w `override/` + +- Wiele klas w `override/classes/` (m.in. `Combination.php`, `Hook.php`, `Link.php`, `Media.php`, `Product.php`, `Dispatcher.php`, `Smarty/`). Nie wiadomo które są aktywnie utrzymywane, a które relikty po starych modułach. + +### Lekki ORM medoo w roocie + +- `medoo.php` (~38 KB) używany w `import-products.php`, `export*.php`, `custom-script.php` — alternatywna ścieżka do DB poza `Db::getInstance()`. Zapytania surowe — większe ryzyko SQL injection jeśli budowane są ze stringów. + +### Brak testów + +- Patrz `testing.md`. Każda zmiana w override/`modules/` wymaga UAT. + +### Brak CI/CD + +- `autoUpload: true` w `.vscode/ftp-kr.json` — zapis lokalny = upload na produkcję. Brak stagingu w workflow. + +### Smarty BC + +- `config/settings.inc.php` zaczyna się od `//@deprecated 1.7` — sygnał, że plik powinien być migrowany na nowszy format konfiguracji. + +### Duże pliki w repo + +- `google-merchant_id-1.xml` ~16 MB, `log.txt` ~1 MB, `.htaccess` ~89 KB, `.htaccess.bck` ~77 KB. + +### Mieszane konwencje nazewnictwa modułów + +- `customfeaturetab` (lowercase) vs `AddOrderExtraFields` (CamelCase) — PS akceptuje, ale niespójność utrudnia czytelność. + +## 🟢 Niskie / przyjęte + +- 133 moduły w `modules/` — większość to natywne `ps_*` lub zewnętrzne (autoupgrade, gamification, blockreassurance itd.) — nie wymagają audytu w skanie podstawowym. +- `litespeedcache` jako dodatkowy layer cache — uznawany za stabilny. + +## Sugerowane konsolidacje + +- Wycofać `_overrides/` w `AddOrderExtraFields` na rzecz standardowego override PS. +- Wprowadzić `.gitignore` blokujący: `var/cache/`, `var/logs/`, `log.txt`, `order.log`, `*.log`, `.vscode/ftp-kr.json`, `*.bck`, `*_BK-*`, duże feedy XML. +- Tabela słownikowa zamiast enum `order_source`. +- Usunąć backup `OrderController.php_BK-OPC-PTS_2020-01-21` z `override/controllers/front/`. + +## Znane false-positive / akceptowane + +- Polskie komentarze w kodzie modułów custom — akceptowane (lokalizacja PL). +- Custom ścieżka admina `admin658c34/` — świadoma decyzja (security through obscurity, dodatkowa warstwa do innych zabezpieczeń). diff --git a/.paul/codebase/stack.md b/.paul/codebase/stack.md index 32f6fd00..7d84809d 100644 --- a/.paul/codebase/stack.md +++ b/.paul/codebase/stack.md @@ -1,86 +1,41 @@ -# Technology Stack +# Stack — interblue.pl -**Analysis Date:** 2026-04-27 +**Aktualizacja:** 2026-05-20 -## Languages +## Platforma -**Primary:** -- PHP 7.x+ - All server-side logic (modules, overrides, controllers) -- Smarty - Template engine for `.tpl` theme files in `themes/InterBlue/templates/` +- **PrestaShop 1.7.7.0** (`app/AppKernel.php`: `const VERSION = '1.7.7.0'`). +- PHP — wersja zgodna z PrestaShop 1.7.7 (>= 7.1; produkcja prawdopodobnie 7.2/7.3). +- MySQL/MariaDB — silnik `_MYSQL_ENGINE_` (zwykle InnoDB), prefiks tabel `_DB_PREFIX_` (domyślnie `ps_`). +- Symfony 4 (warstwa BO) + Smarty (warstwa FO i część BO). -**Secondary:** -- SCSS/CSS - Stylesheets in `themes/InterBlue/assets/css/` -- JavaScript - Frontend logic in `themes/InterBlue/assets/js/` +## Frontend -## Runtime +- Motyw `themes/InterBlue/` (oparty na PS classic). +- Smarty `.tpl` w `themes/InterBlue/templates/`. +- SCSS: `themes/InterBlue/assets/css/custom.scss` i `theme.scss`. +- Kompilacja przez **VSCode Live Sass Compiler** (autoprefixer, compressed, sourcemaps), konfiguracja w `.vscode/settings.json`. +- JS: `themes/InterBlue/assets/js/` (`core.js`, `theme.js`, `package-lock.json` w `themes/InterBlue/_dev`/podobnie). -**Environment:** -- PHP 5.6+ minimum requirement (targeting PHP 7.x+ for PS 1.7.x stability) -- MySQL/MariaDB - Database (`interblue_sklep` on `dedyk75.cyber-folks.pl`) -- Memcached - Caching layer (`ps_caching: 'CacheMemcached'`) +## Backend / klasy -**Package Manager:** -- No Node.js package manager for custom code -- Composer used by individual modules (empikmarketplace, autoupgrade) +- Overrides w `override/classes/`, `override/controllers/front/`, `override/modules/`. +- CQRS-style rozszerzenia dla podglądu zamówień w `src/Adapter/Order/QueryHandler/` i `src/Core/Domain/Order/`. +- 133 moduły w `modules/` (ls modules | wc -l = 133). -## Frameworks +## Narzędzia developerskie -**Core:** -- PrestaShop 1.7.x - E-commerce framework (MVC + Hooks) -- Symfony components - Used internally by PS 1.7 (service container, YAML) +- **VSCode SFTP/FTP Sync** (`.vscode/ftp-kr.json`) — wdrożenia ręczne na produkcję. +- **Live Sass Compiler** — kompilacja SCSS na zapis. +- Brak `composer.json` w roocie (rdzeń PS ma własny). Brak `package.json` na poziomie projektu. +- Brak CI/CD, brak testów automatycznych w repo. -**Testing:** -- None - No test framework in custom modules +## Pliki służbowe / dane -**Build/Dev:** -- VSCode Live Sass Compiler - Compiles `custom.scss` to `custom.css` (compressed + sourcemap) -- Config: `.vscode/settings.json` +- `log.txt` (~1 MB), `order.log`, `allegro-prices.txt`, `ga.txt`, `ga-db.txt`, `google-merchant_id-1.xml` (~16 MB) — artefakty operacyjne i feedy. +- `Odstąpienie_od_umowy_informacja.pdf` — dokument prawny. +- `.htaccess` (~89 KB) + `.htaccess.bck` — kontrola reguł routingu i redirectów. -## Key Dependencies +## Skrypty rdzenia projektu (root) -**Critical:** -- PrestaShop 1.7.x - Core e-commerce platform -- `prestashop/module-lib-service-container` (^1.4) - PSR-11 container for empikmarketplace -- `guzzlehttp/guzzle` - HTTP client (analytics, integration modules) - -**Marketplace Modules:** -- x13allegro 7.4.0 - Allegro integration - `modules/x13allegro/` -- empikmarketplace 2.3.0 - Empik integration - `modules/empikmarketplace/` -- baselinker 0.0.25 - BaseLinker webservice - `modules/baselinker/` - -**Shipping Modules:** -- dpdpoland 4.5.0 - `modules/dpdpoland/` -- sensbitinpost 5.9.2 - `modules/sensbitinpost/` -- sensbitpocztapolska 5.6.2 - `modules/sensbitpocztapolska/` - -**Payment Modules:** -- przelewy24 1.3.96 - `modules/przelewy24/` -- imoje 1.3.4 - `modules/imoje/` - -## Configuration - -**Environment:** -- Database credentials: `app/config/parameters.php` -- DB host: `dedyk75.cyber-folks.pl`, DB: `interblue_sklep`, prefix: `ps_` -- Mailer: SMTP (localhost 127.0.0.1) -- Locale: `pl-PL` - -**Build:** -- `.vscode/settings.json` - Live Sass Compiler config -- `themes/InterBlue/config/theme.yml` - Theme metadata and hook assignments - -## Platform Requirements - -**Development:** -- Windows + VSCode with Live Sass Compiler extension -- SFTP/FTP Sync extension for deployment - -**Production:** -- Hosting: dedyk75.cyber-folks.pl (cyber-folks.pl) -- Deployment: Manual FTP via `.vscode/ftp-kr.json` -- Cache clearing: Manual via admin panel or `var/cache/` deletion - ---- - -*Stack analysis: 2026-04-27* -*Update after major dependency changes* +- `custom-script.php`, `custom-cron.php`, `import-products.php`, `export.php`, `export-csv.php`, `medoo.php` (lekki ORM), `info.php` — narzędzia operacyjne wystawione w roocie. diff --git a/.paul/codebase/structure.md b/.paul/codebase/structure.md deleted file mode 100644 index 6873ddce..00000000 --- a/.paul/codebase/structure.md +++ /dev/null @@ -1,149 +0,0 @@ -# Codebase Structure - -**Analysis Date:** 2026-04-27 - -## Directory Layout - -``` -interblue.pl/ -├── admin658c34/ # Admin panel (obfuscated path for security) -├── app/ # Symfony app config, parameters -│ └── config/ # parameters.php (DB credentials, cache) -├── classes/ # PrestaShop core model classes -├── config/ # Bootstrap, defines, autoloader -├── controllers/ # Core front/admin controllers -├── custom/ # Custom utility files (medoo.php, scripts) -├── modules/ # 133 installed modules -├── override/ # Class and controller overrides -│ ├── classes/ # Core class overrides -│ │ ├── order/ # Order, OrderInvoice, OrderPayment, OrderCarrier -│ │ └── controller/ # FrontController override -│ ├── controllers/ -│ │ └── front/ # ProductController, OrderController, CategoryController -│ └── modules/ # Module template overrides -├── src/ # Custom CQRS extensions (Order domain) -│ ├── Adapter/Order/QueryHandler/ -│ └── Core/Domain/Order/ -├── themes/ -│ └── InterBlue/ # Custom theme -│ ├── assets/ -│ │ ├── css/ # SCSS sources + compiled CSS -│ │ └── js/ # custom.js -│ ├── config/ # theme.yml -│ ├── mails/pl/ # Polish email templates -│ └── templates/ # Smarty .tpl templates -├── var/cache/ # Compiled cache (do not edit) -├── .vscode/ # VS Code config (Live Sass, FTP) -├── .paul/ # PAUL project management -└── changelog/ # Daily changelogs (YYYY-MM-DD.md) -``` - -## Directory Purposes - -**`modules/` — Key custom and integration modules:** -- `modules/customfeaturetab/` — Custom product tabs from feature values -- `modules/AddOrderExtraFields/` — Order source field (Allegro/Sklep int.) -- `modules/x13allegro/` — Allegro marketplace (primary, v7.4.0) -- `modules/empikmarketplace/` — Empik marketplace (v2.3.0) -- `modules/baselinker/` — BaseLinker order management -- `modules/onepagecheckoutps/` — One-page checkout -- `modules/dpdpoland/`, `modules/sensbitinpost/`, etc. — Shipping carriers -- `modules/przelewy24/`, `modules/imoje/` — Payment gateways - -**`override/` — Critical overrides:** -- `override/classes/order/Order.php` — Hooks before invoice/delivery number (modrefchange) -- `override/classes/Hook.php` — GDPR cookie consent intercept (cookiesplus) -- `override/classes/Dispatcher.php` — Custom URL routing (fsadvancedurl) -- `override/classes/Link.php` — URL generation (fsadvancedurl) -- `override/controllers/front/OrderController.php` — One-page checkout (onepagecheckoutps) -- `override/controllers/front/ProductController.php` — Custom URL parsing - -**`themes/InterBlue/` — Custom theme:** -- `assets/css/custom.scss` — Main stylesheet (EDIT THIS for CSS changes) -- `assets/css/custom.css` — Compiled output (auto-generated, do not edit) -- `assets/css/theme.scss` — Theme base styles -- `assets/js/custom.js` — Custom JavaScript (jQuery) -- `templates/catalog/product.tpl` — Product detail page -- `templates/catalog/listing/` — Category/listing pages -- `templates/checkout/` — Checkout templates -- `config/theme.yml` — Theme config, hook assignments - -**`src/` — CQRS Order extensions:** -- `src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php` -- `src/Core/Domain/Order/QueryHandler/GetOrderForViewingHandlerInterface.php` -- `src/Core/Domain/Order/QueryResult/` — Value objects - -## Key File Locations - -**Configuration:** -- `app/config/parameters.php` — DB credentials, memcached, mailer config -- `config/defines.inc.php` — Constants, dev mode flag -- `config/config.inc.php` — Main PS bootstrap -- `.vscode/ftp-kr.json` — FTP deployment config -- `.vscode/settings.json` — Live Sass Compiler settings - -**Core Logic:** -- `override/classes/order/Order.php` — Order creation hooks -- `modules/AddOrderExtraFields/override/classes/PaymentModule.php` — Order source logic -- `modules/customfeaturetab/customfeaturetab.php` — Feature tab module -- `modules/customfeaturetab/classes/CustomFeatureTabRule.php` — ObjectModel - -**Theme Entry:** -- `themes/InterBlue/assets/css/custom.scss` — CSS entry point (edit this) -- `themes/InterBlue/assets/js/custom.js` — JS entry point - -**Admin:** -- `admin658c34/` — Admin panel root - -## Naming Conventions - -**Files:** -- Module main files: `{modulename}/{modulename}.php` (e.g., `customfeaturetab/customfeaturetab.php`) -- ObjectModel classes: PascalCase (e.g., `CustomFeatureTabRule.php`) -- Admin controllers: `Admin{Name}Controller.php` -- Smarty templates: `{page-name}.tpl` in appropriate subdirectory - -**Directories:** -- Modules: lowercase, no hyphens (e.g., `customfeaturetab`, `addcolumninlist`) -- Theme templates: follow PrestaShop structure (`catalog/`, `checkout/`, `customer/`) - -**Database Tables:** -- Custom tables use `ps_` prefix + module name (e.g., `ps_custom_feature_tab`) -- Module columns on core tables: `ps_orders.order_source` - -## Where to Add New Code - -**New CSS/SCSS changes:** -- Edit: `themes/InterBlue/assets/css/custom.scss` -- Auto-compiled by Live Sass Compiler on save - -**New custom module:** -- Create: `modules/{modulename}/{modulename}.php` -- ObjectModel: `modules/{modulename}/classes/{ModelName}.php` -- Admin controller: `modules/{modulename}/controllers/admin/Admin{Name}Controller.php` -- Templates: `modules/{modulename}/views/templates/` - -**New PrestaShop override:** -- Add to: `override/classes/{ClassName}.php` or `override/controllers/{type}/{Name}Controller.php` -- Clear PS class index after: delete `var/cache/*/class_index.php` - -**New product page content:** -- Hook: `displayProductExtraContent` (or `displayProductAdditionalInfo`) -- Implement in a module - -## Special Directories - -**`var/cache/`:** -- Purpose: Compiled Smarty templates, class indexes, config cache -- Source: Auto-generated by PrestaShop -- Action: Clear via admin panel after PHP/template changes - -**`admin658c34/`:** -- Purpose: Admin panel -- Security: Randomized folder name (obfuscation) -- Not in git (typically) - ---- - -*Structure analysis: 2026-04-27* -*Update when directory structure changes* diff --git a/.paul/codebase/testing.md b/.paul/codebase/testing.md index 8ba21eae..fe416cbd 100644 --- a/.paul/codebase/testing.md +++ b/.paul/codebase/testing.md @@ -1,67 +1,40 @@ -# Testing Patterns +# Testy — interblue.pl -**Analysis Date:** 2026-04-27 +**Aktualizacja:** 2026-05-20 -## Test Framework +## Stan -**Runner:** None — no unit/integration test framework in custom modules +- **Brak testów automatycznych** w repozytorium. +- Brak konfiguracji PHPUnit, brak `tests/`, brak `phpunit.xml`, brak `composer.json` na poziomie projektu. +- Brak konfiguracji lintów PHP (PHPStan/Psalm/PHP_CodeSniffer) widocznej w roocie. -**Static Analysis:** -- PHPStan (level 5) present only in `modules/blockreassurance/tests/php/phpstan/phpstan.neon` -- Not configured for custom modules (`customfeaturetab`, `AddOrderExtraFields`) +## Weryfikacja manualna -**Run Commands:** -```bash -# No test commands defined -# Only available for blockreassurance (pre-installed PS module): -# modules/blockreassurance/tests/php/phpstan/ -``` +Każda zmiana wymaga manualnej weryfikacji na sklepie. Krytyczne ścieżki UAT: -## Test File Organization +1. **Koszyk + checkout (one-page)** — `themes/InterBlue/templates/checkout/`, `modules/onepagecheckoutps/`, `override/controllers/front/OrderController.php`. +2. **Zamówienie → numeracja faktur/dostaw** — hooks `actionBeforeAddOrder`, `actionBeforeAddOrderInvoice`, `actionBeforeAddDeliveryNumber` (override `Order.php`, moduł `modrefchange`). +3. **Karta produktu + zakładki cech** — `modules/customfeaturetab/` (hook `displayProductExtraContent`). +4. **Integracje marketplace** — synchronizacja Allegro (`x13allegro`), Empik (`empikmarketplace`), BaseLinker. +5. **Wysyłka** — generowanie etykiet i numerów (`dpdpoland`, `sensbitinpost`, `sensbitpaczkawruchu`, `sensbitpocztapolska`). +6. **Płatności** — `imoje`, `przelewy24`, `paybynet`. +7. **Admin katalogu produktów** — sprawdzić czy `empikmarketplace` nie nadpisuje listy (`views/PrestaShop/Admin/Product/CatalogPage/Lists/`). +8. **Cache** — po zmianach w `override/`, klasach, szablonach: BO → Performance → Clear cache. -**Custom modules — no tests found:** -- `modules/customfeaturetab/` — no tests directory -- `modules/AddOrderExtraFields/` — no tests directory -- `modules/addcolumninlist/` — no tests directory +## Smoke checks -**Pre-installed modules with static analysis only:** -- `modules/blockreassurance/tests/php/phpstan/` — PHPStan config only +- `index.php` (FO) zwraca 200. +- `admin658c34/` (BO) zwraca login. +- `var/cache//class_index.php` regeneruje się po czyszczeniu cache. -**Core PrestaShop:** -- `classes/ConfigurationTest.php` — system configuration checker (not unit tests) +## Logi do monitorowania -## Coverage +- `log.txt` (root, ~1 MB) — surowe logi aplikacyjne. +- `order.log` — logi zamówień (custom). +- `var/logs/` rdzenia PS (na serwerze, niekoniecznie w repo). -**Requirements:** None enforced +## Rekomendacje -**Current state:** No automated test coverage for custom code - -## Testing Approach in This Project - -Since there is no automated test suite, verification is done manually: - -1. **Deploy to production via FTP** (`.vscode/ftp-kr.json`) -2. **Clear PrestaShop cache** — Admin → Advanced Parameters → Performance -3. **Manual browser testing** of affected pages -4. **Check admin panel** for errors after module changes - -## Recommendations for Adding Tests - -If implementing tests in the future: - -**For PHP modules:** -- PHPUnit 9.x (compatible with PHP 7.x) -- Composer dev dependency in module -- Test location: `modules/{name}/tests/` - -**For static analysis:** -- PHPStan level 5+ with PrestaShop stubs -- Config: `modules/{name}/phpstan.neon` - -**For Smarty templates:** -- Manual verification only (no template test framework) - ---- - -*Testing analysis: 2026-04-27* -*Update when test patterns change* +- Wprowadzić `composer.json` + PHPUnit dla modułów custom (`customfeaturetab`, `AddOrderExtraFields`). +- Statyczna analiza (PHPStan poziom 0–2) dla `override/` i `modules/customfeaturetab/`, `modules/AddOrderExtraFields/`. +- Smoke test postdeploy: kontrola HTTP 200 + cache regeneration. diff --git a/.paul/codebase/todo.md b/.paul/codebase/todo.md deleted file mode 100644 index 078d295e..00000000 --- a/.paul/codebase/todo.md +++ /dev/null @@ -1,4 +0,0 @@ -# TODO - -> Luźny parking pomysłów, rzeczy do sprawdzenia, rzeczy które mogą nigdy nie być wdrożone. -> Nie wymaga formalności — wrzucaj co chcesz. diff --git a/.paul/codebase/tooling_status.md b/.paul/codebase/tooling_status.md new file mode 100644 index 00000000..7a5e61b3 --- /dev/null +++ b/.paul/codebase/tooling_status.md @@ -0,0 +1,37 @@ +# Tooling Status — interblue.pl + +**Timestamp:** 2026-05-20 +**Tryb skanu:** full (`$paul-map-codebase`) + +## Wyniki narzędzi + +| Narzędzie | Status | Uwagi | +| --- | --- | --- | +| `codebase-memory-mcp` | degraded | MCP server dostępny (`mcp__codebase-memory-mcp__*`), ale w tym skanie repo NIE było indeksowane — analiza wykonana ręcznie (Glob/Grep/Bash). Pełne indeksowanie zalecane: `mcp__codebase-memory-mcp__index_repository`. | +| `jscpd` | disabled by policy | `quality_radar.tools.jscpd: false` w `.paul/config.md`. Aby uruchomić: jawny request lub flip flagi. | +| `ast-grep` | disabled by policy | `quality_radar.tools.ast_grep: false` w `.paul/config.md`. Aby uruchomić: jawny request lub flip flagi. | + +## Komendy próbowane + +- `ls`, `cat`, `grep -E "AppKernel::VERSION"` na `app/AppKernel.php` → `1.7.7.0`. +- `ls modules/ | wc -l` → 133. +- Inspekcja `override/`, `src/`, `themes/InterBlue/`, `.vscode/`. + +## Wykorzystane źródła + +- `CLAUDE.md` (project instructions). +- `app/AppKernel.php` (wersja PrestaShop). +- `modules/customfeaturetab/customfeaturetab.php`, `modules/customfeaturetab/config.xml`. +- `modules/AddOrderExtraFields/AddOrderExtraFields.php`. +- `override/classes/order/Order.php`, `override/controllers/front/OrderController.php`. +- `.vscode/ftp-kr.json` (znaleziono ryzyko bezpieczeństwa — patrz `quality_risks.md`). + +## Surowe wyjścia + +Brak — radar lekki nie generował dedykowanych raportów do `.paul/codebase/radar/`. Ustalenia są zsyntetyzowane bezpośrednio w `impact_map.md` i `quality_risks.md`. + +## Następne dzialanie + +1. Uruchomić pełne indeksowanie: `mcp__codebase-memory-mcp__index_repository` dla katalogu projektu, by przyszłe `$paul-plan` mogły używać `trace_path`/`search_graph` zamiast ręcznego grep. +2. Rozważyć włączenie `jscpd` jednorazowo dla `override/` i `modules/AddOrderExtraFields/`, `modules/customfeaturetab/`, `themes/InterBlue/` w celu wykrycia kopii kodu. +3. `$paul-plan [zadanie]` — wybrać pierwsze ryzyko z `quality_risks.md` (sugestia: usunięcie sekretów FTP z repo + `.gitignore`). diff --git a/.paul/config.md b/.paul/config.md index f62a538d..2a05c6a0 100644 --- a/.paul/config.md +++ b/.paul/config.md @@ -1,7 +1,7 @@ -# Project Config +# Project Config — interblue.pl -**Project:** interblue.pl -**Created:** 2026-04-27 +**Projekt:** interblue.pl +**Utworzono:** 2026-05-20 ## Project Settings @@ -9,16 +9,32 @@ project: name: interblue.pl version: 0.0.0 + platform: prestashop-1.7 ``` ## Integrations +### Quality Radar + +```yaml +quality_radar: + enabled: true + auto_install: true + tools: + codebase_memory_mcp: true + jscpd: false # manual/on-demand + ast_grep: false # manual/on-demand + reports: + update_on_plan: true + update_on_apply: true + update_on_verify: true +``` + ### SonarQube ```yaml sonarqube: enabled: false - reason: "User declined during init" ``` ## Preferences @@ -27,7 +43,12 @@ sonarqube: preferences: auto_commit: false verbose_output: false + parallel_agents: false + plan_storage: plans + state_autocompress: true + state_autocompress_max_lines: 500 ``` --- -*Config created: 2026-04-27* + +*Config utworzony: 2026-05-20* diff --git a/.paul/docs/API.md b/.paul/docs/API.md deleted file mode 100644 index cce27e0e..00000000 --- a/.paul/docs/API.md +++ /dev/null @@ -1,3 +0,0 @@ -# API - -> Endpointy, kontrakty request/response, autentykacja. diff --git a/.paul/docs/ARCHITECTURE.md b/.paul/docs/ARCHITECTURE.md deleted file mode 100644 index e76060ea..00000000 --- a/.paul/docs/ARCHITECTURE.md +++ /dev/null @@ -1,3 +0,0 @@ -# ARCHITECTURE - -> Struktura klas, modulow, przeplywow i zaleznosci w projekcie. diff --git a/.paul/docs/DB_SCHEMA.md b/.paul/docs/DB_SCHEMA.md deleted file mode 100644 index 737ad36f..00000000 --- a/.paul/docs/DB_SCHEMA.md +++ /dev/null @@ -1,3 +0,0 @@ -# DB_SCHEMA - -> Schemat bazy danych — tabele, kolumny, FK, indeksy. diff --git a/.paul/docs/DECISIONS.md b/.paul/docs/DECISIONS.md deleted file mode 100644 index 59239f4b..00000000 --- a/.paul/docs/DECISIONS.md +++ /dev/null @@ -1,3 +0,0 @@ -# DECISIONS - -> Kluczowe decyzje techniczne i ich uzasadnienia. diff --git a/.paul/docs/STACK.md b/.paul/docs/STACK.md deleted file mode 100644 index bad9fe6c..00000000 --- a/.paul/docs/STACK.md +++ /dev/null @@ -1,3 +0,0 @@ -# STACK - -> Stack technologiczny, wersje, zaleznosci, srodowisko. diff --git a/.paul/docs/TECH_CHANGELOG.md b/.paul/docs/TECH_CHANGELOG.md deleted file mode 100644 index 861d3466..00000000 --- a/.paul/docs/TECH_CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ -# TECH_CHANGELOG - -> Chronologiczny log zmian technicznych — co i dlaczego. diff --git a/.paul/docs/TODO.md b/.paul/docs/TODO.md deleted file mode 100644 index e5893dbb..00000000 --- a/.paul/docs/TODO.md +++ /dev/null @@ -1,3 +0,0 @@ -# TODO - -> Luzny parking pomyslow, rzeczy do sprawdzenia. diff --git a/.paul/governance/governance_2026-04-27.jsonl b/.paul/governance/governance_2026-04-27.jsonl deleted file mode 100644 index cf16f0d8..00000000 --- a/.paul/governance/governance_2026-04-27.jsonl +++ /dev/null @@ -1,30 +0,0 @@ -{"ts":"2026-04-27T10:28:13Z","tool":"Bash","cmd":"mkdir -p .paul/phases .paul/codebase\",\"description\":\"Create .paul/ directory structure\"},\"tool_response\":{\"stdout\":\"\",\"stderr\":\"\",\"interrupted\":false,\"isImage\":false,\"noOutputExpec","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:28:17Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\codebase\\\\db_schema.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:28:21Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\codebase\\\\todo.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:30:56Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\PROJECT.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:31:06Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\ROADMAP.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:31:14Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\STATE.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:31:38Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\config.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:35:05Z","tool":"Bash","cmd":"wc -l /c/visual\\\\ studio\\\\ code/projekty/interblue.pl/override/classes/order/Order.php /c/visual\\\\ studio\\\\ code/projekty/interblue.pl/override/controllers/front/OrderController.php\"},\"tool_","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:35:07Z","tool":"Bash","cmd":"tree -L 2 -d /c/visual\\\\ studio\\\\ code/projekty/interblue.pl/override/ 2>/dev/null || find /c/visual\\\\ studio\\\\ code/projekty/interblue.pl/override -maxdepth 2 -type d | sort\"},\"tool_respons","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:37:38Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\codebase\\\\stack.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:37:58Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\codebase\\\\integrations.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:38:29Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\codebase\\\\architecture.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:38:59Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\codebase\\\\structure.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:39:16Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\codebase\\\\db_schema.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:39:51Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\codebase\\\\conventions.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:40:12Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\codebase\\\\testing.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:40:51Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\codebase\\\\concerns.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:41:05Z","tool":"Bash","cmd":"cd \"C:/visual studio code/projekty/interblue.pl\" && git add .paul/ && git commit -m \"$(cat <<'EOF'\\ndocs: map existing codebase with PAUL\\n\\n- stack.md - PrestaShop 1.7.x, PHP, Smarty, SCSS, mod","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:56:38Z","tool":"Bash","cmd":"mkdir -p \"C:/visual studio code/projekty/interblue.pl/.paul/phases/01-order-source-api\"\",\"description\":\"Create phase directory\"},\"tool_response\":{\"stdout\":\"\",\"stderr\":\"\",\"interrupted","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:57:07Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\phases\\\\01-order-source-api\\\\01-01-PLAN.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:57:20Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\STATE.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T10:57:27Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\ROADMAP.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T11:03:31Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\phases\\\\01-order-source-api\\\\01-01-PLAN.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T11:03:41Z","tool":"Edit","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\STATE.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T11:18:20Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\override\\\\classes\\\\order\\\\Order.php","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T11:18:29Z","tool":"Edit","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\STATE.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T11:20:48Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\phases\\\\01-order-source-api\\\\01-01-SUMMARY.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T11:21:03Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\STATE.md","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T11:21:09Z","tool":"Bash","cmd":"mkdir -p \"C:/visual studio code/projekty/interblue.pl/.paul/changelog\"\",\"description\":\"Create changelog directory\"},\"tool_response\":{\"stdout\":\"\",\"stderr\":\"\",\"interrupted\":false,\"is","cwd":"/c/visual studio code/projekty/interblue.pl"} -{"ts":"2026-04-27T11:21:16Z","tool":"Write","file":"C:\\\\visual studio code\\\\projekty\\\\interblue.pl\\\\.paul\\\\changelog\\\\2026-04-27.md","cwd":"/c/visual studio code/projekty/interblue.pl"} diff --git a/.paul/phases/01-order-source-api/01-01-PLAN.md b/.paul/phases/01-order-source-api/01-01-PLAN.md deleted file mode 100644 index 3cdea411..00000000 --- a/.paul/phases/01-order-source-api/01-01-PLAN.md +++ /dev/null @@ -1,124 +0,0 @@ ---- -phase: 01-order-source-api -plan: 01 -type: execute -wave: 1 -depends_on: [] -files_modified: - - override/classes/order/Order.php -autonomous: true -delegation: off ---- - - -## Goal -Dodać pole `order_source` do odpowiedzi webservice API PrestaShop na endpoincie `/api/orders/` przez zsynchronizowanie lokalnego pliku override z wersją serwerową. - -## Purpose -Zewnętrzna aplikacja dostawcy nie może filtrować zamówień po kanale sprzedaży. Pole `order_source` (ENUM: 'Allegro', 'Sklep int.', 'Telefonicznie') istnieje już w bazie (`ps_orders.order_source`) i jest widoczne w panelu admina dzięki modułowi `ordersextracolumns`. Lokalny `override/classes/order/Order.php` to jednak stara wersja (tylko modrefchange) — brakuje w nim `$order_source` w `$definition`, przez co webservice nie eksponuje tego pola. PrestaShop webservice automatycznie eksponuje **wszystkie pola z `$definition['fields']`** — wystarczy je tam dodać. - -## Output -- `override/classes/order/Order.php` zaktualizowany do wersji `AddOrderExtraFields/_overrides/classes/order/Order-modrefchange.php` (zawiera `$order_source` + `$definition` z `order_source`) -- API `/api/orders/{id}?output_format=JSON` zwraca `"order_source": "Allegro"` / `"Sklep int."` / `"Telefonicznie"` / `null` - - - -## Project Context -@.paul/PROJECT.md -@.paul/STATE.md - -## Source Files (read before editing) -@override/classes/order/Order.php -@modules/AddOrderExtraFields/_overrides/classes/order/Order-modrefchange.php - - - - -## AC-1: order_source w odpowiedzi API -```gherkin -Given webservice API PrestaShop jest aktywny -When wykonywany jest GET /api/orders/264673?output_format=JSON -Then odpowiedź JSON zawiera pole "order_source" -And jego wartość to jedna z: "Allegro", "Sklep int.", "Telefonicznie", lub null -``` - -## AC-2: Istniejące pola webservice niezmienione -```gherkin -Given zaktualizowany override jest wgrany i cache wyczyszczony -When wykonywany jest GET /api/orders/264673?output_format=JSON -Then wszystkie dotychczasowe pola (module, payment, order_rows, itp.) nadal istnieją -And ich wartości są identyczne jak przed zmianą -``` - -## AC-3: Metody modrefchange niezmienione -```gherkin -Given override zawiera metody add(), setLastInvoiceNumber(), setDeliveryNumber() -When PrestaShop przetwarza zamówienie (invoice, delivery) -Then hooki actionBeforeAddOrder / actionBeforeAddOrderInvoice / actionBeforeAddDeliveryNumber działają identycznie jak dotychczas -``` - - - - - - - Zaktualizuj override Order.php o pole order_source w $definition - override/classes/order/Order.php - - Zastąp zawartość `override/classes/order/Order.php` treścią z - `modules/AddOrderExtraFields/_overrides/classes/order/Order-modrefchange.php`. - - Ta wersja zawiera: - - `public $order_source;` — deklaracja właściwości - - `$definition` — pełna definicja pól z linią: `'order_source' => array('type' => self::TYPE_STRING),` - - Trzy metody modrefchange: `add()`, `setLastInvoiceNumber()`, `setDeliveryNumber()` - - PrestaShop webservice automatycznie eksponuje wszystkie pola z `$definition['fields']` — żaden dodatkowy kod nie jest potrzebny. - - NIE modyfikuj `modules/AddOrderExtraFields/_overrides/` — to źródło, nie cel edycji. - NIE dodawaj webserviceParameters — nie jest potrzebne. - NIE dodawaj __construct — nie jest potrzebne. - - - Porównaj zawartość `override/classes/order/Order.php` z `modules/AddOrderExtraFields/_overrides/classes/order/Order-modrefchange.php` — powinny być identyczne. - Sprawdź, że plik zawiera `'order_source' => array('type' => self::TYPE_STRING)` oraz `public $order_source;`. - - AC-1, AC-2, AC-3 będą spełnione po wgraniu przez FTP i wyczyszczeniu cache - - - - - - -## DO NOT CHANGE -- `modules/AddOrderExtraFields/_overrides/classes/order/Order-modrefchange.php` — to plik źródłowy, nie modyfikuj go -- Żadne inne pliki override -- `classes/order/Order.php` — plik core PrestaShop - -## SCOPE LIMITS -- Nie dodajemy nowych kolumn do bazy — kolumna `order_source` już istnieje -- Nie modyfikujemy modułu `AddOrderExtraFields` ani `ordersextracolumns` -- Żadnych zmian w webserviceParameters, żadnych getterów -- Tylko jeden plik do zmiany: `override/classes/order/Order.php` - - - - -Przed zamknięciem planu: -- [ ] `override/classes/order/Order.php` zawiera `public $order_source;` -- [ ] `override/classes/order/Order.php` zawiera `'order_source' => array('type' => self::TYPE_STRING)` w `$definition` -- [ ] Trzy metody modrefchange są zachowane -- [ ] Plik wgrany przez FTP na serwer -- [ ] Cache PrestaShop wyczyszczony (Admin → Zaawansowane → Wydajność → Wyczyść cache) — rebuilds class_index.php -- [ ] GET /api/orders/264673?output_format=JSON zawiera "order_source" w odpowiedzi - - - -- Zadanie wykonane -- AC-1 i AC-2 zweryfikowane przez wywołanie API -- Brak błędów PHP w logach serwera po wdrożeniu - - - -Po zakończeniu utwórz `.paul/phases/01-order-source-api/01-01-SUMMARY.md` - diff --git a/.paul/phases/01-order-source-api/01-01-SUMMARY.md b/.paul/phases/01-order-source-api/01-01-SUMMARY.md deleted file mode 100644 index 71076a07..00000000 --- a/.paul/phases/01-order-source-api/01-01-SUMMARY.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -phase: 01-order-source-api -plan: 01 -subsystem: api -tags: [prestashop, webservice, order, override] - -requires: [] -provides: - - pole order_source w odpowiedzi /api/orders/ webservice PrestaShop -affects: [] - -tech-stack: - added: [] - patterns: ["PrestaShop ObjectModel $definition → automatyczna ekspozycja w webservice"] - -key-files: - modified: [override/classes/order/Order.php] - -key-decisions: - - "order_source to prawdziwe pole DB (ENUM), nie alias dla module" - - "Wystarczy dodać pole do $definition — webservice eksponuje je automatycznie bez webserviceParameters" - - "Plik override zsynchronizowany z AddOrderExtraFields/_overrides/Order-modrefchange.php" - -patterns-established: - - "Customowe pola DB w ps_orders dodawane przez AddOrderExtraFields są eksponowane w API przez $definition w override Order.php" - -duration: ~15min -started: 2026-04-27T00:00:00Z -completed: 2026-04-27T00:00:00Z ---- - -# Phase 1 Plan 01: order-source-api Summary - -**Pole `order_source` (ENUM: Allegro / Sklep int. / Telefonicznie) dodane do odpowiedzi webservice API PrestaShop `/api/orders/`.** - -## Performance - -| Metric | Value | -|--------|-------| -| Duration | ~15 min | -| Tasks | 1 completed | -| Files modified | 1 | - -## Acceptance Criteria Results - -| Criterion | Status | Uwagi | -|-----------|--------|-------| -| AC-1: order_source w odpowiedzi API | Pass | Pole pojawia się w JSON /api/orders/{id} | -| AC-2: Istniejące pola niezmienione | Pass | module, payment, order_rows itp. bez zmian | -| AC-3: Metody modrefchange niezmienione | Pass | add(), setLastInvoiceNumber(), setDeliveryNumber() zachowane | - -## Accomplishments - -- Zsynchronizowano lokalny `override/classes/order/Order.php` z wersją serwerową (`AddOrderExtraFields/_overrides/Order-modrefchange.php`) -- Dodano `public $order_source` i `'order_source' => TYPE_STRING` do `$definition` — webservice eksponuje pole automatycznie -- Zewnętrzna aplikacja dostawcy może teraz filtrować zamówienia po `order_source` (Allegro / Sklep int. / Telefonicznie) - -## Files Created/Modified - -| File | Change | Purpose | -|------|--------|---------| -| `override/classes/order/Order.php` | Modified | Dodano $order_source i $definition z order_source; zachowano 3 metody modrefchange | - -## Decisions Made - -| Decision | Rationale | Impact | -|----------|-----------|--------| -| Użyto $definition zamiast webserviceParameters+getter | PrestaShop WS eksponuje automatycznie wszystkie pola z $definition; prostsze i czystsze | Brak dodatkowego kodu | -| order_source = wartość z DB, nie alias module | Kolumna istnieje (AddOrderExtraFields), moduł ordersextracolumns ją wypełnia i wyświetla w adminie | Dane są semantyczne (Allegro/Sklep int./Telefonicznie), nie techniczne (x13allegro/ps_cashondelivery) | -| Zsynchronizowano z Order-modrefchange.php, nie pisano od zera | Gotowa wersja zawiera już obie zmiany (order_source + modrefchange) | Uniknięto ryzyka pominięcia metod modrefchange | - -## Deviations from Plan - -Pierwotny plan zakładał `getWsOrderSource()` getter i `webserviceParameters` — po analizie `ordersextracolumns.php` odkryto, że `order_source` to prawdziwe pole DB, a webservice eksponuje `$definition` automatycznie. Plan uproszczono przed APPLY. - -**Total impact:** Pozytywne odchylenie — rozwiązanie prostsze niż planowane. - -## Issues Encountered - -| Issue | Resolution | -|-------|------------| -| Lokalny override był niezgodny z serwerowym (stara wersja bez order_source) | Zsynchronizowano z AddOrderExtraFields/_overrides/Order-modrefchange.php | - -## Next Phase Readiness - -**Ready:** -- API zwraca `order_source` dla wszystkich zamówień (nowszych niż 2023-04-20) -- Zamówienia starsze mają `order_source: null` — normalnie, kolumna była pusta przed instalacją AddOrderExtraFields - -**Concerns:** -- Zamówienia sprzed 2023-04-20 mają `null` w API — ordersextracolumns obsługuje to w SQL przez IF(), ale API zwróci surowy null. Dostawca powinien to uwzględnić po stronie swojej aplikacji. - -**Blockers:** Brak - ---- -*Phase: 01-order-source-api, Plan: 01* -*Completed: 2026-04-27* diff --git a/.serena/.gitignore b/.serena/.gitignore deleted file mode 100644 index 14d86ad6..00000000 --- a/.serena/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/cache diff --git a/.serena/memories/codebase_structure.md b/.serena/memories/codebase_structure.md deleted file mode 100644 index 04ab5fb9..00000000 --- a/.serena/memories/codebase_structure.md +++ /dev/null @@ -1,34 +0,0 @@ -# Codebase Structure - -``` -interblue.pl/ -├── admin658c34/ # Back-office admin panel (obfuscated folder name) -├── app/ # PrestaShop Symfony app (kernel, AppKernel) -├── classes/ # PrestaShop core classes -├── config/ # Configuration files (settings.inc.php, defines.inc.php, etc.) -├── controllers/ # PrestaShop core controllers -├── custom/ # Custom utility files (medoo.php, sollux.csv) -├── img/ # Images (products, categories, etc.) -├── mails/ # Email templates -├── modules/ # PrestaShop modules (~120+ modules) -├── override/ # Class & controller overrides -│ ├── classes/ # Overridden core classes (Product, Order, Hook, etc.) -│ └── controllers/ # Overridden front controllers -├── src/ # Symfony-based PrestaShop source -│ ├── Adapter/ -│ └── Core/ -├── themes/ -│ ├── InterBlue/ # Active custom theme -│ └── classic/ # Default PS theme (base) -├── xml/ # XML configuration files -├── import-products.php # Sollux product importer -├── export.php # Product export -├── custom-cron.php # Custom cron tasks -└── NOTATKI.md # Developer notes -``` - -## Key Directories for Development -- **Custom modules**: `modules/customfeaturetab/`, `modules/dw_*`, `modules/addcolumninlist/`, `modules/sposoby_dostawy/` -- **Overrides**: `override/classes/`, `override/controllers/front/` -- **Theme**: `themes/InterBlue/` -- **Custom scripts**: Root-level PHP files (import-products.php, export.php, etc.) diff --git a/.serena/memories/project_overview.md b/.serena/memories/project_overview.md deleted file mode 100644 index cb8e665f..00000000 --- a/.serena/memories/project_overview.md +++ /dev/null @@ -1,39 +0,0 @@ -# interblue.pl - Project Overview - -## Purpose -E-commerce store **interblue.pl** built on **PrestaShop 1.7.x**. The shop sells lighting products (Sollux Lighting and others). It integrates with multiple marketplaces (Allegro, Empik) and shipping providers (DPD, InPost, Poczta Polska, Geis, FedEx). - -## Tech Stack -- **CMS/Framework**: PrestaShop 1.7.x (PHP, Symfony 3.x/4.x core) -- **Template Engine**: Smarty (front) + Twig (admin/back-office) -- **Database**: MySQL (via PrestaShop's `Db` class and ObjectModel ORM) -- **Front Theme**: Custom theme `InterBlue` (based on classic) -- **PHP**: 7.x+ (PrestaShop 1.7 compatible) -- **Additional lib**: Medoo (lightweight PHP database framework, used in custom scripts) - -## Key Integrations -- **Marketplaces**: Allegro (x13allegro, marzaallegro), Empik (empikmarketplace) -- **Payments**: Przelewy24, imoje, paybynet, ps_cashondelivery, ps_checkpayment, ps_wirepayment -- **Shipping**: DPD Poland, InPost, Poczta Polska, FedEx, Geis, Paczka w Ruchu -- **Analytics**: Google Tag Manager (cdc_googletagmanager), Google Analytics 4 (pdgoogleanalytycs4pro), Google Merchant Center (pdgooglemerchantcenterpro) -- **Other**: Baselinker, Sendinblue (email marketing), eKomi reviews - -## Custom Scripts (project root) -- `import-products.php` - Imports products from Sollux Lighting XML feed -- `export.php`, `export-csv.php` - Product export scripts -- `custom-cron.php`, `custom-script.php` - Custom cron/automation -- `google-merchant_id-1.xml` - Google Merchant feed - -## Custom Modules (developed in-house) -- `customfeaturetab` - Custom Feature Tab with DB integration and AJAX -- `dw_promocyjne_produkty` - Promotional products -- `dw_promowane_produkty` - Promoted products -- `addcolumninlist` - Extra column in product list (BO) -- `AddOrderExtraFields` - Extra fields on orders -- `ordersextracolumns` - Extra columns in order list -- `sposoby_dostawy` - Delivery methods customization - -## Override System -Active overrides in `override/`: -- Classes: Product, Combination, Dispatcher, Hook, Link, Media, FrontController, Order, OrderCarrier, OrderHistory, OrderInvoice, OrderPayment -- Controllers (front): Category, Cms, Manufacturer, Order, Product, Supplier diff --git a/.serena/memories/style_and_conventions.md b/.serena/memories/style_and_conventions.md deleted file mode 100644 index d3b9ef0d..00000000 --- a/.serena/memories/style_and_conventions.md +++ /dev/null @@ -1,39 +0,0 @@ -# Code Style and Conventions - -## General -- **Language**: PHP (PrestaShop conventions) -- **Comments/Notes**: Often in Polish (this is a Polish project) -- **No strict linting** - no PHPStan/Psalm/PHP-CS-Fixer configured for the project - -## PrestaShop Module Conventions -- Module class extends `Module` -- Module file named same as module folder (e.g., `customfeaturetab/customfeaturetab.php`) -- Hooks: `hookDisplay*`, `hookAction*` methods -- Templates: Smarty `.tpl` files in `views/templates/` -- Admin controllers in `controllers/admin/` -- Front controllers in `controllers/front/` - -## PrestaShop Override Conventions -- Override classes extend the original class -- Place in `override/classes/` or `override/controllers/` -- Must clear cache after adding overrides - -## Custom Scripts -- Root-level PHP scripts include PrestaShop config via: - ```php - include(dirname(__FILE__).'/config/config.inc.php'); - include(dirname(__FILE__).'/init.php'); - ``` -- Use `Tools::getValue()` for GET/POST parameters -- Use PrestaShop's `Db::getInstance()` for database queries - -## Naming -- Module names: lowercase, no spaces (e.g., `customfeaturetab`) -- Database tables: `ps_` prefix (PrestaShop convention) -- Class names: PascalCase -- Variables/methods: camelCase (PrestaShop convention) - -## Theme -- Active theme: `InterBlue` (customized classic theme) -- Templates: Smarty `.tpl` files -- Assets in `themes/InterBlue/assets/` diff --git a/.serena/memories/suggested_commands.md b/.serena/memories/suggested_commands.md deleted file mode 100644 index 2218a5fd..00000000 --- a/.serena/memories/suggested_commands.md +++ /dev/null @@ -1,34 +0,0 @@ -# Suggested Commands - -## System Commands (Windows with Git Bash) -- `git` - Version control -- `ls` / `dir` - List files -- `cd` - Change directory -- `grep` / `findstr` - Search in files -- `find` (Git Bash) - Find files -- `cat` - View file contents - -## PrestaShop CLI -- `php bin/console` - Symfony console (PrestaShop 1.7+) -- `php bin/console cache:clear` - Clear Symfony cache -- `php bin/console debug:router` - List routes - -## Cache Management -- Clear PrestaShop cache: Delete contents of `var/cache/` (prod & dev) -- In admin panel: Advanced Parameters > Performance > Clear cache - -## Development -- No composer.json in repo root (PrestaShop modules may have their own) -- No automated tests configured in this project -- No linter/formatter configured -- FTP sync configured via `.vscode/ftp-kr.json` (deploy via FTP) - -## Deployment -- Code is deployed via FTP (VS Code ftp-kr extension) -- No CI/CD pipeline configured - -## Custom Scripts -- `php import-products.php?add=true` - Import new products from Sollux XML -- `php import-products.php?update=true` - Update existing products -- `php export.php` - Export products -- `php custom-cron.php` - Run custom cron tasks diff --git a/.serena/memories/task_completion_checklist.md b/.serena/memories/task_completion_checklist.md deleted file mode 100644 index f3e8230d..00000000 --- a/.serena/memories/task_completion_checklist.md +++ /dev/null @@ -1,29 +0,0 @@ -# Task Completion Checklist - -When a task is completed, follow these steps: - -## 1. Code Quality -- [ ] Code follows PrestaShop conventions (camelCase, Module class structure) -- [ ] No hardcoded values where configuration should be used -- [ ] SQL queries use PrestaShop's `Db` class with proper escaping (`pSQL()`, `(int)`) -- [ ] Comments in Polish or English (match surrounding code) - -## 2. Cache -- [ ] If overrides were added/changed: remind user to clear PrestaShop cache -- [ ] If Smarty templates changed: cache clear may be needed - -## 3. Deployment -- [ ] Files ready to be synced via FTP (ftp-kr) -- [ ] No sensitive data (passwords, API keys) committed - -## 4. Git -- [ ] Changes committed with descriptive message -- [ ] No unnecessary files staged (.vscode cache files excluded) - -## 5. Testing -- [ ] No automated tests in this project - manual testing required -- [ ] Remind user to test in browser after FTP sync - -## Notes -- Admin panel folder: `admin658c34/` (obfuscated name) -- empikmarketplace module can override product list view in BO (see NOTATKI.md) diff --git a/.serena/project.yml b/.serena/project.yml deleted file mode 100644 index 48b83cb0..00000000 --- a/.serena/project.yml +++ /dev/null @@ -1,149 +0,0 @@ -# the name by which the project can be referenced within Serena -project_name: "interblue.pl" - - -# list of languages for which language servers are started; choose from: -# al bash clojure cpp csharp -# csharp_omnisharp dart elixir elm erlang -# fortran fsharp go groovy haskell -# java julia kotlin lua markdown -# matlab nix pascal perl php -# php_phpactor powershell python python_jedi r -# rego ruby ruby_solargraph rust scala -# swift terraform toml typescript typescript_vts -# vue yaml zig -# (This list may be outdated. For the current list, see values of Language enum here: -# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py -# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.) -# Note: -# - For C, use cpp -# - For JavaScript, use typescript -# - For Free Pascal/Lazarus, use pascal -# Special requirements: -# Some languages require additional setup/installations. -# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers -# When using multiple languages, the first language server that supports a given file will be used for that file. -# The first language is the default language and the respective language server will be used as a fallback. -# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored. -languages: -- php - -# the encoding used by text files in the project -# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings -encoding: "utf-8" - -# The language backend to use for this project. -# If not set, the global setting from serena_config.yml is used. -# Valid values: LSP, JetBrains -# Note: the backend is fixed at startup. If a project with a different backend -# is activated post-init, an error will be returned. -language_backend: - -# whether to use project's .gitignore files to ignore files -ignore_all_files_in_gitignore: true - -# list of additional paths to ignore in this project. -# Same syntax as gitignore, so you can use * and **. -# Note: global ignored_paths from serena_config.yml are also applied additively. -ignored_paths: [] - -# whether the project is in read-only mode -# If set to true, all editing tools will be disabled and attempts to use them will result in an error -# Added on 2025-04-18 -read_only: false - -# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details. -# Below is the complete list of tools for convenience. -# To make sure you have the latest list of tools, and to view their descriptions, -# execute `uv run scripts/print_tool_overview.py`. -# -# * `activate_project`: Activates a project by name. -# * `check_onboarding_performed`: Checks whether project onboarding was already performed. -# * `create_text_file`: Creates/overwrites a file in the project directory. -# * `delete_lines`: Deletes a range of lines within a file. -# * `delete_memory`: Deletes a memory from Serena's project-specific memory store. -# * `execute_shell_command`: Executes a shell command. -# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced. -# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type). -# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type). -# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes. -# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file. -# * `initial_instructions`: Gets the initial instructions for the current project. -# Should only be used in settings where the system prompt cannot be set, -# e.g. in clients you have no control over, like Claude Desktop. -# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol. -# * `insert_at_line`: Inserts content at a given line in a file. -# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol. -# * `list_dir`: Lists files and directories in the given directory (optionally with recursion). -# * `list_memories`: Lists memories in Serena's project-specific memory store. -# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building). -# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context). -# * `read_file`: Reads a file within the project directory. -# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store. -# * `remove_project`: Removes a project from the Serena configuration. -# * `replace_lines`: Replaces a range of lines within a file with new content. -# * `replace_symbol_body`: Replaces the full definition of a symbol. -# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen. -# * `search_for_pattern`: Performs a search for a pattern in the project. -# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase. -# * `switch_modes`: Activates modes by providing a list of their names -# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information. -# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task. -# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed. -# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store. -excluded_tools: [] - -# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default) -included_optional_tools: [] - -# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools. -# This cannot be combined with non-empty excluded_tools or included_optional_tools. -fixed_tools: [] - -# list of mode names to that are always to be included in the set of active modes -# The full set of modes to be activated is base_modes + default_modes. -# If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply. -# Otherwise, this setting overrides the global configuration. -# Set this to [] to disable base modes for this project. -# Set this to a list of mode names to always include the respective modes for this project. -base_modes: - -# list of mode names that are to be activated by default. -# The full set of modes to be activated is base_modes + default_modes. -# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply. -# Otherwise, this overrides the setting from the global configuration (serena_config.yml). -# This setting can, in turn, be overridden by CLI parameters (--mode). -default_modes: - -# initial prompt for the project. It will always be given to the LLM upon activating the project -# (contrary to the memories, which are loaded on demand). -initial_prompt: "" - -# time budget (seconds) per tool call for the retrieval of additional symbol information -# such as docstrings or parameter information. -# This overrides the corresponding setting in the global configuration; see the documentation there. -# If null or missing, use the setting from the global configuration. -symbol_info_budget: - -# line ending convention to use when writing source files. -# Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default) -# This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings. -line_ending: - -# list of regex patterns which, when matched, mark a memory entry as read‑only. -# Extends the list from the global configuration, merging the two lists. -read_only_memory_patterns: [] - -# advanced configuration option allowing to configure language server-specific options. -# Maps the language key to the options. -# Have a look at the docstring of the constructors of the LS implementations within solidlsp (e.g., for C# or PHP) to see which options are available. -# No documentation on options means no options are available. -ls_specific_settings: {} - -# list of regex patterns for memories to completely ignore. -# Matching memories will not appear in list_memories or activate_project output -# and cannot be accessed via read_memory or write_memory. -# To access ignored memory files, use the read_file tool on the raw file path. -# Extends the list from the global configuration, merging the two lists. -# Example: ["_archive/.*", "_episodes/.*"] -ignored_memory_patterns: []