From 0080d42b66e532c3591db1ee8445db315e778adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 17 Mar 2021 21:49:05 +0100 Subject: [PATCH 1/2] fix php8 warnings --- htdocs/core/boxes/box_graph_nb_tickets_type.php | 5 +++++ htdocs/core/boxes/box_graph_ticket_by_severity.php | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/htdocs/core/boxes/box_graph_nb_tickets_type.php b/htdocs/core/boxes/box_graph_nb_tickets_type.php index eea0f0ccf77..44c883e6096 100644 --- a/htdocs/core/boxes/box_graph_nb_tickets_type.php +++ b/htdocs/core/boxes/box_graph_nb_tickets_type.php @@ -128,6 +128,11 @@ class box_graph_nb_tickets_type extends ModeleBoxes } $dataseries = array(); $data = array(); + $data['COM'] = 0; + $data['HELP'] = 0; + $data['ISSUE'] = 0; + $data['REQUEST'] = 0; + $data['OTHER'] = 0; $sql = "SELECT t.type_code, COUNT(t.type_code) as nb"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; $sql .= " WHERE t.fk_statut <> 8"; diff --git a/htdocs/core/boxes/box_graph_ticket_by_severity.php b/htdocs/core/boxes/box_graph_ticket_by_severity.php index 252769abd0e..feec768446b 100644 --- a/htdocs/core/boxes/box_graph_ticket_by_severity.php +++ b/htdocs/core/boxes/box_graph_ticket_by_severity.php @@ -138,6 +138,10 @@ class box_graph_ticket_by_severity extends ModeleBoxes $dataseries = array(); $data = array(); + $data['LOW'] = 0; + $data['NORMAL'] = 0; + $data['HIGH'] = 0; + $data['BLOCKING'] = 0; $sql = "SELECT t.severity_code, COUNT(t.severity_code) as nb"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; $sql .= " WHERE t.fk_statut <> 8"; From 5b253eeb479ff9548ad4b9c36021d362d37430f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 18 Mar 2021 23:30:42 +0100 Subject: [PATCH 2/2] fix the fix --- htdocs/core/boxes/box_graph_nb_tickets_type.php | 10 ++++------ htdocs/core/boxes/box_graph_ticket_by_severity.php | 9 ++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/htdocs/core/boxes/box_graph_nb_tickets_type.php b/htdocs/core/boxes/box_graph_nb_tickets_type.php index 44c883e6096..735dbed27dc 100644 --- a/htdocs/core/boxes/box_graph_nb_tickets_type.php +++ b/htdocs/core/boxes/box_graph_nb_tickets_type.php @@ -128,11 +128,6 @@ class box_graph_nb_tickets_type extends ModeleBoxes } $dataseries = array(); $data = array(); - $data['COM'] = 0; - $data['HELP'] = 0; - $data['ISSUE'] = 0; - $data['REQUEST'] = 0; - $data['OTHER'] = 0; $sql = "SELECT t.type_code, COUNT(t.type_code) as nb"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; $sql .= " WHERE t.fk_statut <> 8"; @@ -147,7 +142,10 @@ class box_graph_nb_tickets_type extends ModeleBoxes $i++; } foreach ($listofoppcode as $rowid => $code) { - $dataseries[] = array('label' => $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $code, 'c_ticket_category', 'code', 'label', $code), 'data' => $data[$code]); + $dataseries[] = array( + 'label' => $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $code, 'c_ticket_category', 'code', 'label', $code), + 'data' => (empty($data[$code]) ? 0 : $data[$code]) + ); } } else { dol_print_error($this->db); diff --git a/htdocs/core/boxes/box_graph_ticket_by_severity.php b/htdocs/core/boxes/box_graph_ticket_by_severity.php index feec768446b..ce769da4752 100644 --- a/htdocs/core/boxes/box_graph_ticket_by_severity.php +++ b/htdocs/core/boxes/box_graph_ticket_by_severity.php @@ -138,10 +138,6 @@ class box_graph_ticket_by_severity extends ModeleBoxes $dataseries = array(); $data = array(); - $data['LOW'] = 0; - $data['NORMAL'] = 0; - $data['HIGH'] = 0; - $data['BLOCKING'] = 0; $sql = "SELECT t.severity_code, COUNT(t.severity_code) as nb"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; $sql .= " WHERE t.fk_statut <> 8"; @@ -156,7 +152,10 @@ class box_graph_ticket_by_severity extends ModeleBoxes $i++; } foreach ($listofoppcode as $rowid => $code) { - $dataseries[] = array('label' => $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $code, 'c_ticket_category', 'code', 'label', $code), 'data' => $data[$code]); + $dataseries[] = array( + 'label' => $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $code, 'c_ticket_category', 'code', 'label', $code), + 'data' => (empty($data[$code]) ? 0 : $data[$code]) + ); } } else { dol_print_error($this->db);