Debug module ticket
This commit is contained in:
parent
7afcdb46eb
commit
f9cc120d75
@ -229,7 +229,7 @@ class DolGraph
|
||||
/**
|
||||
* Set width
|
||||
*
|
||||
* @param int $w Width
|
||||
* @param int|string $w Width (Example: 320 or '100%')
|
||||
* @return boolean|null True
|
||||
*/
|
||||
public function SetWidth($w)
|
||||
|
||||
@ -99,6 +99,7 @@ class modTicket extends DolibarrModules
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->phpmin = array(5,4); // Minimum version of PHP required by module
|
||||
$this->langfiles = array("ticket");
|
||||
|
||||
// Constants
|
||||
// List of particular constants to add when module is enabled
|
||||
// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||
|
||||
@ -133,6 +133,7 @@ TicketsIndex=Ticket - home
|
||||
TicketList=List of tickets
|
||||
TicketAssignedToMeInfos=This page display ticket list created by or assigned to current user
|
||||
NoTicketsFound=No ticket found
|
||||
NoUnreadTicketsFound=No unread ticket found
|
||||
TicketViewAllTickets=View all tickets
|
||||
TicketViewNonClosedOnly=View only open tickets
|
||||
TicketStatByStatus=Tickets by status
|
||||
|
||||
@ -24,6 +24,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/ticket/class/actions_ticket.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticketstats.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/dolgraph.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('companies', 'other', 'ticket'));
|
||||
@ -102,8 +103,8 @@ if (empty($endyear)) {
|
||||
}
|
||||
|
||||
$startyear = $endyear - 1;
|
||||
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
|
||||
$HEIGHT = '192';
|
||||
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '100%' : '80%';
|
||||
$HEIGHT = '228';
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
@ -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 .= '</div>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th >' . $langs->trans("Statistics") . ' ' . img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_by_status" class="linkobject"') . '</th></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print '<tr><td class="center">';
|
||||
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 '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -303,7 +304,7 @@ if ($result) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th colspan="5">' . $transRecordedType . '</th>';
|
||||
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/ticket/list.php">'.$langs->trans("FullList").'</th>';
|
||||
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/ticket/list.php?search_fk_statut[]='.Ticket::STATUS_NOT_READ.'">'.$langs->trans("FullList").'</th>';
|
||||
print '</tr>';
|
||||
if ($num > 0) {
|
||||
|
||||
@ -359,7 +360,7 @@ if ($result) {
|
||||
|
||||
$db->free();
|
||||
} else {
|
||||
print '<tr><td colspan="6" class="opacitymedium">' . $langs->trans('NoTicketsFound') . '</td></tr>';
|
||||
print '<tr><td colspan="6" class="opacitymedium">' . $langs->trans('NoUnreadTicketsFound') . '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user