diff --git a/install/install.php b/install/install.php index 1c086c611..62e6096aa 100644 --- a/install/install.php +++ b/install/install.php @@ -764,7 +764,7 @@ protected function createMiniDashboardBigNumbers() { // With counters $x = 0; $w = 4; // Width - $h = 1; // Height + $h = 2; // Height $s = 0; // space between widgets $y = 0; foreach ($cards as $key => $options) { diff --git a/install/upgrade_to_2.13.10.php b/install/upgrade_to_2.13.10.php new file mode 100644 index 000000000..468fa28cf --- /dev/null +++ b/install/upgrade_to_2.13.10.php @@ -0,0 +1,79 @@ +. + * --------------------------------------------------------------------- + * @copyright Copyright © 2011 - 2021 Teclib' + * @license http://www.gnu.org/licenses/gpl.txt GPLv3+ + * @link https://github.com/pluginsGLPI/formcreator/ + * @link https://pluginsglpi.github.io/formcreator/ + * @link http://plugins.glpi-project.org/#/plugin/formcreator + * --------------------------------------------------------------------- + */ + +use Glpi\Dashboard\Dashboard; +use Glpi\Dashboard\Item; +use Glpi\Toolbox\Sanitizer; + +class PluginFormcreatorUpgradeTo2_13_10 { + /** @var Migration */ + protected $migration; + + public function isResyncIssuesRequired() { + return false; + } + + /** + * @param Migration $migration + */ + public function upgrade(Migration $migration) { + $this->migration = $migration; + $this->resizeWidgets(); + } + + /** + * Resize widgets height of the `plugin_formcreator_issue_counters` dashboard to match + * the mini_tickets core dashboard style + * + * @return void + */ + public function resizeWidgets() { + // Get container + $dashboard = new Dashboard(); + $found = $dashboard->getFromDB("plugin_formcreator_issue_counters"); + + if (!$found) { + // Unable to fetch dashboard + return; + }; + + $di = new Item(); + $cards = $di->find(['dashboards_dashboards_id' => $dashboard->fields['id']]); + + foreach ($cards as $card) { + $di = new Item(); + $di->update([ + 'id' => $card['id'], + 'height' => 2, + ]); + } + } +}