diff --git a/admin/admin_submit_ticket.php b/admin/admin_submit_ticket.php
index 05937433..0dac720b 100644
--- a/admin/admin_submit_ticket.php
+++ b/admin/admin_submit_ticket.php
@@ -244,6 +244,7 @@ $tmpvar['latitude'] = hesk_POST('latitude', 'E-4');
$tmpvar['longitude'] = hesk_POST('longitude', 'E-4');
$tmpvar['html'] = $modsForHesk_settings['rich_text_for_tickets'];
+$tmpvar['due_date'] = hesk_POST('due-date');
// Set user agent and screen res to null
$tmpvar['user_agent'] = NULL;
diff --git a/admin/new_ticket.php b/admin/new_ticket.php
index ddedc474..4d990d4a 100644
--- a/admin/new_ticket.php
+++ b/admin/new_ticket.php
@@ -730,6 +730,15 @@ elseif (hesk_checkPermission('can_man_ticket_tpl', 0)) {
}
?>
+
+
';
} else {
diff --git a/inc/posting_functions.inc.php b/inc/posting_functions.inc.php
index 1c13b245..25d40e04 100644
--- a/inc/posting_functions.inc.php
+++ b/inc/posting_functions.inc.php
@@ -54,6 +54,11 @@ function hesk_newTicket($ticket, $isVerified = true)
$ticket['message'] = htmLawed($ticket['message'], array('safe' => 1, 'deny_attribute' => 'style'));
+ $due_date = 'NULL';
+ if ($ticket['due_date'] != '') {
+ $due_date = "'" . hesk_dbEscape($ticket['due_date']) . "'";
+ }
+
// Insert ticket into database
hesk_dbQuery("
INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . $tableName . "`
@@ -101,7 +106,8 @@ function hesk_newTicket($ticket, $isVerified = true)
`html`,
`user_agent`,
`screen_resolution_height`,
- `screen_resolution_width`
+ `screen_resolution_width`,
+ `due_date`
)
VALUES
(
@@ -148,7 +154,8 @@ function hesk_newTicket($ticket, $isVerified = true)
'" . hesk_dbEscape($ticket['html']) . "',
'" . hesk_dbEscape($ticket['user_agent']) . "',
" . hesk_dbEscape($ticket['screen_resolution_height']) . ",
- " . hesk_dbEscape($ticket['screen_resolution_width']) . "
+ " . hesk_dbEscape($ticket['screen_resolution_width']) . ",
+ {$due_date}
)
");
@@ -169,7 +176,8 @@ function hesk_newTicket($ticket, $isVerified = true)
'lastchange' => hesk_date(),
'id' => hesk_dbInsertID(),
'language' => $language,
- 'html' => $ticket['html']
+ 'html' => $ticket['html'],
+ 'due_date' => $ticket['due_date']
);
// Add custom fields to the array
diff --git a/internal-api/dao/calendar_dao.php b/internal-api/dao/calendar_dao.php
index 3c30f839..72897f01 100644
--- a/internal-api/dao/calendar_dao.php
+++ b/internal-api/dao/calendar_dao.php
@@ -52,6 +52,7 @@ function get_events($start, $end, $hesk_settings, $staff = true) {
FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` AS `tickets`
INNER JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` AS `categories`
ON `categories`.`id` = `tickets`.`category`
+ AND `categories`.`usage` <> 1
WHERE `due_date` >= FROM_UNIXTIME(" . intval($start) . " / 1000)
AND `due_date` <= FROM_UNIXTIME(" . intval($end) . " / 1000)
AND `status` IN (SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` WHERE `IsClosed` = 0) ";
diff --git a/js/calendar/mods-for-hesk-calendar.js b/js/calendar/mods-for-hesk-calendar.js
index d2236857..b80ebf9c 100644
--- a/js/calendar/mods-for-hesk-calendar.js
+++ b/js/calendar/mods-for-hesk-calendar.js
@@ -359,6 +359,7 @@ function displayEditModal(date) {
}
createTicketLink += encodeURI('&message=' + date.comments);
createTicketLink += encodeURI('&category=' + date.categoryId);
+ createTicketLink += encodeURI('&due_date=' + date.end.format('YYYY-MM-DD'));
$form.find('#create-ticket-button').prop('href', createTicketLink);