Skip to content

Commit

Permalink
Merge pull request #25 from FutureProcessing/glpi-v10.0.0-beta
Browse files Browse the repository at this point in the history
The changes required for the latest version of GLPI (v10.0.0) have been added.
  • Loading branch information
mikron-ia authored Feb 2, 2022
2 parents 6a0a2f8 + 4c01d8e commit bc85c88
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 36 deletions.
15 changes: 8 additions & 7 deletions inc/common.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ private static function usersUnassignedToALicense(int $license_id): array
);

$users_assigned_to_a_license = [];
while ($data = $result->next()) {
$users_assigned_to_a_license[] = $data['users_id'];

foreach ($result as $data => $content) {
$users_assigned_to_a_license[] = $content['users_id'];
}

if (empty($users_assigned_to_a_license)) {
Expand All @@ -188,8 +189,9 @@ private static function usersUnassignedToALicense(int $license_id): array
}

$users_unassigned_to_a_license = [];
while ($data = $result->next()) {
$users_unassigned_to_a_license[] = $data['id'];

foreach ($result as $data => $content) {
$users_unassigned_to_a_license[] = $content['id'];
}

return $users_unassigned_to_a_license;
Expand Down Expand Up @@ -409,7 +411,6 @@ static function showForLicense(SoftwareLicense $license): void
return;
}

echo "<div class='center'>";
$can_edit = PluginFpsoftwareVersionhelper::checkRights(
"software",
[CREATE, UPDATE, DELETE, PURGE],
Expand All @@ -428,9 +429,9 @@ static function showForLicense(SoftwareLicense $license): void

$number_of_assigned_licenses = $license_helper->getNumberOfAssignedLicenses();
if ($number_of_assigned_licenses < 1) {
echo "<table class='tab_cadre_fixe'>";
echo "<div><table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No item found') . "</th></tr>";
echo "</table></div>\n";
echo "</table></div>" . PHP_EOL;

return;
}
Expand Down
4 changes: 2 additions & 2 deletions inc/licensehelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ private function getNumberOfLicenses(): int
);

$number_of_licenses = [];
while ($data = $result->next()) {
$number_of_licenses[] = $data['number'];
foreach ($result as $data => $content) {
$number_of_licenses[] = $content['number'];
}

return $number_of_licenses[0];
Expand Down
8 changes: 4 additions & 4 deletions inc/userslicenses.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ public static function getUserLicenses(int $user_id): array
);

$user_licenses = [];
while ($data = $result->next()) {
$user_licenses[] = $data['softwarelicenses_id'];
foreach ($result as $data => $content) {
$user_licenses[] = $content['softwarelicenses_id'];
}

return $user_licenses;
Expand Down Expand Up @@ -280,8 +280,8 @@ public static function getLicensesUnassignedToUser(int $user_id): array
}

$licenses = [];
while ($data = $result->next()) {
$licenses[] = $data['id'];
foreach ($result as $data => $content) {
$licenses[] = $content['id'];
}

return $licenses;
Expand Down
26 changes: 3 additions & 23 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,12 @@ function plugin_version_fpsoftware()
{
return array(
'name' => "FP Software",
'version' => '1.6.1',
'version' => '2.0.0',
'author' => 'Future Processing',
'license' => 'GPLv2+',
'homepage' => 'http://www.future-processing.com',
'minGlpiVersion' => '0.84'
); // For compatibility / no install in version < 0.80
}

/**
* Blocking a specific version of GLPI.
* GLPI constantly evolving in terms of functions of the heart, it is advisable
* to create a plugin blocking the current version, quite to modify the function
* to a later version of GLPI. In this example, the plugin will be operational
* with the 0.84 and 0.85 versions of GLPI.
*
* @return boolean
*/
function plugin_fpsoftware_check_prerequisites()
{
if (version_compare(GLPI_VERSION, '0.84', '<') || version_compare(GLPI_VERSION, '9.6', '>=')) {
echo "This plugin requires GLPI >= 0.84 and GLPI < 9.6";

return false;
}

return true;
'minGlpiVersion' => '9.5'
);
}

/**
Expand Down

0 comments on commit bc85c88

Please sign in to comment.