Merge branch '397-fine-tuned-category-colors' into '3-1-0'

Resolve "Color Buttons Calendar Categories"

See merge request !61
merge-requests/62/head
Mike Koch 7 years ago
commit fe898a7a1c

@ -33,14 +33,26 @@ if ($modsForHesk_settings['enable_calendar'] == '0') {
// Get categories for the dropdown // Get categories for the dropdown
$order_by = $modsForHesk_settings['category_order_column']; $order_by = $modsForHesk_settings['category_order_column'];
$rs = hesk_dbQuery("SELECT `id`, `name`, `color` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `usage` <> 1 ORDER BY `" . hesk_dbEscape($order_by) . "`"); $rs = hesk_dbQuery("SELECT `id`, `name`, `background_color`, `foreground_color`, `display_border_outline`
FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories`
WHERE `usage` <> 1 ORDER BY `" . hesk_dbEscape($order_by) . "`");
$categories = array(); $categories = array();
while ($row = hesk_dbFetchAssoc($rs)) { while ($row = hesk_dbFetchAssoc($rs)) {
if (!$_SESSION['isadmin'] && !in_array($row['id'], $_SESSION['categories'])) { if (!$_SESSION['isadmin'] && !in_array($row['id'], $_SESSION['categories'])) {
continue; continue;
} }
$row['css_style'] = $row['color'] == null ? 'background: white; color: black; border: solid 1px #000;' : 'border: solid 1px ' . $row['color'] . '; background: ' . $row['color']; $row['css_style'] = "background: {$row['background_color']};";
$row['background_volatile'] = 'background-volatile';
if ($row['foreground_color'] != 'AUTO') {
$row['background_volatile'] = '';
$row['css_style'] .= " color: {$row['foreground_color']};";
if ($row['display_border_outline'] == '1') {
$row['css_style'] .= " border: solid 1px {$row['foreground_color']};";
}
}
$categories[] = $row; $categories[] = $row;
} }
@ -57,7 +69,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<?php foreach ($categories as $category): ?> <?php foreach ($categories as $category): ?>
<li> <li>
<div class="ticket-info"> <div class="ticket-info">
<div class="hide-on-overflow no-wrap event-category background-volatile" <div class="hide-on-overflow no-wrap event-category <?php echo $category['background_volatile']; ?>"
data-select-toggle="category-toggle" data-name="category-toggle" data-category-value="<?php echo $category['id']; ?>" data-select-toggle="category-toggle" data-name="category-toggle" data-category-value="<?php echo $category['id']; ?>"
data-checked="1" data-checked="1"
data-toggle="tooltip" data-toggle="tooltip"

@ -277,12 +277,21 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
} }
$tmp = $i ? 'White' : 'Blue'; $tmp = $i ? 'White' : 'Blue';
$style = ''; $style = 'background: ' . $mycat['background_color'];
if ($mycat['color'] == null) { $backgroundVolatile = 'background-volatile';
$style .= 'color: black; border: solid 1px #000'; if ($mycat['foreground_color'] != 'AUTO') {
} else { $style .= '; color: ' . $mycat['foreground_color'];
$style .= 'background: ' . $mycat['color']; $backgroundVolatile = '';
if ($mycat['display_border_outline']) {
$style .= '; border: solid 1px ' . $mycat['foreground_color'];
}
}
if ($mycat['foreground_color'] == 'AUTO') {
$mycat['foreground_color'] = '';
} }
$i = $i ? 0 : 1; $i = $i ? 0 : 1;
/* Number of tickets and graph width */ /* Number of tickets and graph width */
@ -319,16 +328,18 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
echo ' echo '
<tr data-category-id="' . $mycat['id'] . '" data-name="' . htmlspecialchars($mycat['name']) . '" <tr data-category-id="' . $mycat['id'] . '" data-name="' . htmlspecialchars($mycat['name']) . '"
data-color="'. htmlspecialchars($mycat['color']) . '" data-priority="' . $mycat['priority'] . '" data-foreground-color="' . htmlspecialchars($mycat['foreground_color']) . '"
data-border="' . $mycat['display_border_outline'] . '"
data-background-color="'. htmlspecialchars($mycat['background_color']) . '"
data-priority="' . $mycat['priority'] . '"
data-manager="' . $mycat['manager'] . '" data-usage="'. $mycat['usage'] .'"> data-manager="' . $mycat['manager'] . '" data-usage="'. $mycat['usage'] .'">
<td style="display: none">' . $mycat['id'] . '</td> <td style="display: none">' . $mycat['id'] . '</td>
<td><span class="label background-volatile category-label" style="'.$style.'">' . $mycat['name'] . '</span></td> <td><span class="label ' . $backgroundVolatile . ' category-label" style="'.$style.'">' . $mycat['name'] . '</span></td>
<td width="1" style="white-space: nowrap;">' . $priorities[$mycat['priority']]['formatted'] . '</td> <td width="1" style="white-space: nowrap;">' . $priorities[$mycat['priority']]['formatted'] . '</td>
<td><a href="show_tickets.php?category=' . $mycat['id'] . '&amp;s_all=1&amp;s_my=1&amp;s_ot=1&amp;s_un=1" alt="' . $hesklang['list_tickets_cat'] . '" title="' . $hesklang['list_tickets_cat'] . '">' . $all . '</a></td> <td><a href="show_tickets.php?category=' . $mycat['id'] . '&amp;s_all=1&amp;s_my=1&amp;s_ot=1&amp;s_un=1" alt="' . $hesklang['list_tickets_cat'] . '" title="' . $hesklang['list_tickets_cat'] . '">' . $all . '</a></td>
<td> <td>
<div class="progress" style="width: 160px; margin-bottom: 0" title="' . sprintf($hesklang['perat'], $width_all . '%') . '" data-toggle="tooltip"> <div class="progress" style="width: 160px; margin-bottom: 0" title="' . sprintf($hesklang['perat'], $width_all . '%') . '" data-toggle="tooltip">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: ' . $width_all . '%"> <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: ' . $width_all . '%">
<span class="sr-only">40% Complete (success)</span>
</div> </div>
</div> </div>
</td> </td>
@ -386,18 +397,55 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="color" class="col-sm-3 control-label"> <label for="background-color" class="col-sm-3 control-label">
<?php echo $hesklang['category_color']; ?> <?php echo $hesklang['category_background_color']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover" <i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo htmlspecialchars($hesklang['category_color']); ?>" title="<?php echo htmlspecialchars($hesklang['category_background_color']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_color_help']); ?>"></i> data-content="<?php echo htmlspecialchars($hesklang['category_background_color_help']); ?>"></i>
</label> </label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" name="color" class="form-control category-colorpicker" <input type="text" name="background-color" class="form-control category-colorpicker"
placeholder="<?php echo $hesklang['category_color']; ?>"> placeholder="<?php echo $hesklang['category_background_color']; ?>"
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
required>
<div class="help-block with-errors"></div> <div class="help-block with-errors"></div>
</div> </div>
</div> </div>
<div class="form-group">
<label for="foreground-color" class="col-sm-3 control-label">
<?php echo $hesklang['category_foreground_color']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo htmlspecialchars($hesklang['category_foreground_color']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_foreground_color_help']); ?>"></i>
</label>
<div class="col-sm-9">
<input type="text" name="foreground-color" class="form-control category-colorpicker"
placeholder="<?php echo $hesklang['category_foreground_color']; ?>">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
<label for="display-border" class="col-sm-3 control-label">
<?php echo $hesklang['category_display_border']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="htmlpopover"
title="<?php echo htmlspecialchars($hesklang['category_display_border']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_display_border_help']); ?>"></i>
</label>
<div class="col-sm-9 form-inline">
<div class="radio">
<label>
<input type="radio" name="display-border" value="1">
<?php echo $hesklang['yes']; ?>
</label>
</div>&nbsp;&nbsp;&nbsp;
<div class="radio">
<label>
<input type="radio" name="display-border" value="0" checked>
<?php echo $hesklang['no']; ?>
</label>
</div>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label for="priority" class="col-sm-3 control-label"> <label for="priority" class="col-sm-3 control-label">
<?php echo $hesklang['priority']; ?> <?php echo $hesklang['priority']; ?>
@ -471,7 +519,8 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
var name = tempNameElement.value; var name = tempNameElement.value;
var id = $row.attr('data-category-id'); var id = $row.attr('data-category-id');
var color = $row.attr('data-color'); var backgroundColor = $row.attr('data-background-color');
var foregroundColor = $row.attr('data-foreground-color');
var priority = $row.attr('data-priority'); var priority = $row.attr('data-priority');
var manager = $row.attr('data-manager'); var manager = $row.attr('data-manager');
var usage = $row.attr('data-usage'); var usage = $row.attr('data-usage');
@ -482,29 +531,32 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
.find('select[name="manager"]').val(manager).end() .find('select[name="manager"]').val(manager).end()
.find('input[name="id"]').val(id).end() .find('input[name="id"]').val(id).end()
.find('select[name="usage"]').val(usage).end() .find('select[name="usage"]').val(usage).end()
.find('input[name="color"]').val(color).end(); .find('input[name="background-color"]').val(backgroundColor).end()
.find('input[name="foreground-color"]').val(foregroundColor).end();
var colorpickerOptions = null;
if (color == '') { var colorpickerOptions = {
colorpickerOptions = { format: 'hex',
format: 'hex' color: backgroundColor
}; };
} else { $modal.find('input[name="background-color"]')
colorpickerOptions = {
format: 'hex',
color: color
};
}
$modal.find('input[name="color"]')
.colorpicker(colorpickerOptions).end().modal('show'); .colorpicker(colorpickerOptions).end().modal('show');
if (color == '') { colorpickerOptions = {
$modal.find('input[name="color"]').val(''); format: 'hex'
};
if (foregroundColor != '') {
colorpickerOptions.color = foregroundColor;
} }
$modal.find('input[name="foreground-color"]')
.colorpicker(colorpickerOptions).end().modal('show');
}); });
$('.cancel-callback').click(function() { $('.cancel-callback').click(function() {
$('#edit-category-modal').find('input[name="color"]').val('').colorpicker('destroy').end(); var $editCategoryModal = $('#edit-category-modal');
$editCategoryModal.find('input[name="background-color"]').val('').colorpicker('destroy').end();
$editCategoryModal.find('input[name="foreground-color"]').val('').colorpicker('destroy').end();
}); });
}); });
</script> </script>
@ -629,9 +681,13 @@ function new_cat()
/* Category name */ /* Category name */
$catname = hesk_input(hesk_POST('name'), $hesklang['enter_cat_name'], 'manage_categories.php'); $catname = hesk_input(hesk_POST('name'), $hesklang['enter_cat_name'], 'manage_categories.php');
$color = hesk_POST('color', null); $background_color = hesk_POST('background-color', '#ffffff');
$color = str_replace('#', '', $color); $foreground_color = hesk_POST('foreground-color', '#000000');
$color = $color != null ? "'#" . hesk_dbEscape($color) . "'" : 'NULL'; $display_border = hesk_POST('display-border', 0);
if ($foreground_color == '') {
$foreground_color = 'AUTO';
$display_border = 0;
}
$usage = hesk_POST('usage', 0); $usage = hesk_POST('usage', 0);
@ -647,7 +703,11 @@ function new_cat()
$row = hesk_dbFetchRow($res); $row = hesk_dbFetchRow($res);
$my_order = $row[0] + 10; $my_order = $row[0] + 10;
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` (`name`,`cat_order`,`autoassign`,`type`, `priority`, `color`, `usage`) VALUES ('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "','" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}', {$color}, " . intval($usage) . ")"); hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories`
(`name`,`cat_order`,`autoassign`,`type`, `priority`, `background_color`, `foreground_color`, `display_border_outline`, `usage`) VALUES
('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "',
'" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}', '" . hesk_dbEscape($background_color) . "',
'" . hesk_dbEscape($foreground_color) . "', '" . intval($display_border) . "', " . intval($usage) . ")");
hesk_cleanSessionVars('catname'); hesk_cleanSessionVars('catname');
hesk_cleanSessionVars('cat_autoassign'); hesk_cleanSessionVars('cat_autoassign');
@ -676,9 +736,13 @@ function update_category()
$catname = hesk_input(hesk_POST('name'), $hesklang['cat_ren_name'], $_SERVER['PHP_SELF']); $catname = hesk_input(hesk_POST('name'), $hesklang['cat_ren_name'], $_SERVER['PHP_SELF']);
$_SESSION['catname2'] = $catname; $_SESSION['catname2'] = $catname;
$color = hesk_POST('color', null); $background_color = hesk_POST('background-color', '#ffffff');
$color = str_replace('#', '', $color); $foreground_color = hesk_POST('foreground-color', '#000000');
$color = $color != null ? "'#" . hesk_dbEscape($color) . "'" : 'NULL'; $display_border = hesk_POST('display-border', 0);
if ($foreground_color == '') {
$foreground_color = 'AUTO';
$display_border = 0;
}
$manager = hesk_POST('manager', 0); $manager = hesk_POST('manager', 0);
$priority = hesk_POST('priority', 0); $priority = hesk_POST('priority', 0);
$usage = hesk_POST('usage', 0); $usage = hesk_POST('usage', 0);
@ -687,7 +751,9 @@ function update_category()
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `name`='" . hesk_dbEscape($catname) . "', hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `name`='" . hesk_dbEscape($catname) . "',
`priority` = '" . hesk_dbEscape($priority) . "', `priority` = '" . hesk_dbEscape($priority) . "',
`manager` = " . intval($manager) . ", `manager` = " . intval($manager) . ",
`color` = " . $color . ", `background_color` = '" . hesk_dbEscape($background_color) . "',
`foreground_color` = '" . hesk_dbEscape($foreground_color) . "',
`display_border_outline` = '" . intval($display_border) . "',
`usage` = " . intval($usage) . " `usage` = " . intval($usage) . "
WHERE `id`='" . intval($catid) . "'"); WHERE `id`='" . intval($catid) . "'");
@ -847,6 +913,8 @@ function get_manager($user_id, $user_array) {
return $user['name']; return $user['name'];
} }
} }
return 'Error!';
} }
?> ?>

@ -31,7 +31,16 @@ $categorySql = "SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "c
$categoryRs = hesk_dbQuery($categorySql); $categoryRs = hesk_dbQuery($categorySql);
while ($row = hesk_dbFetchAssoc($categoryRs)) while ($row = hesk_dbFetchAssoc($categoryRs))
{ {
$row['css_style'] = $row['color'] == null ? 'color: black; border: solid 1px #000; padding-right: 14px' : 'background: ' . $row['color']; $row['css_style'] = "background: {$row['background_color']};";
$row['background_volatile'] = 'background-volatile';
if ($row['foreground_color'] != 'AUTO') {
$row['background_volatile'] = '';
$row['css_style'] .= " color: {$row['foreground_color']};";
if ($row['display_border_outline'] == '1') {
$row['css_style'] .= " border: solid 1px {$row['foreground_color']};";
}
}
$categories[] = $row; $categories[] = $row;
} }
@ -55,7 +64,8 @@ require_once(HESK_PATH . 'inc/header.inc.php');
<div class="checkbox"> <div class="checkbox">
<input type="checkbox" data-select-target="category-toggle" name="category-toggle" value="<?php echo $category['id']; ?>" checked> <input type="checkbox" data-select-target="category-toggle" name="category-toggle" value="<?php echo $category['id']; ?>" checked>
</div> </div>
<div class="hide-on-overflow no-wrap event-category background-volatile" style="<?php echo $category['css_style']; ?>"> <div class="hide-on-overflow no-wrap event-category <?php echo $category['background_volatile']; ?>"
style="<?php echo $category['css_style']; ?>">
<?php echo $category['name']; ?> <?php echo $category['name']; ?>
</div> </div>
</li> </li>

@ -267,16 +267,17 @@ div.ticket-info {
color: #444; color: #444;
} }
.event-category:hover {
border: solid 1px #fff !important;
cursor: pointer;
}
.event-category[data-checked="0"] { .event-category[data-checked="0"] {
background: #777 !important; background: #777 !important;
border: none !important;
color: #aaa !important; color: #aaa !important;
} }
.event-category:hover {
border: solid 1px #fff !important;
cursor: pointer;
}
.anchor { .anchor {
padding-top: 50px; padding-top: 50px;
height: 0; height: 0;

@ -65,21 +65,21 @@ hesk_dbConnect();
output_header_row('1.0.0 - 1.3.x'); output_header_row('1.0.0 - 1.3.x');
$all_good = run_table_check('statuses'); $all_good = run_table_check('statuses');
$all_good = $all_good & run_column_check('statuses', '`ID`'); $all_good = $all_good & run_column_check('statuses', 'ID');
$all_good = $all_good & run_column_check('statuses', '`TextColor`'); $all_good = $all_good & run_column_check('statuses', 'TextColor');
$all_good = $all_good & run_column_check('statuses', '`IsNewTicketStatus`'); $all_good = $all_good & run_column_check('statuses', 'IsNewTicketStatus');
$all_good = $all_good & run_column_check('statuses', '`IsClosed`'); $all_good = $all_good & run_column_check('statuses', 'IsClosed');
$all_good = $all_good & run_column_check('statuses', '`IsClosedByClient`'); $all_good = $all_good & run_column_check('statuses', 'IsClosedByClient');
$all_good = $all_good & run_column_check('statuses', '`IsCustomerReplyStatus`'); $all_good = $all_good & run_column_check('statuses', 'IsCustomerReplyStatus');
$all_good = $all_good & run_column_check('statuses', '`IsStaffClosedOption`'); $all_good = $all_good & run_column_check('statuses', 'IsStaffClosedOption');
$all_good = $all_good & run_column_check('statuses', '`IsStaffReopenedStatus`'); $all_good = $all_good & run_column_check('statuses', 'IsStaffReopenedStatus');
$all_good = $all_good & run_column_check('statuses', '`IsDefaultStaffReplyStatus`'); $all_good = $all_good & run_column_check('statuses', 'IsDefaultStaffReplyStatus');
$all_good = $all_good & run_column_check('statuses', '`LockedTicketStatus`'); $all_good = $all_good & run_column_check('statuses', 'LockedTicketStatus');
$all_good = $all_good & run_column_check('statuses', '`IsAutocloseOption`'); $all_good = $all_good & run_column_check('statuses', 'IsAutocloseOption');
$all_good = $all_good & run_column_check('statuses', '`Closable`'); $all_good = $all_good & run_column_check('statuses', 'Closable');
output_header_row('1.5.0'); output_header_row('1.5.0');
$all_good = $all_good & run_column_check('users', '`active`'); $all_good = $all_good & run_column_check('users', 'active');
$all_good = $all_good & run_column_check('users', '`notify_note_unassigned`'); $all_good = $all_good & run_column_check('users', 'notify_note_unassigned');
output_header_row('1.6.0'); output_header_row('1.6.0');
$all_good = $all_good & run_table_check('settings'); $all_good = $all_good & run_table_check('settings');
output_header_row('1.7.0'); output_header_row('1.7.0');
@ -87,86 +87,103 @@ hesk_dbConnect();
$all_good = $all_good & run_table_check('pending_verification_emails'); $all_good = $all_good & run_table_check('pending_verification_emails');
$all_good = $all_good & run_table_check('stage_tickets'); $all_good = $all_good & run_table_check('stage_tickets');
output_header_row('2.3.0'); output_header_row('2.3.0');
$all_good = $all_good & run_column_check('service_messages', '`icon`'); $all_good = $all_good & run_column_check('service_messages', 'icon');
$all_good = $all_good & run_column_check('statuses', '`Key`'); $all_good = $all_good & run_column_check('statuses', 'Key');
$all_good = $all_good & run_column_check('tickets', '`latitude`'); $all_good = $all_good & run_column_check('tickets', 'latitude');
$all_good = $all_good & run_column_check('tickets', '`longitude`'); $all_good = $all_good & run_column_check('tickets', 'longitude');
$all_good = $all_good & run_column_check('stage_tickets', '`latitude`'); $all_good = $all_good & run_column_check('stage_tickets', 'latitude');
$all_good = $all_good & run_column_check('stage_tickets', '`longitude`'); $all_good = $all_good & run_column_check('stage_tickets', 'longitude');
$all_good = $all_good & run_column_check('categories', '`manager`'); $all_good = $all_good & run_column_check('categories', 'manager');
$all_good = $all_good & run_column_check('users', '`permission_template`'); $all_good = $all_good & run_column_check('users', 'permission_template');
$all_good = $all_good & run_table_check('permission_templates'); $all_good = $all_good & run_table_check('permission_templates');
$all_good = $all_good & run_column_check('permission_templates', '`id`'); $all_good = $all_good & run_column_check('permission_templates', 'id');
$all_good = $all_good & run_column_check('permission_templates', '`name`'); $all_good = $all_good & run_column_check('permission_templates', 'name');
$all_good = $all_good & run_column_check('permission_templates', '`heskprivileges`'); $all_good = $all_good & run_column_check('permission_templates', 'heskprivileges');
$all_good = $all_good & run_column_check('permission_templates', '`categories`'); $all_good = $all_good & run_column_check('permission_templates', 'categories');
output_header_row('2.4.0'); output_header_row('2.4.0');
$all_good = $all_good & run_table_check('quick_help_sections'); $all_good = $all_good & run_table_check('quick_help_sections');
$all_good = $all_good & run_column_check('quick_help_sections', '`id`'); $all_good = $all_good & run_column_check('quick_help_sections', 'id');
$all_good = $all_good & run_column_check('quick_help_sections', '`location`'); $all_good = $all_good & run_column_check('quick_help_sections', 'location');
$all_good = $all_good & run_column_check('quick_help_sections', '`show`'); $all_good = $all_good & run_column_check('quick_help_sections', 'show');
$all_good = $all_good & run_table_check('text_to_status_xref'); $all_good = $all_good & run_table_check('text_to_status_xref');
$all_good = $all_good & run_column_check('text_to_status_xref', '`id`'); $all_good = $all_good & run_column_check('text_to_status_xref', 'id');
$all_good = $all_good & run_column_check('text_to_status_xref', '`language`'); $all_good = $all_good & run_column_check('text_to_status_xref', 'language');
$all_good = $all_good & run_column_check('text_to_status_xref', '`text`'); $all_good = $all_good & run_column_check('text_to_status_xref', 'text');
$all_good = $all_good & run_column_check('text_to_status_xref', '`status_id`'); $all_good = $all_good & run_column_check('text_to_status_xref', 'status_id');
$all_good = $all_good & run_column_check('statuses', '`sort`'); $all_good = $all_good & run_column_check('statuses', 'sort');
$all_good = $all_good & run_column_check('attachments', '`download_count`'); $all_good = $all_good & run_column_check('attachments', 'download_count');
$all_good = $all_good & run_column_check('kb_attachments', '`download_count`'); $all_good = $all_good & run_column_check('kb_attachments', 'download_count');
$all_good = $all_good & run_column_check('tickets', '`html`'); $all_good = $all_good & run_column_check('tickets', 'html');
$all_good = $all_good & run_column_check('stage_tickets', '`html`'); $all_good = $all_good & run_column_check('stage_tickets', 'html');
$all_good = $all_good & run_column_check('replies', '`html`'); $all_good = $all_good & run_column_check('replies', 'html');
output_header_row('2.5.0'); output_header_row('2.5.0');
$all_good = $all_good & run_column_check('tickets', '`user_agent`'); $all_good = $all_good & run_column_check('tickets', 'user_agent');
$all_good = $all_good & run_column_check('tickets', '`screen_resolution_width`'); $all_good = $all_good & run_column_check('tickets', 'screen_resolution_width');
$all_good = $all_good & run_column_check('tickets', '`screen_resolution_height`'); $all_good = $all_good & run_column_check('tickets', 'screen_resolution_height');
$all_good = $all_good & run_column_check('stage_tickets', '`user_agent`'); $all_good = $all_good & run_column_check('stage_tickets', 'user_agent');
$all_good = $all_good & run_column_check('stage_tickets', '`screen_resolution_width`'); $all_good = $all_good & run_column_check('stage_tickets', 'screen_resolution_width');
$all_good = $all_good & run_column_check('stage_tickets', '`screen_resolution_height`'); $all_good = $all_good & run_column_check('stage_tickets', 'screen_resolution_height');
output_header_row('2.6.0'); output_header_row('2.6.0');
$all_good = $all_good & run_table_check('logging'); $all_good = $all_good & run_table_check('logging');
$all_good = $all_good & run_column_check('logging', '`id`'); $all_good = $all_good & run_column_check('logging', 'id');
$all_good = $all_good & run_column_check('logging', '`username`'); $all_good = $all_good & run_column_check('logging', 'username');
$all_good = $all_good & run_column_check('logging', '`message`'); $all_good = $all_good & run_column_check('logging', 'message');
$all_good = $all_good & run_column_check('logging', '`severity`'); $all_good = $all_good & run_column_check('logging', 'severity');
$all_good = $all_good & run_column_check('logging', '`location`'); $all_good = $all_good & run_column_check('logging', 'location');
$all_good = $all_good & run_column_check('logging', '`timestamp`'); $all_good = $all_good & run_column_check('logging', 'timestamp');
$all_good = $all_good & run_table_check('user_api_tokens'); $all_good = $all_good & run_table_check('user_api_tokens');
$all_good = $all_good & run_column_check('user_api_tokens', '`id`'); $all_good = $all_good & run_column_check('user_api_tokens', 'id');
$all_good = $all_good & run_column_check('user_api_tokens', '`user_id`'); $all_good = $all_good & run_column_check('user_api_tokens', 'user_id');
$all_good = $all_good & run_column_check('user_api_tokens', '`token`'); $all_good = $all_good & run_column_check('user_api_tokens', 'token');
$all_good = $all_good & run_table_check('temp_attachment'); $all_good = $all_good & run_table_check('temp_attachment');
$all_good = $all_good & run_column_check('temp_attachment', '`id`'); $all_good = $all_good & run_column_check('temp_attachment', 'id');
$all_good = $all_good & run_column_check('temp_attachment', '`file_name`'); $all_good = $all_good & run_column_check('temp_attachment', 'file_name');
$all_good = $all_good & run_column_check('temp_attachment', '`saved_name`'); $all_good = $all_good & run_column_check('temp_attachment', 'saved_name');
$all_good = $all_good & run_column_check('temp_attachment', '`size`'); $all_good = $all_good & run_column_check('temp_attachment', 'size');
$all_good = $all_good & run_column_check('temp_attachment', '`type`'); $all_good = $all_good & run_column_check('temp_attachment', 'type');
$all_good = $all_good & run_column_check('temp_attachment', '`date_uploaded`'); $all_good = $all_good & run_column_check('temp_attachment', 'date_uploaded');
$all_good = $all_good & run_table_check('calendar_event'); $all_good = $all_good & run_table_check('calendar_event');
$all_good = $all_good & run_column_check('calendar_event', '`id`'); $all_good = $all_good & run_column_check('calendar_event', 'id');
$all_good = $all_good & run_column_check('calendar_event', '`start`'); $all_good = $all_good & run_column_check('calendar_event', 'start');
$all_good = $all_good & run_column_check('calendar_event', '`end`'); $all_good = $all_good & run_column_check('calendar_event', 'end');
$all_good = $all_good & run_column_check('calendar_event', '`all_day`'); $all_good = $all_good & run_column_check('calendar_event', 'all_day');
$all_good = $all_good & run_column_check('calendar_event', '`name`'); $all_good = $all_good & run_column_check('calendar_event', 'name');
$all_good = $all_good & run_column_check('calendar_event', '`location`'); $all_good = $all_good & run_column_check('calendar_event', 'location');
$all_good = $all_good & run_column_check('calendar_event', '`comments`'); $all_good = $all_good & run_column_check('calendar_event', 'comments');
$all_good = $all_good & run_column_check('calendar_event', '`category`'); $all_good = $all_good & run_column_check('calendar_event', 'category');
$all_good = $all_good & run_table_check('calendar_event_reminder'); $all_good = $all_good & run_table_check('calendar_event_reminder');
$all_good = $all_good & run_column_check('calendar_event_reminder', '`id`'); $all_good = $all_good & run_column_check('calendar_event_reminder', 'id');
$all_good = $all_good & run_column_check('calendar_event_reminder', '`user_id`'); $all_good = $all_good & run_column_check('calendar_event_reminder', 'user_id');
$all_good = $all_good & run_column_check('calendar_event_reminder', '`event_id`'); $all_good = $all_good & run_column_check('calendar_event_reminder', 'event_id');
$all_good = $all_good & run_column_check('calendar_event_reminder', '`amount`'); $all_good = $all_good & run_column_check('calendar_event_reminder', 'amount');
$all_good = $all_good & run_column_check('calendar_event_reminder', '`unit`'); $all_good = $all_good & run_column_check('calendar_event_reminder', 'unit');
$all_good = $all_good & run_column_check('calendar_event_reminder', '`email_sent`'); $all_good = $all_good & run_column_check('calendar_event_reminder', 'email_sent');
$all_good = $all_good & run_column_check('tickets', '`due_date`'); $all_good = $all_good & run_column_check('tickets', 'due_date');
$all_good = $all_good & run_column_check('tickets', '`overdue_email_sent`'); $all_good = $all_good & run_column_check('tickets', 'overdue_email_sent');
$all_good = $all_good & run_column_check('categories', '`color`'); $all_good = $all_good & run_column_check('categories', 'usage');
$all_good = $all_good & run_column_check('categories', '`usage`'); $all_good = $all_good & run_column_check('users', 'notify_overdue_unassigned');
$all_good = $all_good & run_column_check('users', '`notify_overdue_unassigned`'); $all_good = $all_good & run_column_check('users', 'default_calendar_view');
$all_good = $all_good & run_column_check('users', '`default_calendar_view`');
output_header_row('2.6.2'); output_header_row('2.6.2');
$all_good = $all_good & run_column_check('stage_tickets', '`due_date`'); $all_good = $all_good & run_column_check('stage_tickets', 'due_date');
$all_good = $all_good & run_column_check('stage_tickets', '`overdue_email_sent`'); $all_good = $all_good & run_column_check('stage_tickets', 'overdue_email_sent');
output_header_row('3.1.0');
$all_good = $all_good & run_column_check('categories', 'background_color');
$all_good = $all_good & run_column_check('categories', 'foreground_color');
$all_good = $all_good & run_column_check('categories', 'display_border_outline');
$all_good = $all_good & run_column_check('logging', 'stack_trace');
$all_good = $all_good & run_table_check('custom_nav_element');
$all_good = $all_good & run_column_check('custom_nav_element', 'id');
$all_good = $all_good & run_column_check('custom_nav_element', 'image_url');
$all_good = $all_good & run_column_check('custom_nav_element', 'font_icon');
$all_good = $all_good & run_column_check('custom_nav_element', 'place');
$all_good = $all_good & run_column_check('custom_nav_element', 'url');
$all_good = $all_good & run_column_check('custom_nav_element', 'sort');
$all_good = $all_good & run_table_check('custom_nav_element_to_text');
$all_good = $all_good & run_column_check('custom_nav_element_to_text', 'id');
$all_good = $all_good & run_column_check('custom_nav_element_to_text', 'nav_element_id');
$all_good = $all_good & run_column_check('custom_nav_element_to_text', 'language');
$all_good = $all_good & run_column_check('custom_nav_element_to_text', 'text');
$all_good = $all_good & run_column_check('custom_nav_element_to_text', 'subtext');
if ($all_good) { if ($all_good) {
echo "<script>$('#all-good').show()</script>"; echo "<script>$('#all-good').show()</script>";
@ -194,7 +211,7 @@ function run_column_check($table_name, $column_name) {
output_result('<b>Table Exists</b>: ' . $table_name, output_result('<b>Table Exists</b>: ' . $table_name,
$all_good); $all_good);
} else { } else {
$all_good = run_check('SELECT ' . $column_name . ' FROM `' . $hesk_settings['db_pfix'] . $table_name . '` LIMIT 1'); $all_good = run_check('SELECT `' . $column_name . '` FROM `' . $hesk_settings['db_pfix'] . $table_name . '` LIMIT 1');
output_result('<b>Column Exists</b>: ' . $table_name . '.' . $column_name, output_result('<b>Column Exists</b>: ' . $table_name . '.' . $column_name,
$all_good); $all_good);
} }

@ -1006,6 +1006,9 @@ function execute310Scripts() {
language VARCHAR(200) NOT NULL, language VARCHAR(200) NOT NULL,
text VARCHAR(200) NOT NULL, text VARCHAR(200) NOT NULL,
subtext VARCHAR(200))"); subtext VARCHAR(200))");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `foreground_color` VARCHAR(7) NOT NULL DEFAULT 'AUTO'");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `display_border_outline` ENUM('0','1') NOT NULL DEFAULT '0'");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` CHANGE `color` `background_color` VARCHAR(7) NOT NULL DEFAULT '#FFFFFF'");
updateVersion('3.1.0'); updateVersion('3.1.0');
} }

@ -94,7 +94,9 @@ function removeOtherColumns()
executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder`"); executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder`");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `due_date`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `due_date`");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `overdue_email_sent`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `overdue_email_sent`");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `color`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `background_color`");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `foreground_color`");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `display_border_outline`");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `usage`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `usage`");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `notify_overdue_unassigned`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `notify_overdue_unassigned`");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `default_calendar_view`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `default_calendar_view`");

@ -6,7 +6,8 @@ function get_events($start, $end, $hesk_settings, $staff = true) {
$start_time_sql = "CONVERT_TZ(FROM_UNIXTIME(" . hesk_dbEscape($start) . " / 1000), @@session.time_zone, '+00:00')"; $start_time_sql = "CONVERT_TZ(FROM_UNIXTIME(" . hesk_dbEscape($start) . " / 1000), @@session.time_zone, '+00:00')";
$end_time_sql = "CONVERT_TZ(FROM_UNIXTIME(" . hesk_dbEscape($end) . " / 1000), @@session.time_zone, '+00:00')"; $end_time_sql = "CONVERT_TZ(FROM_UNIXTIME(" . hesk_dbEscape($end) . " / 1000), @@session.time_zone, '+00:00')";
$sql = "SELECT `events`.*, `categories`.`name` AS `category_name`, `categories`.`color` AS `category_color` "; $sql = "SELECT `events`.*, `categories`.`name` AS `category_name`, `categories`.`background_color` AS `background_color`,
`categories`.`foreground_color` AS `foreground_color`, `categories`.`display_border_outline` AS `display_border` ";
if ($staff) { if ($staff) {
$sql .= ",`reminders`.`amount` AS `reminder_value`, `reminders`.`unit` AS `reminder_unit` "; $sql .= ",`reminders`.`amount` AS `reminder_value`, `reminders`.`unit` AS `reminder_unit` ";
@ -47,7 +48,9 @@ function get_events($start, $end, $hesk_settings, $staff = true) {
$event['comments'] = $row['comments']; $event['comments'] = $row['comments'];
$event['categoryId'] = $row['category']; $event['categoryId'] = $row['category'];
$event['categoryName'] = $row['category_name']; $event['categoryName'] = $row['category_name'];
$event['categoryColor'] = $row['category_color']; $event['backgroundColor'] = $row['background_color'];
$event['foregroundColor'] = $row['foreground_color'];
$event['displayBorder'] = $row['display_border'];
if ($staff) { if ($staff) {
$event['reminderValue'] = $row['reminder_value']; $event['reminderValue'] = $row['reminder_value'];
@ -63,7 +66,8 @@ function get_events($start, $end, $hesk_settings, $staff = true) {
$current_date = hesk_date(); $current_date = hesk_date();
$hesk_settings['timeformat'] = $old_time_setting; $hesk_settings['timeformat'] = $old_time_setting;
$sql = "SELECT `trackid`, `subject`, `due_date`, `category`, `categories`.`name` AS `category_name`, `categories`.`color` AS `category_color`, $sql = "SELECT `trackid`, `subject`, `due_date`, `category`, `categories`.`name` AS `category_name`, `categories`.`background_color` AS `background_color`,
`categories`.`foreground_color` AS `foreground_color`, `categories`.`display_border_outline` AS `display_border`,
CASE WHEN `due_date` < '{$current_date}' THEN 1 ELSE 0 END AS `overdue`, `owner`.`name` AS `owner_name`, `tickets`.`owner` AS `owner_id`, CASE WHEN `due_date` < '{$current_date}' THEN 1 ELSE 0 END AS `overdue`, `owner`.`name` AS `owner_name`, `tickets`.`owner` AS `owner_id`,
`tickets`.`priority` AS `priority` `tickets`.`priority` AS `priority`
FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` AS `tickets` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` AS `tickets`
@ -94,7 +98,9 @@ function get_events($start, $end, $hesk_settings, $staff = true) {
$event['url'] = $hesk_settings['hesk_url'] . '/' . $hesk_settings['admin_dir'] . '/admin_ticket.php?track=' . $event['trackingId']; $event['url'] = $hesk_settings['hesk_url'] . '/' . $hesk_settings['admin_dir'] . '/admin_ticket.php?track=' . $event['trackingId'];
$event['categoryId'] = $row['category']; $event['categoryId'] = $row['category'];
$event['categoryName'] = $row['category_name']; $event['categoryName'] = $row['category_name'];
$event['categoryColor'] = $row['category_color']; $event['backgroundColor'] = $row['background_color'];
$event['foregroundColor'] = $row['foreground_color'];
$event['displayBorder'] = $row['display_border'];
$event['owner'] = $row['owner_name']; $event['owner'] = $row['owner_name'];
$priorities = array( $priorities = array(

@ -89,9 +89,17 @@ $(document).ready(function() {
.tip() .tip()
.css('padding', '0') .css('padding', '0')
.find('.popover-title') .find('.popover-title')
.css('background-color', event.color === '#fff' ? '#f7f7f7' : event.color) .css('background-color', event.backgroundColor)
.addClass('background-volatile'); .addClass('background-volatile');
if (event.textColor === 'AUTO') {
$eventMarkup.addClass('background-volatile');
} else {
$eventMarkup.data('bs.popover').tip().find('.popover-title')
.css('color', event.textColor)
.css('border', 'solid 1px ' + event.borderColor);
}
$eventMarkup.popover('show'); $eventMarkup.popover('show');
refreshBackgroundVolatileItems(); refreshBackgroundVolatileItems();
}, },
@ -120,7 +128,9 @@ function buildEvent(id, dbObject) {
trackingId: dbObject.trackingId, trackingId: dbObject.trackingId,
start: moment(dbObject.startTime), start: moment(dbObject.startTime),
url: dbObject.url, url: dbObject.url,
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor, backgroundColor: dbObject.backgroundColor,
textColor: dbObject.foregroundColor === 'AUTO' ? calculateTextColor(dbObject.backgroundColor) : dbObject.foregroundColor,
borderColor: parseInt(dbObject.displayBorder) === 1 ? dbObject.foregroundColor : dbObject.backgroundColor,
allDay: true, allDay: true,
type: dbObject.type, type: dbObject.type,
categoryId: dbObject.categoryId, categoryId: dbObject.categoryId,
@ -128,7 +138,6 @@ function buildEvent(id, dbObject) {
className: 'category-' + dbObject.categoryId, className: 'category-' + dbObject.categoryId,
owner: dbObject.owner, owner: dbObject.owner,
priority: dbObject.priority, priority: dbObject.priority,
textColor: calculateTextColor(dbObject.categoryColor),
fontIconMarkup: getIcon(dbObject) fontIconMarkup: getIcon(dbObject)
}; };
} }
@ -151,8 +160,9 @@ function buildEvent(id, dbObject) {
categoryId: dbObject.categoryId, categoryId: dbObject.categoryId,
categoryName: dbObject.categoryName, categoryName: dbObject.categoryName,
className: 'category-' + dbObject.categoryId, className: 'category-' + dbObject.categoryId,
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor, backgroundColor: dbObject.backgroundColor,
textColor: calculateTextColor(dbObject.categoryColor), textColor: dbObject.foregroundColor === 'AUTO' ? calculateTextColor(dbObject.backgroundColor) : dbObject.foregroundColor,
borderColor: parseInt(dbObject.displayBorder) === 1 ? dbObject.foregroundColor : dbObject.backgroundColor,
reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue, reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue,
reminderUnits: dbObject.reminderUnits, reminderUnits: dbObject.reminderUnits,
fontIconMarkup: '<i class="fa fa-calendar"></i>' fontIconMarkup: '<i class="fa fa-calendar"></i>'
@ -170,7 +180,7 @@ function getIcon(dbObject) {
} }
function calculateTextColor(color) { function calculateTextColor(color) {
if (color === null || color === '') { if (color === null || color === '' || color === undefined) {
return 'black'; return 'black';
} }

@ -78,9 +78,17 @@ $(document).ready(function() {
.tip() .tip()
.css('padding', '0') .css('padding', '0')
.find('.popover-title') .find('.popover-title')
.css('background-color', event.color === '#fff' ? '#f7f7f7' : event.color) .css('background-color', event.backgroundColor)
.addClass('background-volatile'); .addClass('background-volatile');
if (event.textColor === 'AUTO') {
$eventMarkup.addClass('background-volatile');
} else {
$eventMarkup.data('bs.popover').tip().find('.popover-title')
.css('color', event.textColor)
.css('border', 'solid 1px ' + event.borderColor);
}
$eventMarkup.popover('show'); $eventMarkup.popover('show');
refreshBackgroundVolatileItems(); refreshBackgroundVolatileItems();
}, },
@ -116,15 +124,16 @@ function buildEvent(id, dbObject) {
categoryId: dbObject.categoryId, categoryId: dbObject.categoryId,
categoryName: dbObject.categoryName, categoryName: dbObject.categoryName,
className: 'category-' + dbObject.categoryId, className: 'category-' + dbObject.categoryId,
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor, backgroundColor: dbObject.backgroundColor,
textColor: calculateTextColor(dbObject.categoryColor), textColor: dbObject.foregroundColor === 'AUTO' ? calculateTextColor(dbObject.backgroundColor) : dbObject.foregroundColor,
borderColor: parseInt(dbObject.displayBorder) === 1 ? dbObject.foregroundColor : dbObject.backgroundColor,
reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue, reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue,
reminderUnits: dbObject.reminderUnits reminderUnits: dbObject.reminderUnits
}; };
} }
function calculateTextColor(color) { function calculateTextColor(color) {
if (color === null || color === '') { if (color === null || color === '' || color === undefined) {
return 'black'; return 'black';
} }

@ -102,8 +102,16 @@ $(document).ready(function() {
.tip() .tip()
.css('padding', '0') .css('padding', '0')
.find('.popover-title') .find('.popover-title')
.css('background-color', event.color === '#fff' ? '#f7f7f7' : event.color) .css('background-color', event.backgroundColor);
.addClass('background-volatile');
if (event.textColor === 'AUTO') {
$eventMarkup.addClass('background-volatile');
} else {
$eventMarkup.data('bs.popover').tip().find('.popover-title')
.css('color', event.textColor)
.css('border', 'solid 1px ' + event.borderColor);
}
$eventMarkup.popover('show'); $eventMarkup.popover('show');
refreshBackgroundVolatileItems(); refreshBackgroundVolatileItems();
@ -282,7 +290,9 @@ function buildEvent(id, dbObject) {
trackingId: dbObject.trackingId, trackingId: dbObject.trackingId,
start: moment(dbObject.startTime), start: moment(dbObject.startTime),
url: dbObject.url, url: dbObject.url,
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor, backgroundColor: dbObject.backgroundColor,
textColor: dbObject.foregroundColor === 'AUTO' ? calculateTextColor(dbObject.backgroundColor) : dbObject.foregroundColor,
borderColor: parseInt(dbObject.displayBorder) === 1 ? dbObject.foregroundColor : dbObject.backgroundColor,
allDay: true, allDay: true,
type: dbObject.type, type: dbObject.type,
categoryId: dbObject.categoryId, categoryId: dbObject.categoryId,
@ -290,7 +300,6 @@ function buildEvent(id, dbObject) {
className: 'category-' + dbObject.categoryId, className: 'category-' + dbObject.categoryId,
owner: dbObject.owner, owner: dbObject.owner,
priority: dbObject.priority, priority: dbObject.priority,
textColor: calculateTextColor(dbObject.categoryColor),
fontIconMarkup: getIcon(dbObject) fontIconMarkup: getIcon(dbObject)
}; };
} }
@ -299,7 +308,7 @@ function buildEvent(id, dbObject) {
if (dbObject.allDay) { if (dbObject.allDay) {
endTime.add(1, 'days'); endTime.add(1, 'days');
} }
console.log(dbObject);
return { return {
id: id, id: id,
title: dbObject.title, title: dbObject.title,
@ -313,8 +322,9 @@ function buildEvent(id, dbObject) {
categoryId: dbObject.categoryId, categoryId: dbObject.categoryId,
categoryName: dbObject.categoryName, categoryName: dbObject.categoryName,
className: 'category-' + dbObject.categoryId, className: 'category-' + dbObject.categoryId,
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor, backgroundColor: dbObject.backgroundColor,
textColor: calculateTextColor(dbObject.categoryColor), textColor: dbObject.foregroundColor === 'AUTO' ? calculateTextColor(dbObject.backgroundColor) : dbObject.foregroundColor,
borderColor: parseInt(dbObject.displayBorder) === 1 ? dbObject.foregroundColor : dbObject.backgroundColor,
reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue, reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue,
reminderUnits: dbObject.reminderUnits, reminderUnits: dbObject.reminderUnits,
fontIconMarkup: '<i class="fa fa-calendar"></i>' fontIconMarkup: '<i class="fa fa-calendar"></i>'
@ -332,7 +342,7 @@ function getIcon(dbObject) {
} }
function calculateTextColor(color) { function calculateTextColor(color) {
if (color === null || color === '') { if (color === null || color === '' || color === undefined) {
return 'black'; return 'black';
} }

@ -1965,8 +1965,6 @@ $hesklang['attachment_cancel'] = 'Cancel';
$hesklang['attachment_confirm_cancel'] = 'Are you sure you want to cancel this upload?'; $hesklang['attachment_confirm_cancel'] = 'Are you sure you want to cancel this upload?';
$hesklang['attachment_remove'] = 'Remove attachment'; $hesklang['attachment_remove'] = 'Remove attachment';
$hesklang['due_date'] = 'Due Date'; $hesklang['due_date'] = 'Due Date';
$hesklang['category_color'] = 'Color';
$hesklang['category_color_help'] = 'The hex code for the color to be used on the view ticket screen and calendar. Leave blank for no color';
$hesklang['category_updated'] = 'Changes to <i>%s</i> have been saved'; $hesklang['category_updated'] = 'Changes to <i>%s</i> have been saved';
$hesklang['new_event'] = 'New Event'; $hesklang['new_event'] = 'New Event';
$hesklang['create_event'] = 'Create Event'; $hesklang['create_event'] = 'Create Event';
@ -2127,6 +2125,12 @@ $hesklang['customer_view'] = 'Customer View';
$hesklang['admin_panel'] = 'Admin Panel'; $hesklang['admin_panel'] = 'Admin Panel';
$hesklang['manage_custom_nav_elements'] = 'Manage Custom Nav Elements'; $hesklang['manage_custom_nav_elements'] = 'Manage Custom Nav Elements';
$hesklang['can_man_custom_nav'] = 'Can manage custom nav elements'; $hesklang['can_man_custom_nav'] = 'Can manage custom nav elements';
$hesklang['category_background_color'] = 'Background Color';
$hesklang['category_foreground_color'] = 'Foreground Color';
$hesklang['category_background_color_help'] = 'The hex code for the background color to be used on the view ticket screen and calendar.';
$hesklang['category_foreground_color_help'] = 'The hex code for the foreground color to be used on the view ticket and calendar screens. Leave blank for automatic color based on background.';
$hesklang['category_display_border'] = 'Display Border';
$hesklang['category_display_border_help'] = 'Choose to decide whether or not to display a border around the category (uses foreground color). <b>This is ignored if foreground color is set to automatic.</b>';
// DO NOT CHANGE BELOW // DO NOT CHANGE BELOW
if (!defined('IN_SCRIPT')) die('PHP syntax OK!'); if (!defined('IN_SCRIPT')) die('PHP syntax OK!');

Loading…
Cancel
Save