68 global $conf, $user, $langs;
70 $badgeStatus0 =
'#cbd3d3';
71 $badgeStatus1 =
'#bc9526';
72 $badgeStatus1b =
'#bc9526';
73 $badgeStatus2 =
'#9c9c26';
74 $badgeStatus3 =
'#bca52b';
75 $badgeStatus4 =
'#25a580';
76 $badgeStatus4b =
'#25a580';
77 $badgeStatus5 =
'#cad2d2';
78 $badgeStatus6 =
'#cad2d2';
79 $badgeStatus7 =
'#baa32b';
80 $badgeStatus8 =
'#993013';
81 $badgeStatus9 =
'#e7f0f0';
82 $text = $langs->trans(
"BoxNewTicketVSClose");
83 $this->info_box_head = array(
88 if ($user->hasRight(
'ticket',
'read')) {
91 $sql =
"SELECT COUNT(t.datec) as nb";
92 $sql .=
" FROM ".MAIN_DB_PREFIX.
"ticket as t";
93 $sql .=
" WHERE CAST(t.datec AS DATE) = CURRENT_DATE";
94 $sql .=
" AND t.fk_statut <> 8";
95 $sql .=
" GROUP BY CAST(t.datec AS DATE)";
96 $resql = $this->db->query($sql);
98 $num = $this->db->num_rows($resql);
100 $objp = $this->db->fetch_object($resql);
101 $data[] = array($langs->transnoentitiesnoconv(
'TicketCreatedToday'), $objp->nb);
102 $totalnb += $objp->nb;
104 $data[] = array($langs->transnoentitiesnoconv(
'TicketCreatedToday'), 0);
109 $sql =
"SELECT COUNT(t.date_close) as nb";
110 $sql .=
" FROM ".MAIN_DB_PREFIX.
"ticket as t";
111 $sql .=
" WHERE CAST(t.date_close AS DATE) = CURRENT_DATE";
112 $sql .=
" AND t.fk_statut = 8";
113 $sql .=
" GROUP BY CAST(t.date_close AS DATE)";
114 $resql = $this->db->query($sql);
116 $num = $this->db->num_rows($resql);
118 $objp = $this->db->fetch_object($resql);
119 $data[] = array($langs->transnoentitiesnoconv(
'TicketClosedToday'), $objp->nb);
120 $totalnb += $objp->nb;
122 $data[] = array($langs->transnoentitiesnoconv(
'TicketClosedToday'), 0);
127 $colorseries = array();
128 $colorseries[] = $badgeStatus8;
129 $colorseries[] = $badgeStatus2;
131 $stringtoprint .=
'<div class="div-table-responsive-no-min ">';
132 if (!empty($data) && count($data) > 0) {
133 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
135 $mesg = $px1->isGraphKo();
137 $px1->SetDataColor(array_values($colorseries));
138 $px1->SetData($data);
139 $px1->setShowLegend(2);
140 if (!empty($conf->dol_optimize_smallscreen)) {
143 $px1->SetType(array(
'pie'));
144 $px1->SetMaxValue($px1->GetCeilMaxValue());
146 $px1->SetHorizTickIncrement(1);
147 $px1->SetCssPrefix(
"cssboxes");
148 $px1->mode =
'depth';
150 $px1->draw(
'idgraphticketnewvsclosetoday');
151 $stringtoprint .= $px1->show($totalnb ? 0 : 1);
153 $stringtoprint .=
'</div>';
154 $this->info_box_contents[][] = array(
155 'td' =>
'class="center"',
156 'text' => $stringtoprint
159 $this->info_box_contents[0][0] = array(
160 'td' =>
'class="center opacitymedium"',
161 'text' => $langs->trans(
"BoxNoTicketSeverity"),
165 $this->info_box_contents[0][0] = array(
166 'td' =>
'class="left"',
167 'text' => $langs->trans(
"ReadPermissionNotAllowed"),