Browse Source

#189 Allow categories to be both tickets/events, events, or tickets

merge-requests/1/head
Mike Koch 6 years ago
parent
commit
914fb0ff9c
  1. 2
      admin/admin_ticket.php
  2. 2
      admin/calendar.php
  3. 9
      admin/manage_categories.php
  4. 2
      admin/new_ticket.php
  5. 2
      index.php

2
admin/admin_ticket.php

@ -552,7 +552,7 @@ require_once(HESK_PATH . 'inc/headerAdmin.inc.php');
/* List of categories */
$orderBy = $modsForHesk_settings['category_order_column'];
$result = hesk_dbQuery("SELECT `id`,`name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `" . $orderBy . "` ASC");
$result = hesk_dbQuery("SELECT `id`,`name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `usage` <> 2 ORDER BY `" . $orderBy . "` ASC");
$categories_options = '';
while ($row = hesk_dbFetchAssoc($result)) {
$selected = '';

2
admin/calendar.php

@ -50,7 +50,7 @@ hesk_isLoggedIn();
define('MFH_CALENDAR', 1);
// Get categories for the dropdown
$rs = hesk_dbQuery("SELECT `id`, `name`, `color` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `cat_order`");
$rs = hesk_dbQuery("SELECT `id`, `name`, `color` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `usage` <> 1 ORDER BY `cat_order`");
$categories = [];
while ($row = hesk_dbFetchAssoc($rs)) {
$row['css_style'] = $row['color'] == null ? 'color: black; border: solid 1px #000' : 'background: ' . $row['color'];

9
admin/manage_categories.php

@ -234,6 +234,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
<th><?php echo $hesklang['priority']; ?></th>
<th><?php echo $hesklang['not']; ?></th>
<th><?php echo $hesklang['graph']; ?></th>
<th><?php echo 'Usage'; ?></th>
<th><?php echo $hesklang['manager']; ?></th>
<th><?php echo $hesklang['opt']; ?></th>
</tr>
@ -261,6 +262,13 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
$j = 0;
$num = hesk_dbNumRows($res);
$usage = array(
0 => '<i class="fa fa-fw fa-ticket icon-link" data-toggle="tooltip" title="Tickets"></i>
<i class="fa fa-fw fa-calendar icon-link" data-toggle="tooltip" title="Events"></i>',
1 => '<i class="fa fa-fw fa-ticket icon-link" data-toggle="tooltip" title="Tickets"></i><i class="fa fa-fw"></i>',
2 => '<i class="fa fa-fw icon-link">&nbsp;</i> <i class="fa fa-fw fa-calendar icon-link" data-toggle="tooltip" title="Events"></i>'
);
while ($mycat = hesk_dbFetchAssoc($res)) {
$j++;
@ -327,6 +335,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
</div>
</div>
</td>
<td>' . $usage[$mycat['usage']] . '</td>
<td>' . get_manager($mycat['manager'], $users) . '</td>
<td>
<a href="Javascript:void(0)" onclick="Javascript:hesk_window(\'manage_categories.php?a=linkcode&amp;catid=' . $mycat['id'] . '&amp;p=' . $mycat['type'] . '\',\'200\',\'500\')" id="tooltip"><i class="fa fa-code icon-link" style="color: ' . ($mycat['type'] ? 'gray' : 'green') . '" data-toggle="tooltip" data-placement="top" title="' . $hesklang['geco'] . '"></i></a>

2
admin/new_ticket.php

@ -263,7 +263,7 @@ if (!$show['show']) {
// List categories
$orderByColumn = $modsForHesk_settings['category_order_column'];
$result = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` ORDER BY `' . $orderByColumn . '` ASC');
$result = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` WHERE `usage` <> 2 ORDER BY `' . $orderByColumn . '` ASC');
while ($row = hesk_dbFetchAssoc($result)) {
if (isset($_SESSION['as_category']) && $_SESSION['as_category'] == $row['id']) {
$selected = ' selected="selected"';

2
index.php

@ -262,7 +262,7 @@ function print_add_ticket()
// Get categories
hesk_dbConnect();
$orderBy = $modsForHesk_settings['category_order_column'];
$res = hesk_dbQuery("SELECT `id`, `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `type`='0' ORDER BY `" . $orderBy . "` ASC");
$res = hesk_dbQuery("SELECT `id`, `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `type`='0' AND `usage` <> 2 ORDER BY `" . $orderBy . "` ASC");
if (hesk_dbNumRows($res) == 1) {
// Only 1 public category, no need for a select box

Loading…
Cancel
Save