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

Printer model dictionnary rule execution fails - SQL error #18987

Open
2 tasks done
SebSept opened this issue Feb 14, 2025 · 0 comments
Open
2 tasks done

Printer model dictionnary rule execution fails - SQL error #18987

SebSept opened this issue Feb 14, 2025 · 0 comments
Labels

Comments

@SebSept
Copy link
Contributor

SebSept commented Feb 14, 2025

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

10.0.18 & main branch

Bug description

Replay the dictionnary rules fails with an sql error.

SQL Error "1062": Duplicate entry '3' for key 'PRIMARY' in query "INSERT INTOglpi_printermodels (name, comment, id, date_creation, date_mod) VALUES ('modified name', '', '3', '2025-02-14 15:23:17', '2025-02-14 15:23:17')"

Relevant log output

Page URL

./front/ruledictionnaryprintermodel.php?replay_rule=replay_rule

Steps To reproduce

  1. Create a printer, assign a model 'MyModel'
  2. On dictionary page, Create a Printer model rule
  • criteria 'Model' / is / "MyModel"
  • action 'Model' / assign / 'Fixed Model'
  1. On Dictionaries / Printer model page : clic the "Replay the dictionary rule"

Error displayed :
SQL Error "1062": Duplicate entry '4' for key 'PRIMARY' in query "INSERT INTO glpi_printermodels (name, comment, id, date_creation, date_mod) VALUES ('fixedModel', '', '4', '2025-02-14 15:53:50', '2025-02-14 15:53:50')"

Then

  • the printer is not associated with any model printermodels_id is 0.
  • the model is removed from glpi_printermodels database

Your GLPI setup information

Fresh install, reproduced with glpi 10.0.18 and glpi main branch.

Anything else?

glpi 11 stacktrace

MySQL query error: Duplicate entry '1' for key 'PRIMARY' (1062) in SQL query "INSERT INTO `glpi_printermodels` (`name`, `comment`, `id`, `date_creation`, `date_mod`) VALUES ('mod : great', '', '1', '2025-02-14 13:54:02', '2025-02-14 13:54:02')".
In ./src/DBmysql.php(369)
#0 ./src/DBmysql.php(1311): DBmysql->doQuery('INSERT INTO `gl...')
#1 ./src/CommonDBTM.php(770): DBmysql->insert('glpi_printermod...', Array)
#2 ./src/CommonDBTM.php(1401): CommonDBTM->addToDB()
#3 ./src/CommonDropdown.php(752): CommonDBTM->add(Array)
#4 ./src/CommonDropdown.php(820): CommonDropdown->import(Array)
#5 ./src/Dropdown.php(2707): CommonDropdown->importExternal('mymodel is grea...', -1, Array, '', true)
#6 ./src/RuleDictionnaryDropdownCollection.php(209): Dropdown::importExternal('PrinterModel', 'mymodel is grea...', -1, Array, '')
#7 ./src/RuleDictionnaryDropdownCollection.php(57): RuleDictionnaryDropdownCollection->replayRulesOnExistingDBForModel(0, 1739542742.0)
@SebSept SebSept added the bug label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant