26 require_once DOL_DOCUMENT_ROOT.
"/core/boxes/modules_boxes.php";
34 public $boxcode =
"box_nb_tickets_type";
35 public $boximg =
"ticket";
37 public $depends = array(
"ticket");
40 public $info_box_head = array();
41 public $info_box_contents = array();
43 public $widgettype =
'graph';
54 $langs->load(
"boxes");
57 $this->boxlabel = $langs->transnoentitiesnoconv(
"BoxNewTicketVSClose");
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)";
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)";
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"),
180 public function showBox($head =
null, $contents =
null, $nooutput = 0)
182 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.