Fix changing ticket due date

master^2
Mike Koch 6 years ago
parent 352b3a9f37
commit ed04663d08
No known key found for this signature in database
GPG Key ID: 9BA5D7F8391455ED

@ -10,6 +10,7 @@ use BusinessLogic\Tickets\TicketDeleter;
use BusinessLogic\Tickets\TicketEditor; use BusinessLogic\Tickets\TicketEditor;
use BusinessLogic\Tickets\TicketRetriever; use BusinessLogic\Tickets\TicketRetriever;
use Controllers\JsonRetriever; use Controllers\JsonRetriever;
use Symfony\Component\Console\Helper\Helper;
class StaffTicketController extends \BaseClass { class StaffTicketController extends \BaseClass {
function get($id) { function get($id) {
@ -55,7 +56,14 @@ class StaffTicketController extends \BaseClass {
$json = JsonRetriever::getJsonData(); $json = JsonRetriever::getJsonData();
$dueDate = date('Y-m-d H:i:s', strtotime(Helpers::safeArrayGet($json, 'dueDate'))); $newDueDate = Helpers::safeArrayGet($json, 'dueDate');
if ($newDueDate !== null) {
$dueDate = date('Y-m-d H:i:s', strtotime(Helpers::safeArrayGet($json, 'dueDate')));
} else {
$dueDate = null;
}
$ticketEditor->updateDueDate($id, $dueDate, $userContext, $hesk_settings); $ticketEditor->updateDueDate($id, $dueDate, $userContext, $hesk_settings);
} }

@ -20,14 +20,17 @@ $(document).ready(function() {
$editableDueDateContainer.find('#submit').click(function() { $editableDueDateContainer.find('#submit').click(function() {
var newDueDate = $editableDueDateContainer.find('input[type="text"][name="due-date"]').val(); var newDueDate = $editableDueDateContainer.find('input[type="text"][name="due-date"]').val();
var ticketId = $('input[type="hidden"][name="orig_id"]').val();
$.ajax({ $.ajax({
method: 'POST', method: 'POST',
url: heskPath + 'internal-api/admin/calendar/', url: heskPath + 'api/v1/staff/tickets/' + ticketId + '/due-date',
data: { headers: {
trackingId: $('input[type="hidden"][name="track"]').val(), 'X-Internal-Call': true,
action: 'update-ticket', 'X-HTTP-Method-Override': 'PATCH'
dueDate: newDueDate
}, },
data: JSON.stringify({
dueDate: newDueDate === '' ? null : newDueDate
}),
success: function() { success: function() {
mfhAlert.success(mfhLang.text('ticket_due_date_updated')); mfhAlert.success(mfhLang.text('ticket_due_date_updated'));
$readonlyDueDateContainer.find('span#due-date').text(newDueDate == '' ? $('#lang_none').text() : newDueDate); $readonlyDueDateContainer.find('span#due-date').text(newDueDate == '' ? $('#lang_none').text() : newDueDate);

Loading…
Cancel
Save