Skip to content
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 for issue #371 #445

Merged
merged 5 commits into from
Dec 10, 2024
Merged

Fix for issue #371 #445

merged 5 commits into from
Dec 10, 2024

Conversation

PlaneNuts
Copy link
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

  • It fixes Error: SQL Warnings: 1292 #371
  • Here is a brief description of what this PR does: When loading the form to add a new injection model the DB is queried multiple times by the checkRightOnModel() function with "" as the $models_id (since no model is being selected). This throws multiple errors of
SQL Warnings: 1292: Truncated incorrect DECIMAL value: '' in query "(SELECT `itemtype` FROM `glpi_plugin_datainjection_models` WHERE `id` = '') UNION (SELECT DISTINCT `itemtype` FROM `glpi_plugin_datainjection_mappings` WHERE `models_id` = '') UNION (SELECT DISTINCT `itemtype` FROM `glpi_plugin_datainjection_infos` WHERE `models_id` = '')"

This change sets it to -1 when null in order to feed a valid value into the query.

I've confirmed that existing models still load without issue, and the error for a new model no longer appears.

Screenshots (if appropriate):

inc/model.class.php Outdated Show resolved Hide resolved
@Rom1-B Rom1-B requested review from stonebuzz and Rom1-B December 9, 2024 10:52
@stonebuzz
Copy link
Contributor

Hi @PlaneNuts

can you adapt CHANGELOG.md ?

Best regards

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Stanislas <[email protected]>
@stonebuzz stonebuzz self-requested a review December 10, 2024 13:23
@Rom1-B Rom1-B merged commit abe9757 into pluginsGLPI:main Dec 10, 2024
3 checks passed
@stonebuzz stonebuzz mentioned this pull request Dec 11, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: SQL Warnings: 1292
3 participants