Skip to content

Commit

Permalink
fix: duplicate key when updating a profile
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Feb 17, 2023
1 parent 1269edd commit 1bd6a2a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -732,11 +732,18 @@ function plugin_formcreator_hook_update_profile(CommonDBTM $item) {
}
$dashboardRight = new DashboardRight();
if ($item->fields['interface'] == 'helpdesk') {
$dashboardRight->add([
$dashboardRight->getFromDBByCrit([
'dashboards_dashboards_id' => $dashboard->fields['id'],
'itemtype' => Profile::getType(),
'items_id' => $item->getID(),
]);
if ($dashboardRight->isNewItem()) {
$dashboardRight->add([
'dashboards_dashboards_id' => $dashboard->fields['id'],
'itemtype' => Profile::getType(),
'items_id' => $item->getID(),
]);
}
} else {
$dashboardRight->delete([
'dashboards_dashboards_id' => $dashboard->fields['id'],
Expand Down

0 comments on commit 1bd6a2a

Please sign in to comment.