Forum

Error in scp/js/scp...
 
Notifications
Clear all

Error in scp/js/scp.js - Missing closing brackets/braces osTicket (v1.15.4)

2 Posts
2 Users
0 Reactions
19 Views
Posts: 6
Topic starter
(@techdmlmarketing-co-uk)
Member
Joined: 6 years ago

There seems to be an error in scp/js/scp.js. The last 14 lines of this file have been commented out causing the last function to break as it is no longer closed properly:

$(document).on('click.inline-edit', 'a.inline-edit', function(e) {
e.preventDefault();
var url = 'ajax.php/'
+$(this).attr('href').substr(1)
+'?_uid='+new Date().getTime();
var $options = $(this).data('dialog');
$.dialog(url, [201], function (xhr) {
var obj = $.parseJSON(xhr.responseText);
if (obj.id && obj.value) {
$('#field_'+obj.id).html(obj.value);
if (obj.value.includes('Empty'))
$('#field_'+obj.id).addClass('faded');
else
$('#field_'+obj.id).removeClass('faded');
$('#msg-txt').text(obj.msg);
$('div#msg_notice').show();
}
// If Help Topic was set and statuses are returned
if (obj.statuses) {
var reply = $('select[name=reply_status_id]');
var note = $('select[name=note_status_id]');
// Foreach status see if exists, if not appned to options
$.each(obj.statuses, function(key, value) {
var option = $('<option></option>').attr('value', key).text(value);
if (reply)
if (reply.find('option[value='+key+']').length == 0)
reply.append(option);
if (note)
if (note.find('option[value='+key+']').length == 0)
note.append(option.clone());
});
// Hide warning banner
reply.closest('td').find('.warning-banner').hide();
}
}, $options);

return false;

// osta - Load ticket counts in navigation BEFORE hover to prevent "jumping"
// $(document).ready(function() {
// $.ajax({
// url: 'ajax.php/queue/counts',
// dataType: 'json',
// success: function(json) {
// $('li span.queue-count').each(function(i, e) {
// var $e = $(e);
// $e.text(json['q' + $e.data('queueId')]);
// $(e).parents().find('#queue-count-bucket').show();
// });
// }
// });
// });

Uncommenting the last line fixes the problem but have the last 14 lines been commented out in error?

Jeremy


1 Reply
Posts: 1177
Admin
(@stevland)
Member
Joined: 2 months ago

No, the only error is the closing bracket. (That is an old function that is no longer needed).

Please replace

// osta - Load ticket counts in navigation BEFORE hover to prevent "jumping"
// $(document).ready(function() {
// $.ajax({
// url: 'ajax.php/queue/counts',
// dataType: 'json',
// success: function(json) {
// $('li span.queue-count').each(function(i, e) {
// var $e = $(e);
// $e.text(json['q' + $e.data('queueId')]);
// $(e).parents().find('#queue-count-bucket').show();
// });
// }
// });
// });

with

});

Thank you for reporting this!


Reply
Posts: 6
Topic starter
(@techdmlmarketing-co-uk)
Member
Joined: 6 years ago

Thank you I will replace as instructed πŸ™‚

Jeremy


Reply
Share: