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