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

Commit

Permalink
fix deprecated Condition should be an array
Browse files Browse the repository at this point in the history
  • Loading branch information
amma35 committed Aug 9, 2018
1 parent ccc1cd2 commit ab5fddc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion inc/database.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtem
static function countForItem(CommonDBTM $item) {
$dbu = new DbUtils();
return $dbu->countElementsInTable('glpi_plugin_databases_databases',
"`suppliers_id` = '" . $item->getID() . "'");
["suppliers_id" => $item->getID()]);
}

/**
Expand Down
13 changes: 7 additions & 6 deletions inc/database_item.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,15 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $
*/
static function countForDatabase(PluginDatabasesDatabase $item) {

$types = implode("','", $item->getTypes());
if (empty($types)) {
$types = $item->getTypes();
if (count($types) == 0) {
return 0;
}
$dbu = new DbUtils();
return $dbu->countElementsInTable('glpi_plugin_databases_databases_items',
"`itemtype` IN ('$types')
AND `plugin_databases_databases_id` = '" . $item->getID() . "'");
["plugin_databases_databases_id" => $item->getID(),
"itemtype" => $types
]);
}


Expand All @@ -158,8 +159,8 @@ static function countForDatabase(PluginDatabasesDatabase $item) {
static function countForItem(CommonDBTM $item) {
$dbu = new DbUtils();
return $dbu->countElementsInTable('glpi_plugin_databases_databases_items',
"`itemtype`='" . $item->getType() . "'
AND `items_id` = '" . $item->getID() . "'");
["itemtype" => $item->getType(),
"items_id" => $item->getID()]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion inc/instance.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
static function countForItem(CommonDBTM $item) {
$dbu = new DbUtils();
return $dbu->countElementsInTable('glpi_plugin_databases_instances',
"`plugin_databases_databases_id` = '" . $item->getID() . "'");
["plugin_databases_databases_id" => $item->getID()]);
}


Expand Down
6 changes: 3 additions & 3 deletions inc/profile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = f
$profileRight = new ProfileRight();
foreach ($rights as $right => $value) {
if ($dbu->countElementsInTable('glpi_profilerights',
"`profiles_id`='$profiles_id' AND `name`='$right'") && $drop_existing) {
["profiles_id" => $profiles_id, "name" => $right]) && $drop_existing) {
$profileRight->deleteByCriteria(['profiles_id' => $profiles_id, 'name' => $right]);
}
if (!$dbu->countElementsInTable('glpi_profilerights',
"`profiles_id`='$profiles_id' AND `name`='$right'")) {
["profiles_id" => $profiles_id, "name" => $right])) {
$myright['profiles_id'] = $profiles_id;
$myright['name'] = $right;
$myright['rights'] = $value;
Expand Down Expand Up @@ -253,7 +253,7 @@ static function initProfile() {
//Add new rights in glpi_profilerights table
foreach ($profile->getAllRights(true) as $data) {
if ($dbu->countElementsInTable("glpi_profilerights",
"`name` = '" . $data['field'] . "'") == 0) {
["name" => $data['field']]) == 0) {
ProfileRight::addProfileRights([$data['field']]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion inc/script.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
static function countForItem(CommonDBTM $item) {
$dbu = new DbUtils();
return $dbu->countElementsInTable('glpi_plugin_databases_scripts',
"`plugin_databases_databases_id` = '" . $item->getID() . "'");
["plugin_databases_databases_id" => $item->getID()]);
}

/**
Expand Down

0 comments on commit ab5fddc

Please sign in to comment.