Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(cv): issue with moving of widgets (#6448)
Browse files Browse the repository at this point in the history
* fix(cv): issue with moving of widgets

Resolve CP7M-137
  • Loading branch information
vhr authored Jul 6, 2018
1 parent dbe58c3 commit f0a4dbe
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions www/class/centreonWidget.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -712,21 +712,18 @@ public function updateWidgetPositions($params)
if (count($tmp) != 3) {
throw new CentreonWidgetException('incorrect position data');
}
$column = $tmp[0];
$row = $tmp[1];
$widgetOrder = "{$tmp[0]}_{$tmp[1]}";
$widgetId = $tmp[2];
$queryValues = array();

$query = 'UPDATE widget_views SET widget_order = :widgetOrder ' .
'WHERE custom_view_id = :viewId ' .
'AND widget_id = :widgetId';
$queryValues[] = (string)$column . "_" . $row;
$queryValues[] = (int)$viewId;
$queryValues[] = (int)$widgetId;
$stmt = $this->db->prepare($query);
$stmt->bindParam(':widgetOrder', $column . "_" . $row, PDO::PARAM_STR);
$stmt->bindParam(':widgetOrder', $widgetOrder, PDO::PARAM_STR);
$stmt->bindParam(':viewId', $viewId, PDO::PARAM_INT);
$stmt->bindParam(':widgetId', $widgetId, PDO::PARAM_INT);
$dbResult = $stmt->execute();

if (!$dbResult) {
throw new \Exception("An error occured");
}
Expand Down

0 comments on commit f0a4dbe

Please sign in to comment.