[Resolved] Error in scp/js/scp.js – Missing closing brackets/braces osTicket (v1.15.4)

    • October 12, 2021 at 6:27 am #8438

      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

    • October 12, 2021 at 6:52 am #8440
      stevland
      Keymaster

      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!

    • October 12, 2021 at 6:53 am #8442

      Thank you I will replace as instructed 🙂

      Jeremy

You must be logged in to reply to this topic.

Topic Tags