Repository navigation
[Feature]: Case-sensitive attribute updates and CSV Import attribute deletion capability - #4384
Conversation
|
@odiea do you want to give it a spin and see if you can find any problems? |
|
closing #3076 |
There was a problem hiding this comment.
Pull request overview
This PR adds support for case-sensitive attribute updates in CSV imports and item forms, along with PSR compliance refactoring and a bug fix for the category dropdown feature. The core feature leverages MySQL's case-insensitive collation (utf8_general_ci) to detect existing attribute values, then compares them case-sensitively in PHP to update capitalization when needed.
Changes:
- Added case-sensitive attribute value updates for both CSV imports and item forms by comparing stored values with new values and updating when only case differs
- Refactored multiple methods from snake_case to camelCase naming (saveDefinition, getAttributeValue, saveAttributeValue, saveAttributeData, storeAttributeValue) for PSR compliance
- Fixed category dropdown enable/disable logic by changing comparison from
== 1to truthy check - Added new helper function
getAttributeDataType()to map attribute types to database column names - Added new method
getAttributeValueByAttributeId()to retrieve attribute values by ID
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| app/Models/Attribute.php | Refactored method names to camelCase, added getAttributeValueByAttributeId(), updated saveAttributeValue() with case-sensitive comparison logic, fixed PHPDoc formatting, updated saveAttributeLink() with null handling |
| app/Helpers/attribute_helper.php | New helper file with getAttributeDataType() function to map attribute types to database columns |
| app/Controllers/Items.php | Updated method calls to use new camelCase names, refactored CSV import methods, updated storeAttributeValue() with case-sensitive logic, improved fall-through comment syntax |
| app/Controllers/Config.php | Fixed category dropdown enable logic from == 1 to truthy check, updated method call to saveDefinition() |
| app/Controllers/Attributes.php | Updated method call to saveDefinition() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What am I looking for and it appears not to save a Date now just 0's if even that? I have not tried importing just adding or updating a Date in Items. Date is working correctly now. TesT to Test is working properly now. |
Yeah, I'm pushing a fix for it. |
|
@odiea in the past if you added a TEXT or DROPDOWN attribute then in an item filled in a value with one capitalization (e.g., |
|
I have a bug I'm working through before this PR can be merged. An exception is being thrown when adding some attributes. in the meantime I've converted it to a draft PR |
|
OK @odiea that date issue and a few others should be resolved now. |
@coderabbitai correct, but these changes are outside the scope of this PR. Create a new Github issue to make these changes as they will not be made in this PR which is already getting too large. |
This comment was marked as resolved.
This comment was marked as resolved.
Signed-off-by: objec <[email protected]>
Signed-off-by: objec <[email protected]>
- Also refactored abbreviated variable name for clarity Signed-off-by: objec <[email protected]>
Signed-off-by: objec <[email protected]>
…ive-attribute-updates
Signed-off-by: objec <[email protected]>
|
@jekkos I think this is ready and I've resolved the relevant issues that coderabbitai brought up. Can you review and approve this if you don't see any issues? |
|
@jekkos should I wait for your review here or just merge. I'd like to get this merged so that I can move on to the plugins PR completely. |
|
I will have a look in one hour if that is fine |
Yeah that's fine. Thanks. |
|
Looks mostly fine, maybe one question, we will only apply this logic then for newly imported data? So I guess it does not include a migration that cleans up existing data? |
For the capitalization sensitivity I'm not sure how you would migrate existing data since in some cases you want all caps. For Is there other new functionality I'm not thinking of that we could write a migration for to mass repair? |
Signed-off-by: objec <[email protected]>
This PR adds the following:
_DELETE_in a attribute on a row in an items CSV import file will cause the attribute_link to be deleted for that item. It does not affect attribute_link rows where sale_id or receiving_id is not null.Former behavior:
Summary by CodeRabbit
New Features
Bug Fixes
Tests