feat: custom labels toggle and inline editing in product list

Adds session-based show/hide toggle for custom labels in admin product list, inline editable fields for custom_label_0..4, and label suggestions with custom entry support. Includes repository/controller updates, UI fixes, tests, and PAUL docs release updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jacek
2026-04-19 11:09:19 +02:00
parent 41e491c6b7
commit 9577d4944a
15 changed files with 856 additions and 42 deletions

View File

@@ -1,3 +1,12 @@
# TECH_CHANGELOG
> Chronologiczny log zmian technicznych — co i dlaczego.
## v0.348 (2026-04-19)
- Dodano przełącznik widoczności etykiet niestandardowych na liście produktów w panelu admina, z zapisem stanu w sesji.
- Po włączeniu opcji renderowane jest 5 pól custom_label_0..4 bezpośrednio pod sekcją zdjęcie/nazwa produktu.
- Dodano zapisywanie wartości etykiet niestandardowych do bazy oraz walidację dozwolonych typów etykiet po stronie kontrolera.
- Wprowadzono podpowiedzi istniejących wartości jako wybieralne sugestie z możliwością wpisania własnej wartości.
- Rozszerzono testy jednostkowe dla ShopProductController i ProductRepository pod nową funkcjonalność.

View File

@@ -3608,3 +3608,81 @@ Dodać możliwość ustawienia limitu znaków w wiadomościach do produktu
- [ ] [MINOR] templates/wiki/main-view.php:77 — Replace "and" with "&&". (php:S2010)
- [ ] [MINOR] templates/wiki/main-view.php:85 — Anchors must have content and the content must be accessible by a screen reader. (Web:S6827)
## SonarQube - 0.348 (2026-04-19)
### Code Smells
- [ ] [CRITICAL] autoload/admin/Controllers/ShopProductController.php:109 - Define a constant instead of duplicating this literal "" value="" 4 times. (php:S1192)
- [ ] [CRITICAL] autoload/admin/Controllers/ShopProductController.php:39 - Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/admin/Controllers/ShopProductController.php:713 - Define a constant instead of duplicating this literal " selected" 3 times. (php:S1192)
- [ ] [CRITICAL] autoload/admin/Controllers/ShopProductController.php:788 - Define a constant instead of duplicating this literal "Produkt zostaÃ…Â zapisany." 3 times. (php:S1192)
- [ ] [CRITICAL] autoload/admin/Controllers/ShopProductController.php:809 - Define a constant instead of duplicating this literal "Location: /admin/shop_product/view_list/" 3 times. (php:S1192)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:2303 - Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:2329 - Add curly braces around the nested statement(s). (php:S121)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:2384 - Define a constant instead of duplicating this literal "in stock" 6 times. (php:S1192)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:2387 - Define a constant instead of duplicating this literal "out of stock" 3 times. (php:S1192)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:2417 - Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:2899 - Refactor this function to reduce its Cognitive Complexity from 38 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3061 - Refactor this function to reduce its Cognitive Complexity from 62 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3158 - Add curly braces around the nested statement(s). (php:S121)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3159 - Add curly braces around the nested statement(s). (php:S121)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3160 - Add curly braces around the nested statement(s). (php:S121)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3161 - Add curly braces around the nested statement(s). (php:S121)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3178 - Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3246 - Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3369 - Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3425 - Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3439 - Add curly braces around the nested statement(s). (php:S121)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3510 - Add curly braces around the nested statement(s). (php:S121)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3521 - Refactor this function to reduce its Cognitive Complexity from 37 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3556 - Refactor this function to reduce its Cognitive Complexity from 75 to the 15 allowed. (php:S3776)
- [ ] [CRITICAL] autoload/Domain/Product/ProductRepository.php:3604 - Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed. (php:S3776)
- [ ] [MAJOR] autoload/admin/Controllers/ShopProductController.php:272 - This function "buildProductFormViewModel" has 281 lines, which is greater than the 150 lines authorized. Split it into smaller functions. (php:S138)
- [ ] [MAJOR] autoload/admin/Controllers/ShopProductController.php:272 - This function has 9 parameters, which is greater than the 7 authorized. (php:S107)
- [ ] [MAJOR] autoload/admin/Controllers/ShopProductController.php:39 - This function "view_list" has 151 lines, which is greater than the 150 lines authorized. Split it into smaller functions. (php:S138)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:2641 - This method has 4 returns, which is more than the 3 allowed. (php:S1142)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:2663 - This method has 4 returns, which is more than the 3 allowed. (php:S1142)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:2858 - Remove the unused function parameter "$limit". (php:S1172)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:2899 - This method has 4 returns, which is more than the 3 allowed. (php:S1142)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:3029 - This method has 4 returns, which is more than the 3 allowed. (php:S1142)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:3061 - This method has 4 returns, which is more than the 3 allowed. (php:S1142)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:3435 - Extract this nested ternary operation into an independent statement. (php:S3358)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:3544 - Extract this nested ternary operation into an independent statement. (php:S3358)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:3564 - Extract this nested ternary operation into an independent statement. (php:S3358)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:3591 - Extract this nested ternary operation into an independent statement. (php:S3358)
- [ ] [MAJOR] autoload/Domain/Product/ProductRepository.php:3592 - Extract this nested ternary operation into an independent statement. (php:S3358)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1004 - Rename function "generate_combination" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1025 - Rename function "delete_combination" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1040 - Rename function "product_combination_stock_0_buy_save" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1050 - Rename function "product_combination_sku_save" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1060 - Rename function "product_combination_quantity_save" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1070 - Rename function "product_combination_price_save" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1080 - Rename function "delete_combination_ajax" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1097 - Rename function "image_delete" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1112 - Rename function "images_order_save" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1124 - Rename function "image_alt_change" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1139 - Rename function "product_file_delete" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1154 - Rename function "product_file_name_change" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1169 - Rename function "product_image_delete" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1186 - Rename function "mass_edit" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1200 - Rename function "mass_edit_save" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1205 - Use empty() to check whether the array is empty or not. (php:S1155)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:1226 - Rename function "get_products_by_category" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:215 - Rename function "product_custom_labels_toggle" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:228 - Rename function "product_edit" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:39 - Rename function "view_list" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:801 - Rename function "duplicate_product" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:816 - Rename function "product_archive" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:831 - Rename function "product_unarchive" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:846 - Rename function "product_delete" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:861 - Rename function "change_product_status" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:874 - Rename function "product_change_price_brutto" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:889 - Rename function "product_change_price_brutto_promo" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:904 - Rename function "product_change_custom_label" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:919 - Rename function "product_custom_label_suggestions" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:941 - Rename function "product_custom_label_save" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:962 - Rename function "ajax_product_url" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:971 - Rename function "generate_sku_code" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)
- [ ] [MINOR] autoload/admin/Controllers/ShopProductController.php:989 - Rename function "product_combination" to match the regular expression ^[a-z][a-zA-Z0-9]*$. (php:S100)