Add number of tickets to category
This commit is contained in:
parent
c86788e7fd
commit
d76cc27e8e
@ -84,12 +84,6 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<?php
|
<?php
|
||||||
$orderBy = $modsForHesk_settings['category_order_column'];
|
$orderBy = $modsForHesk_settings['category_order_column'];
|
||||||
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `" . $orderBy . "` ASC");
|
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `" . $orderBy . "` ASC");
|
||||||
$options = '';
|
|
||||||
while ($mycat = hesk_dbFetchAssoc($res)) {
|
|
||||||
$options .= '<option value="' . $mycat['id'] . '" ';
|
|
||||||
$options .= (isset($_SESSION['selcat']) && $mycat['id'] == $_SESSION['selcat']) ? ' selected="selected" ' : '';
|
|
||||||
$options .= '>' . $mycat['name'] . '</option>';
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<section class="content">
|
<section class="content">
|
||||||
@ -254,8 +248,9 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box">
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
/* This will handle error, success and notice messages */
|
/* This will handle error, success and notice messages */
|
||||||
hesk_handle_messages();
|
hesk_handle_messages();
|
||||||
@ -271,6 +266,25 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
<?php echo $hesklang['create_new']; ?>
|
<?php echo $hesklang['create_new']; ?>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-12">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="display: none"><?php echo $hesklang['id']; ?></th>
|
||||||
|
<th><?php echo $hesklang['cat_name']; ?></th>
|
||||||
|
<th><?php echo $hesklang['priority']; ?></th>
|
||||||
|
<th><?php echo $hesklang['not']; ?></th>
|
||||||
|
<th><?php echo $hesklang['graph']; ?></th>
|
||||||
|
<th><?php echo $hesklang['usage']; ?></th>
|
||||||
|
<th><?php echo $hesklang['manager']; ?></th>
|
||||||
|
<th><?php echo $hesklang['opt']; ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="table-body">
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
@ -425,6 +439,9 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="overlay" id="overlay">
|
||||||
|
<i class="fa fa-spinner fa-spin"></i>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
@ -65,4 +65,9 @@ class Category {
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $description;
|
public $description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $numberOfTickets;
|
||||||
}
|
}
|
@ -15,7 +15,11 @@ class CategoryGateway extends CommonDao {
|
|||||||
function getAllCategories($hesk_settings) {
|
function getAllCategories($hesk_settings) {
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
||||||
$sql = 'SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories`';
|
$sql = 'SELECT `cat`.*, COUNT(`tickets`.`id`) AS `number_of_tickets`
|
||||||
|
FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` `cat`
|
||||||
|
LEFT JOIN `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'tickets` `tickets`
|
||||||
|
ON `cat`.`id` = `tickets`.`category`
|
||||||
|
GROUP BY `cat`.`id`';
|
||||||
|
|
||||||
$response = hesk_dbQuery($sql);
|
$response = hesk_dbQuery($sql);
|
||||||
|
|
||||||
@ -35,6 +39,7 @@ class CategoryGateway extends CommonDao {
|
|||||||
$category->priority = intval($row['priority']);
|
$category->priority = intval($row['priority']);
|
||||||
$category->manager = intval($row['manager']) == 0 ? NULL : intval($row['manager']);
|
$category->manager = intval($row['manager']) == 0 ? NULL : intval($row['manager']);
|
||||||
$category->description = $row['mfh_description'];
|
$category->description = $row['mfh_description'];
|
||||||
|
$category->numberOfTickets = intval($row['number_of_tickets']);
|
||||||
$results[$category->id] = $category;
|
$results[$category->id] = $category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user