' . $langs->trans('TicketPublicInterfaceForbidden') . '
';
-} else {
- print '';
@@ -120,16 +121,14 @@ $tick = array(
'closed' => 0,
'deleted' => 0,
);
-$total = 0;
+
$sql = "SELECT t.fk_statut, COUNT(t.fk_statut) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
-
-$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')';
-$sql .= " AND t.fk_statut IS NOT NULL";
-$sql .= " AND date_format(datec,'%Y') = '" . $endyear . "'";
+$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')';
+$sql .= dolSqlDateFilter('datec', 0, 0, $endyear);
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
}
@@ -149,44 +148,41 @@ $result = $db->query($sql);
if ($result) {
while ($objp = $db->fetch_object($result)) {
$found = 0;
- if ($objp->fk_statut == 0) {
+ if ($objp->fk_statut == Ticket::STATUS_NOT_READ) {
$tick['unread'] = $objp->nb;
}
- if ($objp->fk_statut == 1) {
+ if ($objp->fk_statut == Ticket::STATUS_READ) {
$tick['read'] = $objp->nb;
}
- if ($objp->fk_statut == 3) {
- $tick['answered'] = $objp->nb;
+ if ($objp->fk_statut == Ticket::STATUS_NEED_MORE_INFO) {
+ $tick['needmoreinfo'] = $objp->nb;
}
- if ($objp->fk_statut == 4) {
+ if ($objp->fk_statut == Ticket::STATUS_ASSIGNED) {
$tick['assigned'] = $objp->nb;
}
- if ($objp->fk_statut == 5) {
+ if ($objp->fk_statut == Ticket::STATUS_IN_PROGRESS) {
$tick['inprogress'] = $objp->nb;
}
- if ($objp->fk_statut == 6) {
+ if ($objp->fk_statut == Ticket::STATUS_WAITING) {
$tick['waiting'] = $objp->nb;
}
- if ($objp->fk_statut == 8) {
+ if ($objp->fk_statut == Ticket::STATUS_CLOSED) {
$tick['closed'] = $objp->nb;
}
- if ($objp->fk_statut == 9) {
- $tick['deleted'] = $objp->nb;
+ if ($objp->fk_statut == Ticket::STATUS_CANCELED) {
+ $tick['canceled'] = $objp->nb;
}
}
- if ((round($tick['unread']) ? 1 : 0) +(round($tick['read']) ? 1 : 0) +(round($tick['answered']) ? 1 : 0) +(round($tick['assigned']) ? 1 : 0) +(round($tick['inprogress']) ? 1 : 0) +(round($tick['waiting']) ? 1 : 0) +(round($tick['closed']) ? 1 : 0) +(round($tick['deleted']) ? 1 : 0) >= 2
- ) {
- $dataseries = array();
- $dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread']));
- $dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read']));
- $dataseries[] = array('label' => $langs->trans("Answered"), 'data' => round($tick['answered']));
- $dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned']));
- $dataseries[] = array('label' => $langs->trans("InProgress"), 'data' => round($tick['inprogress']));
- $dataseries[] = array('label' => $langs->trans("Waiting"), 'data' => round($tick['waiting']));
- $dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed']));
- $dataseries[] = array('label' => $langs->trans("Deleted"), 'data' => round($tick['deleted']));
- }
+ $dataseries = array();
+ $dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread']));
+ $dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read']));
+ $dataseries[] = array('label' => $langs->trans("NeedMoreInformation"), 'data' => round($tick['needmoreinfo']));
+ $dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned']));
+ $dataseries[] = array('label' => $langs->trans("InProgress"), 'data' => round($tick['inprogress']));
+ $dataseries[] = array('label' => $langs->trans("Waiting"), 'data' => round($tick['waiting']));
+ $dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed']));
+ $dataseries[] = array('label' => $langs->trans("Canceled"), 'data' => round($tick['canceled']));
} else {
dol_print_error($db);
}
@@ -210,11 +206,17 @@ $stringtoshow .= '
';
print '
';
print '| ' . $langs->trans("Statistics") . ' ' . img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_by_status" class="linkobject"') . ' |
';
-print '| ';
+print ' |
| ';
+print $stringtoshow;
// don't display graph if no series
if (! empty($dataseries) && count($dataseries) > 1) {
- $data = array();
+ $totalnb=0;
+ foreach ($dataseries as $key => $value) {
+ $totalnb += $value['data'];
+ }
+
+ $data = array();
foreach ($dataseries as $key => $value) {
$data[] = array($value['label'], $value['data']);
}
@@ -244,10 +246,9 @@ if (! empty($dataseries) && count($dataseries) > 1) {
//$px1->SetTitle($langs->trans("TicketStatByStatus"));
$px1->draw($filenamenb, $fileurlnb);
- print $px1->show();
+ print $px1->show($totalnb?0:1);
}
}
-print $stringtoshow;
print ' |
';
print '
';
@@ -303,7 +304,7 @@ if ($result) {
print '
';
print '
';
print '| ' . $transRecordedType . ' | ';
- print ''.$langs->trans("FullList").' | ';
+ print ''.$langs->trans("FullList").' | ';
print '
';
if ($num > 0) {
@@ -359,7 +360,7 @@ if ($result) {
$db->free();
} else {
- print '| ' . $langs->trans('NoTicketsFound') . ' |
';
+ print '| ' . $langs->trans('NoUnreadTicketsFound') . ' |
';
}
print "
";
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 34651304b95..a151fdb5574 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -774,7 +774,7 @@ class User extends CommonObject
dol_syslog(get_class($this)."::clearrights reset user->rights");
$this->rights='';
$this->nb_rights=0;
- $this->all_permissions_are_loaded=false;
+ $this->all_permissions_are_loaded=0;
$this->_tab_loaded=array();
}
@@ -799,16 +799,16 @@ class User extends CommonObject
return;
}
- if ($this->all_permissions_are_loaded)
+ if (! empty($this->all_permissions_are_loaded))
{
// We already loaded all rights for this user, so we leave
return;
}
}
- // Recuperation des droits utilisateurs + recuperation des droits groupes
+ // Get permission of users + Get permissions of groups
- // D'abord les droits utilisateurs
+ // First user permissions
$sql = "SELECT DISTINCT r.module, r.perms, r.subperms";
$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= ", ".MAIN_DB_PREFIX."rights_def as r";
@@ -862,7 +862,7 @@ class User extends CommonObject
$this->db->free($resql);
}
- // Maintenant les droits groupes
+ // Now permissions of groups
$sql = "SELECT DISTINCT r.module, r.perms, r.subperms";
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,";
$sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu,";
@@ -933,7 +933,7 @@ class User extends CommonObject
}
else
{
- // Si module defini, on le marque comme charge en cache
+ // If module defined, we flag it as loaded into cache
$this->_tab_loaded[$moduletag]=1;
}
}
@@ -2300,7 +2300,6 @@ class User extends CommonObject
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
$result=''; $label='';
- $link=''; $linkstart=''; $linkend='';
if (! empty($this->photo))
{
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index c3fe000292c..d51d82c8d13 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -552,13 +552,13 @@ class UserGroup extends CommonObject
if ($moduletag && isset($this->_tab_loaded[$moduletag]) && $this->_tab_loaded[$moduletag])
{
- // Le fichier de ce module est deja charge
+ // Rights for this module are already loaded, so we leave
return;
}
if (! empty($this->all_permissions_are_loaded))
{
- // Si les permissions ont deja ete chargees, on quitte
+ // We already loaded all rights for this group, so we leave
return;
}
@@ -618,7 +618,7 @@ class UserGroup extends CommonObject
}
else
{
- // Si module defini, on le marque comme charge en cache
+ // If module defined, we flag it as loaded into cache
$this->_tab_loaded[$moduletag]=1;
}
@@ -867,7 +867,6 @@ class UserGroup extends CommonObject
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) $withpicto=0;
$result=''; $label='';
- $link=''; $linkstart=''; $linkend='';
$label.= '
';
$label.= '' . $langs->trans("Group") . '
';
@@ -957,7 +956,7 @@ class UserGroup extends CommonObject
public function _load_ldap_info()
{
// phpcs:enable
- global $conf,$langs;
+ global $conf;
$info=array();