Commit ee10c771 authored by Johan Cwiklinski's avatar Johan Cwiklinski Committed by Johan Cwiklinski

Replace deprecated calls, prevent undefined index

parent 032a215d
......@@ -892,7 +892,7 @@ abstract class CommonDBChild extends CommonDBConnexity {
$condition = $current_table . '.' . $where_id . '=' . $item->fields['id'];
if ($DB->fieldExists(static::getTable(), 'itemtype') && $self === false) {
$condition .= ' AND ' . $current_table . '.itemtype = "' . $DB->escape($item_type) . '"';
$condition .= ' AND ' . $DB->quoteName($current_table . '.itemtype') . ' = ' . $DB->quote($item_type);
}
return $condition;
......
......@@ -1862,7 +1862,7 @@ abstract class CommonDBRelation extends CommonDBConnexity {
$condition = $current_table . '.' . $where_id . '=' . $item->fields['id'];
if ($DB->fieldExists(static::getTable(), 'itemtype') && $self === false) {
$condition .= ' AND ' . $current_table . '.itemtype = "' . $DB->escape($item_type) . '"';
$condition .= ' AND ' . $DB->quoteName($current_table . '.itemtype') . ' = ' . $DB->quote($item_type);
}
return $condition;
......@@ -1936,7 +1936,8 @@ abstract class CommonDBRelation extends CommonDBConnexity {
$link_table = getTableForItemtype($link_type);
$existing = [];
$join = Search::addLeftJoin(
$search = new Search($link_type, []);
$join = $search->addLeftJoin(
$link_type,
$link_table,
$existing,
......
......@@ -5396,7 +5396,7 @@ class CommonDBTM extends CommonGLPI {
*/
protected function getDbFormFields($fields) {
global $DB;
if ($dbfields = $DB->list_fields($this->getTable())) {
if ($dbfields = $DB->listFields($this->getTable())) {
foreach (array_keys($fields) as $field) {
if (!isset($dbfields[$field])) {
/*Toolbox::logWarning(
......@@ -5488,7 +5488,7 @@ class CommonDBTM extends CommonGLPI {
*/
public function getForm($add = false) {
global $DB;
$columns = $DB->list_fields($this->getTable());
$columns = $DB->listFields($this->getTable());
$this->form_elements = [];
$form_fields = $this->getFormFields($add);
......
......@@ -1491,7 +1491,8 @@ class Item_Devices extends CommonDBRelation {
$link_table = getTableForItemtype($link_type);
$existing = [];
$join = Search::addLeftJoin(
$search = new \Search($link_type, []);
$join = $search->addLeftJoin(
$link_type,
$link_table,
$existing,
......
......@@ -371,7 +371,7 @@ class Search {
$this->constructData($data);
if (!isset($data['data']['totalcount'])) {
Toolbox::logError('Somethng went wrong during search.');
Toolbox::logError("Something went wrong during $itemtype search");
return;
}
......
......@@ -127,7 +127,7 @@ class GlpiDebug extends Twig_Extension
$panel .= "<tr class='tab_bg_".(($num%2)+1)."'><td>$num</td><td>";
$panel .= \Html::cleanSQLDisplay($query);
$panel .= "</td><td>";
$panel .= $DEBUG_SQL['times'][$num];
$panel .= isset($DEBUG_SQL['times'][$num]) ?$DEBUG_SQL['times'][$num] : '-';
$panel .= "</td><td>";
if (isset($DEBUG_SQL['errors'][$num])) {
$panel .= $DEBUG_SQL['errors'][$num];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment