diff --git a/application/dashboard.class.inc.php b/application/dashboard.class.inc.php index f28419a64..5141c0921 100644 --- a/application/dashboard.class.inc.php +++ b/application/dashboard.class.inc.php @@ -1,20 +1,21 @@ +/** + * Copyright (C) 2013-2019 Combodo SARL + * + * This file is part of iTop. + * + * iTop is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * iTop is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + */ require_once(APPROOT.'application/dashboardlayout.class.inc.php'); require_once(APPROOT.'application/dashlet.class.inc.php'); @@ -164,6 +165,13 @@ abstract class Dashboard protected function InitDashletFromDOMNode($oDomNode) { $sId = $oDomNode->getAttribute('id'); + // To avoid collision with other dashlets with the same ID we suffix it. Collisions typically happen with extensions. + // Note: The check is done so we don't append it at each save of the dashboard. + if(strpos($sId, 'uniqid_') === false) + { + $sId .= '_uniqid_' . uniqid(); + } + $sDashletType = $oDomNode->getAttribute('xsi:type'); // Test if dashlet can be instanciated, otherwise (uninstalled, broken, ...) we display a placeholder