mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-10-03 08:05:13 -04:00
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>
37 lines
2.5 KiB
PHP
37 lines
2.5 KiB
PHP
<?php
|
|
|
|
return [
|
|
'attribute_value_invalid_chars' => 'ערך השדה אינו יכול להכיל \':\' או \'|\'',
|
|
'confirm_delete' => 'האם אתה בטוח שברצונך למחוק את המאפיינים שנבחרו?',
|
|
'confirm_restore' => 'האם אתה בטוח שברצונך לשחזר את המאפיינים שנבחרו?',
|
|
'definition_cannot_be_deleted' => 'לא ניתן למחוק מאפיינים נבחר(ים)',
|
|
'definition_invalid_group' => 'הקבוצה שנבחרה לא קיימת או אינה תקינה.',
|
|
'definition_error_adding_updating' => 'לא ניתן להוסיף או לעדכן את הערך {0}. בדוק את יומן השגיאות.',
|
|
'definition_flags' => 'מאפיין גלוי',
|
|
'definition_group' => 'קבוצה',
|
|
'definition_id' => 'מספר זיהוי',
|
|
'definition_name' => 'הוסף מאפיין',
|
|
'definition_name_required' => 'מאפיין שם הינו שדה חובה',
|
|
'definition_one_or_multiple' => 'תכונה (תכונות)',
|
|
'definition_successful_adding' => 'הוספת בהצלחה את הפריט',
|
|
'definition_successful_deleted' => 'נמחק בהצלחה',
|
|
'definition_successful_updating' => 'עדכנת בהצלחה את המאפיין',
|
|
'definition_type' => 'סוג מאפיין',
|
|
'definition_type_required' => 'שדה המאפיין הינו שדה חובה',
|
|
'definition_unit' => 'יחידת מדידה',
|
|
'definition_values' => 'ערכי המאפיין',
|
|
'new' => 'מאפיין חדש',
|
|
'no_attributes_to_display' => 'אין פריטים להצגה',
|
|
'receipt_visibility' => 'קבלה',
|
|
'show_in_items' => 'הצג בפריטים',
|
|
'show_in_items_visibility' => 'פריטים',
|
|
'show_in_receipt' => 'הצג בקבלה',
|
|
'show_in_receivings' => 'הצג בקבלת סחורה',
|
|
'show_in_receivings_visibility' => 'קבלת סחורה',
|
|
'show_in_sales' => 'הצג במכירות',
|
|
'show_in_sales_visibility' => 'מכירות',
|
|
'show_in_search' => 'הצג בחיפוש',
|
|
'show_in_search_visibility' => 'חיפוש',
|
|
'update' => 'עדכן מאפיין',
|
|
];
|