Files
opensourcepos/app/Language/vi/Attributes.php
T
objecttothisandOllama 1b8ee2e3c1 feat(items): optimize search, attribute filtering, and sort for items view (#4652)
feat(items): optimize search, attribute filtering, and sort for items view (#4652)

BREAKING CHANGE: none

## Search & Query Optimization
- Split item search into two-phase query: Phase A resolves qualifying IDs,
  Phase B joins scoped display tables for better performance and readability
- Sanitize `definition_ids` via `array_map` to prevent injection vulnerabilities
- Introduce subquery for SUM aggregation to prevent over-counting across joins
- Add validation requiring both start and end dates before applying date range filter

## Attribute Search (fixes #2919, #2722)
- Add `SHOW_IN_SEARCH` flag (value 8) to Attribute model to separate
  searchability from table visibility
- Add `parse_attribute_search()` to parse syntax like `color:blue AND size:large`
- Add `applyNamedAttributeSearch()` supporting decimal and date types with
  locale-aware parsing
- Support AND/OR logic for multi-attribute queries

## Sorting
- Add `get_attribute_sort_definition_id()` to detect attribute column sorting
- Join attribute tables dynamically when sorting by attribute columns
- Use `MAX()` for consistent results when sorting by attribute values
- Replace static sort column list with dynamic headers via `itemSortColumns()`
- Add `sanitizeSortColumnAttribute()` to validate attribute definition IDs as sort columns

## Tax & Data Row
- Streamline tax computation in `getItemDataRow()`

## Low Inventory Filter
- Require valid `stock_location_id` before applying low inventory filter
- Add conditional logic to sort by sum of quantities across all locations
  when `stock_location_id` is invalid

## Localization
- Add `show_in_search` / `show_in_search_visibility` strings to all language files
- Translated: de-DE, es-ES, fr, it; English placeholder for remaining locales
- Unify single-quote style across all attribute language files

## Refactoring & Style
- Adopt camelCase naming throughout (variables, helpers, methods)
- Replace `sanitizeSortColumnAttribute` with reusable `sanitizeSortColumn`
  from `Secure_Controller`
- Simplify column key extraction using `array_key_first`
- Apply PSR-12 formatting

## Tests
- Add tests for tax computation, quantity aggregation (single- and multi-location),
  named attribute search, free-text parsing, and date/decimal type handling
- Add `ensureStockLocation` helper to auto-create missing stock locations in tests
- Refactor tests to handle config cache issues

Co-authored-by: Ollama <ollama@steganos.dev>
2026-10-02 14:56:20 +04:00

37 lines
2.5 KiB
PHP

<?php
return [
'attribute_value_invalid_chars' => 'Giá trị thuộc tính không thể chứa \':\' hay \'|\'',
'confirm_delete' => 'Bạn có chắc chắn muốn xóa (các) thuộc tính đã chọn không?',
'confirm_restore' => 'Bạn có chắc chắn muốn khôi phục (các) thuộc tính đã chọn không?',
'definition_cannot_be_deleted' => 'Không thể xóa (các) thuộc tính được chọn',
'definition_invalid_group' => 'Nhóm đã chọn không tồn tại hoặc không hợp lệ.',
'definition_error_adding_updating' => 'Thuộc tính {0} không thể thêm hoặc cập nhật. Vui lòng kiểm tra nhật ký lỗi.',
'definition_flags' => 'Hiển thị thuộc tính',
'definition_group' => 'Nhóm',
'definition_id' => 'Mã số',
'definition_name' => 'Thêm thuộc tính',
'definition_name_required' => 'Tên thuộc tính là trường bắt buộc',
'definition_one_or_multiple' => 'thuộc tính',
'definition_successful_adding' => 'Bạn vừa mới thêm mục tin thành công',
'definition_successful_deleted' => 'Bạn đã xóa thành công',
'definition_successful_updating' => 'Bạn đã cập nhật thành công thuộc tính',
'definition_type' => 'Loại thuộc tính',
'definition_type_required' => 'Loại thuộc tính là trường bắt buộc',
'definition_unit' => 'Đơn vị đo lường',
'definition_values' => 'Giá trị thuộc tính',
'new' => 'Thêm thuộc tính mới',
'no_attributes_to_display' => 'Không có mặt hàng nào để hiển thị',
'receipt_visibility' => 'Biên lai',
'show_in_items' => 'Hiển thị trong các mặt hàng',
'show_in_items_visibility' => 'Hàng hóa',
'show_in_receipt' => 'Hiển thị trong biên lai',
'show_in_receivings' => 'Hiển thị trong nhập hàng',
'show_in_receivings_visibility' => 'Nhập hàng',
'show_in_sales' => 'Hiển thị trong bán hàng',
'show_in_sales_visibility' => 'Bán hàng',
'show_in_search' => 'Hiển thị trong tìm kiếm',
'show_in_search_visibility' => 'Tìm kiếm',
'update' => 'Cập nhật thuộc tính',
];