26 require_once DOL_DOCUMENT_ROOT.
"/core/boxes/modules_boxes.php";
33 public $boxcode =
"box_ticket_by_severity";
34 public $boximg =
"ticket";
36 public $depends = array(
"ticket");
44 public $info_box_head = array();
45 public $info_box_contents = array();
47 public $widgettype =
'graph';
58 $langs->load(
"boxes");
61 $this->boxlabel = $langs->transnoentitiesnoconv(
"BoxTicketSeverity");
72 global $conf, $user, $langs;
74 $badgeStatus0 =
'#cbd3d3';
75 $badgeStatus1 =
'#bc9526';
76 $badgeStatus1b =
'#bc9526';
77 $badgeStatus2 =
'#9c9c26';
78 $badgeStatus3 =
'#bca52b';
79 $badgeStatus4 =
'#25a580';
80 $badgeStatus4b =
'#25a580';
81 $badgeStatus5 =
'#cad2d2';
82 $badgeStatus6 =
'#cad2d2';
83 $badgeStatus7 =
'#baa32b';
84 $badgeStatus8 =
'#993013';
85 $badgeStatus9 =
'#e7f0f0';
86 if (file_exists(DOL_DOCUMENT_ROOT .
'/theme/' . $conf->theme .
'/theme_vars.inc.php')) {
87 include DOL_DOCUMENT_ROOT .
'/theme/' . $conf->theme .
'/theme_vars.inc.php';
91 require_once DOL_DOCUMENT_ROOT.
"/ticket/class/ticket.class.php";
93 $text = $langs->trans(
"BoxTicketSeverity", $max);
94 $this->info_box_head = array(
99 $listofopplabel = array();
100 $listofoppcode = array();
101 $colorseriesstat = array();
102 if ($user->hasRight(
'ticket',
'read')) {
103 $sql =
"SELECT cts.rowid, cts.label, cts.code";
104 $sql .=
" FROM " . MAIN_DB_PREFIX .
"c_ticket_severity as cts";
105 $sql .=
" WHERE cts.active = 1";
106 $sql .= $this->
db->order(
'cts.rowid',
'ASC');
113 $objp = $this->
db->fetch_object(
$resql);
114 $listofoppcode[$objp->rowid] = $objp->code;
115 $listofopplabel[$objp->rowid] = $objp->label;
116 switch ($objp->code) {
118 $colorseriesstat[$objp->rowid] = $badgeStatus4;
121 $colorseriesstat[$objp->rowid] = $badgeStatus2;
124 $colorseriesstat[$objp->rowid] = $badgeStatus1;
127 $colorseriesstat[$objp->rowid] = $badgeStatus8;
138 $dataseries = array();
140 $sql =
"SELECT t.severity_code, COUNT(t.severity_code) as nb";
141 $sql .=
" FROM " . MAIN_DB_PREFIX .
"ticket as t";
142 $sql .=
" WHERE t.fk_statut <> 8";
143 $sql .=
" GROUP BY t.severity_code";
149 $objp = $this->
db->fetch_object(
$resql);
150 $data[$objp->severity_code] = $objp->nb;
153 foreach ($listofoppcode as $rowid => $code) {
154 $dataseries[] = array(
155 'label' => $langs->getLabelFromKey($this->db,
'TicketSeverityShort' . $code,
'c_ticket_severity',
'code',
'label', $code),
156 'data' => (empty($data[$code]) ? 0 : $data[$code])
163 $stringtoprint .=
'<div class="div-table-responsive-no-min ">';
164 if (!empty($dataseries) && count($dataseries) > 0) {
165 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
167 $mesg = $px1->isGraphKo();
173 foreach ($dataseries as $value) {
174 $data[] = array($value[
'label'], $value[
'data']);
175 $totalnb += $value[
'data'];
178 $px1->SetData($data);
179 $px1->setShowLegend(0);
180 $px1->SetType(array(
'bars'));
181 $px1->SetLegend($legend);
182 $px1->SetMaxValue($px1->GetCeilMaxValue());
185 $px1->SetHorizTickIncrement(1);
186 $px1->SetCssPrefix(
"cssboxes");
187 $px1->mode =
'depth';
189 $px1->draw(
'idgraphticketseverity');
190 $stringtoprint .= $px1->show($totalnb ? 0 : 1);
192 $stringtoprint .=
'</div>';
193 $this->info_box_contents[][]=array(
194 'td' =>
'class="center"',
195 'text' => $stringtoprint
198 $this->info_box_contents[0][0] = array(
200 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"BoxNoTicketSeverity").
'</span>'
204 $this->info_box_contents[0][0] = array(
206 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>',
219 public function showBox($head =
null, $contents =
null, $nooutput = 0)
221 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
loadBox($max=5)
Load data into info_box_contents array to show array later.
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
__construct($db, $param='')
Constructor.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
$conf db
API class for accounts.