Closed cconard96 closed 2 years ago
@kabassanov Does this align with what you expected too?
@cconard96 Yes, it does.
Unless I am wrong, after reading again the code, the logic should be: if user has right to regenerate the inventory number, do nothing, else, revert the otherserial to previous value.
So, basically, removal of the !
as mentionned in first issue comment seems to be the correct fix.
Hi Cedric-Anne,
That was my first impression, but it still allows user with plugin UPDATE right to put any value in the field and not only to automatically regenerate inventory number.
Without the check, if the number is managed for that itemtype, nobody can manually change it except through massive action which is what the documentation specifies.
Where did you find this documentation ?
fixes #42
12 years ago, GLPI stopped receiving a return value form pre_item hooks and instead modified the input/fields directly. 6 years ago, the preItemUpdate function removed the return values and previously it was returning
['noright']
if the user did NOT have the plugin's UPDATE right. This cancelled the update (before the change 12 years ago).I'm not sure the right check make sense. The plugin documentation says that you cannot modify the inventory number for itemtypes managed by this plugin. However, the right check as it was would let everyone without the UPDATE right for the plugin (regenerate) change it. The opposite check makes a bit more sense but doesn't align with the documentation.
Without the check, if the number is managed for that itemtype, nobody can manually change it except through massive action which is what the documentation specifies. It also only cares if the inventory number is changed and not any of the other fields.