Fix rule clone losing criteria and actions - #25073
Conversation
If this is this underlying issue, couldn't this come up in other places besides |
searched and found that it could come up in TO fix it I extracted the name resolving logic out of |
|
I don't think it is easy to assume we know every path the code may take for every user input to replicate the underlying issue (AJAX endpoints, legacy front files, controllers, legacy API, new API, plugins, etc). |
True, but I think this fix is necessary here anyway (especially in |
Checklist before requesting a review
Please delete options that are not relevant.
Description
DbUtils::getTableForItemType()registering both directions of the itemtype/table mapping:Rule::getTable()returnsglpi_rulesfor every subclass (example:RuleTicket). So when the table of such a subclass is resolved,getItemTypeForTable('glpi_rules')returnsRuleTicketinstead ofRulefor the rest of the request.CommonDBChild::getItemField()then comparesgetItemtypeForForeignKeyField('rules_id')(now
RuleTicket) withRule::class, does not match so it throws an exception.Fix :
In
CommonDBChild::getItemField(), compare tables rather than itemtypes.