Add due date on create ticket screen

merge-requests/1/head
Mike Koch 8 years ago
parent 3707fc52b5
commit a860ba5d40

@ -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;

@ -730,6 +730,15 @@ elseif (hesk_checkPermission('can_man_ticket_tpl', 0)) {
}
?>
<div class="form-group">
<label for="due-date" class="col-sm-3 control-label"><?php echo $hesklang['due_date']; ?></label>
<div class="col-sm-9">
<input class="form-control datepicker" name="due-date" placeholder="<?php echo htmlspecialchars($hesklang['due_date']); ?>"
value="<?php if (isset($_GET['due_date'])) { echo $_GET['due_date']; } ?>">
<span class="help-block"><?php echo $hesklang['date_format']; ?></span>
</div>
</div>
<?php if (in_array('subject', $_SESSION['iserror'])) {
echo '<div class="form-group has-error">';
} else {

@ -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

@ -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) ";

@ -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);

Loading…
Cancel
Save