62 global $conf, $user, $langs;
64 $badgeStatus0 =
'#cbd3d3';
65 $badgeStatus1 =
'#bc9526';
66 $badgeStatus1b =
'#bc9526';
67 $badgeStatus2 =
'#9c9c26';
68 $badgeStatus3 =
'#bca52b';
69 $badgeStatus4 =
'#25a580';
70 $badgeStatus4b =
'#25a580';
71 $badgeStatus5 =
'#cad2d2';
72 $badgeStatus6 =
'#cad2d2';
73 $badgeStatus7 =
'#baa32b';
74 $badgeStatus8 =
'#993013';
75 $badgeStatus9 =
'#e7f0f0';
76 $text = $langs->trans(
"BoxNewTicketVSClose");
77 $this->info_box_head = array(
82 if ($user->hasRight(
'ticket',
'read')) {
85 $sql =
"SELECT COUNT(t.datec) as nb";
86 $sql .=
" FROM ".MAIN_DB_PREFIX.
"ticket as t";
87 $sql .=
" WHERE CAST(t.datec AS DATE) = CURRENT_DATE";
88 $sql .=
" AND t.fk_statut <> 8";
89 $sql .=
" GROUP BY CAST(t.datec AS DATE)";
90 $resql = $this->db->query($sql);
92 $num = $this->db->num_rows($resql);
94 $objp = $this->db->fetch_object($resql);
95 $data[] = array($langs->transnoentitiesnoconv(
'TicketCreatedToday'), $objp->nb);
96 $totalnb += $objp->nb;
98 $data[] = array($langs->transnoentitiesnoconv(
'TicketCreatedToday'), 0);
103 $sql =
"SELECT COUNT(t.date_close) as nb";
104 $sql .=
" FROM ".MAIN_DB_PREFIX.
"ticket as t";
105 $sql .=
" WHERE CAST(t.date_close AS DATE) = CURRENT_DATE";
106 $sql .=
" AND t.fk_statut = 8";
107 $sql .=
" GROUP BY CAST(t.date_close AS DATE)";
108 $resql = $this->db->query($sql);
110 $num = $this->db->num_rows($resql);
112 $objp = $this->db->fetch_object($resql);
113 $data[] = array($langs->transnoentitiesnoconv(
'TicketClosedToday'), $objp->nb);
114 $totalnb += $objp->nb;
116 $data[] = array($langs->transnoentitiesnoconv(
'TicketClosedToday'), 0);
121 $colorseries = array();
122 $colorseries[] = $badgeStatus8;
123 $colorseries[] = $badgeStatus2;
125 $stringtoprint .=
'<div class="div-table-responsive-no-min ">';
126 if (!empty($data) && count($data) > 0) {
127 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
129 $mesg = $px1->isGraphKo();
131 $px1->SetDataColor($colorseries);
132 $px1->SetData($data);
133 $px1->setShowLegend(2);
134 if (!empty($conf->dol_optimize_smallscreen)) {
137 $px1->SetType(array(
'pie'));
138 $px1->SetMaxValue($px1->GetCeilMaxValue());
140 $px1->SetHorizTickIncrement(1);
141 $px1->SetCssPrefix(
"cssboxes");
142 $px1->mode =
'depth';
144 $px1->draw(
'idgraphticketnewvsclosetoday');
145 $stringtoprint .= $px1->show($totalnb ? 0 : 1);
147 $stringtoprint .=
'</div>';
148 $this->info_box_contents[][] = array(
149 'td' =>
'class="center"',
150 'text' => $stringtoprint
153 $this->info_box_contents[0][0] = array(
154 'td' =>
'class="center"',
155 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"BoxNoTicketSeverity").
'</span>'
159 $this->info_box_contents[0][0] = array(
160 'td' =>
'class="left"',
161 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'