-
Notifications
You must be signed in to change notification settings - Fork 55
Fix common db relation insertion #439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix common db relation insertion #439
Conversation
b8d0174 to
9c5735f
Compare
Rom1-B
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks OK, can you get the customer to validate it?
| // Ex : User -> groups_id -> Group_User | ||
| // groups_id should not be injected in User (field contains group name (string)) | ||
| if ($option !== false && isset($option['displaytype']) && $option['displaytype'] == 'relation') { | ||
| if ($option !== false && isset($option['displaytype']) && $option['displaytype'] == 'relation' && !($item instanceof CommonDBRelation)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the fix, with this example (inject groups_id from User object)
User -> groups_id (from Group_User)
The condition will return false (to delegate to specific case) -> OK
But with this
User -> name
The condition will return false -> KO
Because User is not an instance of CommonDBRelation
| if ($option !== false && isset($option['displaytype']) && $option['displaytype'] == 'relation' && !($item instanceof CommonDBRelation)) { | |
| if (($option !== false && isset($option['displaytype']) && $option['displaytype'] == 'relation') || !($item instanceof CommonDBRelation)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the || operator, the plugin doesn't insert any data, whereas with &&, all data is actually inserted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I tested with a user like you said but everything works perfectly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
It looks OK, can you get the customer to validate it? |
|
Reminder (adapt CHANGELOG.md) |
9153c87 to
8acb323
Compare
Co-authored-by: Stanislas <skita@teclib.com>
|
can you rebase (customer is OK with this change?) |
I'm waiting for their reply |
|
That's good |
Checklist before requesting a review
Please delete options that are not relevant.
Description
Fixed an error when inserting data linked to a relationship table (for example, the supplier identifier was removed from the list because the type was relationship).
Screenshots (if appropriate):