diff --git a/install/install.php b/install/install.php index 1c086c611..fdb689cc6 100644 --- a/install/install.php +++ b/install/install.php @@ -83,6 +83,7 @@ class PluginFormcreatorInstall { '2.13.4' => '2.13.5', '2.13.5' => '2.13.6', '2.13.6' => '2.13.7', + '2.13.7' => '2.13.10', ]; protected bool $resyncIssues = false; @@ -764,7 +765,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..3a26be92a --- /dev/null +++ b/install/upgrade_to_2.13.10.php @@ -0,0 +1,83 @@ +. + * --------------------------------------------------------------------- + * @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; + +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 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, + ]); + } + } +} diff --git a/install/upgrade_to_2.13.7.php b/install/upgrade_to_2.13.7.php index efba230d7..dda50fba1 100644 --- a/install/upgrade_to_2.13.7.php +++ b/install/upgrade_to_2.13.7.php @@ -1,4 +1,5 @@ migration = $migration; $this->fixEncodingInQuestions(); $this->resizeWidgets(); @@ -57,7 +61,8 @@ public function upgrade(Migration $migration) { * * @return void */ - public function fixEncodingInQuestions() { + public function fixEncodingInQuestions() + { global $DB; $table = 'glpi_plugin_formcreator_questions'; @@ -94,7 +99,8 @@ public function fixEncodingInQuestions() { * * @return void */ - public function resizeWidgets() { + public function resizeWidgets() + { // Get container $dashboard = new Dashboard(); $found = $dashboard->getFromDB("plugin_formcreator_issue_counters"); @@ -118,7 +124,7 @@ public function resizeWidgets() { 'y' => 0, ]); - $x +=4; + $x += 4; } } } diff --git a/setup.php b/setup.php index 96e95461e..40ad67fe0 100644 --- a/setup.php +++ b/setup.php @@ -33,7 +33,7 @@ global $CFG_GLPI; // Version of the plugin (major.minor.bugfix) -define('PLUGIN_FORMCREATOR_VERSION', '2.13.9'); +define('PLUGIN_FORMCREATOR_VERSION', '2.13.10'); // Schema version of this version (major.minor only) define('PLUGIN_FORMCREATOR_SCHEMA_VERSION', '2.13'); // is or is not an official release of the plugin