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