YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Vtiger/resources/Edit.js

Summary

Maintainability
F
3 wks
Test Coverage

File Edit.js has 1608 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*+***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
Severity: Major
Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 4 days to fix

    `` has 61 functions (exceeds 20 allowed). Consider refactoring.
    Open

        {
            formElement: false,
            relationOperation: '',
            moduleName: app.getModuleName(),
            getForm: function () {
    Severity: Major
    Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 day to fix

      Function registerAutoloadAddress has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              registerAutoloadAddress: function () {
                  const self = this;
                  this.getForm()
                      .find('.js-search-address')
                      .each(function (_index, e) {
      Severity: Major
      Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 3 hrs to fix

        Function copyAddress has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

                copyAddress: function (fromLabel, toLabel, relatedRecord, sourceModule) {
                    const thisInstance = this;
                    let formElement = this.getForm(),
                        status = false,
                        addressMapping = this.addressFieldsMapping,
        Severity: Minor
        Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function preSaveValidation has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                preSaveValidation: function (form) {
                    const aDeferred = $.Deferred();
                    if (form.find('#preSaveValidation').val()) {
                        document.progressLoader = $.progressIndicator({
                            message: app.vtranslate('JS_SAVE_LOADER_INFO'),
        Severity: Major
        Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 3 hrs to fix

          Function setReferenceFieldValue has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  setReferenceFieldValue: function (container, params) {
                      const thisInstance = this;
                      let sourceFieldElement = container.find('input.sourceField');
                      let sourceField = sourceFieldElement.attr('name');
                      let fieldElement = container.find('input[name="' + sourceField + '"]');
          Severity: Major
          Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 3 hrs to fix

            Function getRecordsListParams has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    getRecordsListParams: function (container) {
                        let formElement = container.closest('form');
                        let sourceModule = $('input[name="module"]', formElement).val();
                        let popupReferenceModule = $('input[name="popupReferenceModule"]', container).val();
                        let sourceFieldElement = $('input[class="sourceField"]', container);
            Severity: Major
            Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 2 hrs to fix

              Function saveAjaxValidation has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      saveAjaxValidation: function (params) {
                          const aDeferred = $.Deferred();
                          if (this.getInstance().checkPreSaveValidation()) {
                              let paramsTemp = JSON.parse(JSON.stringify(params));
                              paramsTemp.data.mode = 'preSaveValidation';
              Severity: Major
              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 2 hrs to fix

                Function registerEventForCopyAddress has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        registerEventForCopyAddress: function () {
                            let thisInstance = this;
                            this.formElement
                                .find(
                                    '.js-toggle-panel:not(.inventoryHeader):not(.inventoryItems) .fieldValue, .js-toggle-panel:not(.inventoryHeader):not(.inventoryItems) .fieldLabel'
                Severity: Major
                Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 2 hrs to fix

                  Function registerAutoCompleteFields has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          registerAutoCompleteFields: function (container) {
                              let thisInstance = this;
                              let formElement = container.closest('form');
                              container.find('input.autoComplete').autocomplete({
                                  delay: '600',
                  Severity: Major
                  Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 2 hrs to fix

                    Function checkReferencesField has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            checkReferencesField: function (container, clear) {
                                let thisInstance = this;
                                let activeProcess = false,
                                    activeSubProcess = false;
                                if (!CONFIG.fieldsReferencesDependent) {
                    Severity: Major
                    Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 2 hrs to fix

                      Function copyAddress has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              copyAddress: function (fromLabel, toLabel, relatedRecord, sourceModule) {
                                  const thisInstance = this;
                                  let formElement = this.getForm(),
                                      status = false,
                                      addressMapping = this.addressFieldsMapping,
                      Severity: Major
                      Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 2 hrs to fix

                        Function saveAjax has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                saveAjax: function (params, progressIndicator = false) {
                                    const aDeferred = $.Deferred();
                                    if (typeof params === 'undefined' || $.isEmptyObject(params)) {
                                        aDeferred.reject();
                                        return aDeferred.promise();
                        Severity: Major
                        Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 2 hrs to fix

                          Function registerRecordCollectorModal has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  registerRecordCollectorModal: function (container) {
                                      const self = this;
                                      container.on('click', '.js-record-collector-modal', function (e) {
                                          e.preventDefault();
                                          let element = $(this);
                          Severity: Major
                          Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 2 hrs to fix

                            Function mapAddressDetails has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                                    mapAddressDetails: function (result, container) {
                                        for (let key in result) {
                                            if (key.indexOf('addresslevel') != -1) {
                                                if (container.find('[name="' + key + '"]').length != 0) {
                                                    container.find('[name="' + key + '"]').val(result['data'][key]);
                            Severity: Minor
                            Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Function mapAddressDetails has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    mapAddressDetails: function (result, container) {
                                        for (let key in result) {
                                            if (key.indexOf('addresslevel') != -1) {
                                                if (container.find('[name="' + key + '"]').length != 0) {
                                                    container.find('[name="' + key + '"]').val(result['data'][key]);
                            Severity: Minor
                            Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                              Function setFieldOptions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                                      setFieldOptions: function (fieldName, options) {
                                          const fieldElement = this.getForm().find(`[name="${fieldName}"]`),
                                              fieldInfo = fieldElement.data('fieldinfo');
                                          if (fieldElement.is('select') && fieldInfo) {
                                              const val = fieldElement.val() ?? '',
                              Severity: Minor
                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Function select has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                                          select: function (_event, ui) {
                                                              $.each(ui.item.address, function (index, value) {
                                                                  let field = container.find('.fieldValue [name^=' + index + ']');
                                                                  if (field.length && value) {
                                                                      if (typeof value !== 'object') {
                              Severity: Minor
                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                Function clearFieldValue has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        clearFieldValue: function (element) {
                                            const self = this;
                                            let fieldValueContener = element.closest('.fieldValue');
                                            let fieldNameElement = fieldValueContener.find('.sourceField');
                                            let fieldName = fieldNameElement.attr('name');
                                Severity: Minor
                                Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                  Function registerFocusFirstField has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          registerFocusFirstField: function (container, afterTimeout) {
                                              let elementToFocus, elementToFocusTabindex;
                                              if (afterTimeout === undefined && container.closest('.js-modal-container').length) {
                                                  setTimeout((_) => {
                                                      this.registerFocusFirstField(container, true);
                                  Severity: Minor
                                  Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                    Function setFieldOptions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            setFieldOptions: function (fieldName, options) {
                                                const fieldElement = this.getForm().find(`[name="${fieldName}"]`),
                                                    fieldInfo = fieldElement.data('fieldinfo');
                                                if (fieldElement.is('select') && fieldInfo) {
                                                    const val = fieldElement.val() ?? '',
                                    Severity: Minor
                                    Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                      Function registerEventForCopyBlockAddress has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                              registerEventForCopyBlockAddress: function (moduleName, fieldName) {
                                                  const self = this;
                                                  if (moduleName == 'Accounts') {
                                                      self.enableCopyAddressFromModule(
                                                          moduleName,
                                      Severity: Minor
                                      Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                        Function triggerRecordEditEvents has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                                triggerRecordEditEvents: function (data) {
                                                    const self = this,
                                                        form = this.getForm();
                                                    if (typeof data['changeValues'] == 'object') {
                                                        $.each(data['changeValues'], function (_, field) {
                                        Severity: Minor
                                        Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                          Function getRecordsListParams has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                                  getRecordsListParams: function (container) {
                                                      let formElement = container.closest('form');
                                                      let sourceModule = $('input[name="module"]', formElement).val();
                                                      let popupReferenceModule = $('input[name="popupReferenceModule"]', container).val();
                                                      let sourceFieldElement = $('input[class="sourceField"]', container);
                                          Severity: Minor
                                          Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

                                          Function registerKeyboardShortcutsEvent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                                  registerKeyboardShortcutsEvent: function () {
                                                      document.addEventListener('keydown', (event) => {
                                                          if (event.shiftKey && event.ctrlKey && event.code === 'KeyS') {
                                                              let form = event.target.closest('form');
                                                              if (form) {
                                          Severity: Minor
                                          Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

                                          Function registerBasicEvents has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                  registerBasicEvents: function (container) {
                                                      this.registerEventForEditor();
                                                      this.stretchCKEditor();
                                                      this.referenceModulePopupRegisterEvent(container);
                                                      this.registerAutoCompleteFields(container);
                                          Severity: Minor
                                          Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                            Function registerBlockStatusCheckOnLoad has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                    registerBlockStatusCheckOnLoad: function () {
                                                        let blocks = this.getForm().find('.js-toggle-panel');
                                                        let module = this.moduleName;
                                                        blocks.each(function (index, block) {
                                                            let currentBlock = $(block);
                                            Severity: Minor
                                            Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                              Function registerSubmitEvent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                      registerSubmitEvent: function () {
                                                          let editViewForm = this.getForm();
                                                          editViewForm.on('submit', function (e) {
                                                              //Form should submit only once for multiple clicks also
                                                              if (typeof editViewForm.data('submit') !== 'undefined') {
                                              Severity: Minor
                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                                Function registerAccountName has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                        registerAccountName: function (container) {
                                                            let first = container.find('.js-first-name');
                                                            let firstInput = first.find('input');
                                                            let last = container.find('.js-last-name');
                                                            let lastInput = last.find('input');
                                                Severity: Minor
                                                Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                                  Function source has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                                  source: function (request, response) {
                                                                      //element will be array of dom elements
                                                                      //here this refers to auto complete instance
                                                                      let inputElement = $(this.element[0]);
                                                                      let searchValue = request.term;
                                                  Severity: Minor
                                                  Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                                    Function enableCopyAddressFromModule has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                            enableCopyAddressFromModule: function (moduleName, formElement, className, fieldName, label) {
                                                                let thisInstance = this;
                                                                formElement
                                                                    .find('.' + className)
                                                                    .removeClass('d-none')
                                                    Severity: Minor
                                                    Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                                      Function getInstanceByModuleName has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                              getInstanceByModuleName: function (moduleName) {
                                                                  if (typeof moduleName === 'undefined') {
                                                                      moduleName = app.getModuleName();
                                                                  }
                                                                  let parentModule = app.getParentModuleName(),
                                                      Severity: Minor
                                                      Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                                        Function source has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                                                    source: function (request, response) {
                                                                                        AppConnector.request({
                                                                                            module: self.moduleName,
                                                                                            action: 'Fields',
                                                                                            mode: 'findAddress',
                                                        Severity: Minor
                                                        Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                                          Function registerReferenceFields has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                                  registerReferenceFields: function (container) {
                                                                      let thisInstance = this;
                                                                      if (!CONFIG.fieldsReferencesDependent) {
                                                                          return false;
                                                                      }
                                                          Severity: Minor
                                                          Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 1 hr to fix

                                                            Function getInstanceByModuleName has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                    getInstanceByModuleName: function (moduleName) {
                                                                        if (typeof moduleName === 'undefined') {
                                                                            moduleName = app.getModuleName();
                                                                        }
                                                                        let parentModule = app.getParentModuleName(),
                                                            Severity: Minor
                                                            Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 55 mins to fix

                                                            Cognitive Complexity

                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                            A method's cognitive complexity is based on a few simple rules:

                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                            Further reading

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                                            } else if (
                                                                                                typeof response[i].showModal !== 'undefined' &&
                                                                                                typeof response[i].showModal.url !== 'undefined'
                                                                                            ) {
                                                                                                app.showModalWindow(null, response[i].showModal.url, function (modalContainer) {
                                                            Severity: Major
                                                            Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                                                  if (referenceModulesList.length > 0 && value[1]) {
                                                                                                      referenceModulesList.val(value[1]).trigger('change');
                                                                                                  }
                                                              Severity: Major
                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 45 mins to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

                                                                                                } else if (
                                                                                                    typeof response[i].showModal !== 'undefined' &&
                                                                                                    typeof response[i].showModal.url !== 'undefined'
                                                                                                ) {
                                                                                                    app.showModalWindow(null, response[i].showModal.url, function (modalContainer) {
                                                                Severity: Major
                                                                Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 45 mins to fix

                                                                  Avoid deeply nested control flow statements.
                                                                  Open

                                                                                                              if (handlerElement.length) {
                                                                                                                  handlers = JSON.parse(handlerElement.val());
                                                                                                                  handlerElement.remove();
                                                                                                              }
                                                                  Severity: Major
                                                                  Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 45 mins to fix

                                                                    Avoid deeply nested control flow statements.
                                                                    Open

                                                                                                        if (typeof multipleAttr !== 'undefined' && multipleAttr !== false && splitValues.length > 0) {
                                                                                                            mapFieldElementMultiselect.val(splitValues).trigger('change');
                                                                                                        }
                                                                    Severity: Major
                                                                    Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 45 mins to fix

                                                                      Avoid deeply nested control flow statements.
                                                                      Open

                                                                                                  } else if (mapFieldElement.length == 0) {
                                                                                                      $("<input type='hidden'/>").attr('name', key).attr('value', response[value[0]]).appendTo(formElement);
                                                                                                  } else {
                                                                                                      mapFieldElement.val(response[value[0]]);
                                                                                                  }
                                                                      Severity: Major
                                                                      Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 45 mins to fix

                                                                        Avoid deeply nested control flow statements.
                                                                        Open

                                                                                                        if (mapFieldElement.find('option[value="' + response[value[0]] + '"]').length) {
                                                                                                            mapFieldElement.val(response[value[0]]).trigger('change');
                                                                                                        } else if (mapFieldElement.data('fieldinfo').picklistvalues.hasOwnProperty(response[value[0]])) {
                                                                                                            let newOption = new Option(response[value[0]], response[value[0]], true, true);
                                                                                                            mapFieldElement.append(newOption).trigger('change');
                                                                        Severity: Major
                                                                        Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 45 mins to fix

                                                                          Avoid deeply nested control flow statements.
                                                                          Open

                                                                                                                      if (typeof params.data.skipHandlers !== 'undefined') {
                                                                                                                          handlers = JSON.parse(params.data.skipHandlers);
                                                                                                                      }
                                                                          Severity: Major
                                                                          Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 45 mins to fix

                                                                            Function enableCopyAddressFromModule has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                            Open

                                                                                    enableCopyAddressFromModule: function (moduleName, formElement, className, fieldName, label) {
                                                                            Severity: Minor
                                                                            Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 35 mins to fix

                                                                              Function triggerRecordEditEvents has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                              Open

                                                                                      triggerRecordEditEvents: function (data) {
                                                                                          const self = this,
                                                                                              form = this.getForm();
                                                                                          if (typeof data['changeValues'] == 'object') {
                                                                                              $.each(data['changeValues'], function (_, field) {
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 35 mins to fix

                                                                              Cognitive Complexity

                                                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                              A method's cognitive complexity is based on a few simple rules:

                                                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                              • Code is considered more complex for each "break in the linear flow of the code"
                                                                              • Code is considered more complex when "flow breaking structures are nested"

                                                                              Further reading

                                                                              Function setFieldValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                              Open

                                                                                      setFieldValue: function (params) {
                                                                                          const fieldElement = this.getForm().find(`[name="${params['fieldName']}"]`),
                                                                                              fieldInfo = fieldElement.data('fieldinfo');
                                                                                          if (fieldElement.is('select')) {
                                                                                              if (fieldElement.find(`option[value="${params['value']}"]`).length) {
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 35 mins to fix

                                                                              Cognitive Complexity

                                                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                              A method's cognitive complexity is based on a few simple rules:

                                                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                              • Code is considered more complex for each "break in the linear flow of the code"
                                                                              • Code is considered more complex when "flow breaking structures are nested"

                                                                              Further reading

                                                                              Function checkVisibilityBlocks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                              Open

                                                                                      checkVisibilityBlocks: function () {
                                                                                          this.getForm()
                                                                                              .find('.js-toggle-panel')
                                                                                              .each(function (index, block) {
                                                                                                  let currentBlock = $(block);
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 25 mins to fix

                                                                              Cognitive Complexity

                                                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                              A method's cognitive complexity is based on a few simple rules:

                                                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                              • Code is considered more complex for each "break in the linear flow of the code"
                                                                              • Code is considered more complex when "flow breaking structures are nested"

                                                                              Further reading

                                                                              Function saveAjax has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                              Open

                                                                                      saveAjax: function (params, progressIndicator = false) {
                                                                                          const aDeferred = $.Deferred();
                                                                                          if (typeof params === 'undefined' || $.isEmptyObject(params)) {
                                                                                              aDeferred.reject();
                                                                                              return aDeferred.promise();
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 25 mins to fix

                                                                              Cognitive Complexity

                                                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                              A method's cognitive complexity is based on a few simple rules:

                                                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                              • Code is considered more complex for each "break in the linear flow of the code"
                                                                              • Code is considered more complex when "flow breaking structures are nested"

                                                                              Further reading

                                                                              Function registerAutoCompleteFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                              Open

                                                                                      registerAutoCompleteFields: function (container) {
                                                                                          let thisInstance = this;
                                                                                          let formElement = container.closest('form');
                                                                                          container.find('input.autoComplete').autocomplete({
                                                                                              delay: '600',
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js - About 25 mins to fix

                                                                              Cognitive Complexity

                                                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                              A method's cognitive complexity is based on a few simple rules:

                                                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                              • Code is considered more complex for each "break in the linear flow of the code"
                                                                              • Code is considered more complex when "flow breaking structures are nested"

                                                                              Further reading

                                                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                                                              Open

                                                                                                  if (
                                                                                                      container.find('[name="' + key + 'c"]').length != 0 &&
                                                                                                      container.find('[name="' + key + 'c"]').val() == 0 &&
                                                                                                      result['data'][key] != 0
                                                                                                  ) {
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 2 other locations - About 1 day to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 878..887
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 888..897

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 204.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                                                              Open

                                                                                                  if (
                                                                                                      container.find('[name="' + key + 'a"]').length != 0 &&
                                                                                                      container.find('[name="' + key + 'a"]').val() == 0 &&
                                                                                                      result['data'][key] != 0
                                                                                                  ) {
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 2 other locations - About 1 day to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 888..897
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 898..907

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 204.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                                                              Open

                                                                                                  if (
                                                                                                      container.find('[name="' + key + 'b"]').length != 0 &&
                                                                                                      container.find('[name="' + key + 'b"]').val() == 0 &&
                                                                                                      result['data'][key] != 0
                                                                                                  ) {
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 2 other locations - About 1 day to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 878..887
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 898..907

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 204.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                                              if (response[i].type === 'confirm' && typeof response[i].hash !== 'undefined') {
                                                                                                                  app.showConfirmModal({
                                                                                                                      text: response[i].message || '',
                                                                                                                      confirmedCallback: () => {
                                                                                                                          let handlers = {};
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 6 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 987..1020

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 162.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                                              if (response[i].type === 'confirm' && typeof response[i].hash !== 'undefined') {
                                                                                                                  app.showConfirmModal({
                                                                                                                      text: response[i].message || '',
                                                                                                                      confirmedCallback: () => {
                                                                                                                          let handlers = {},
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 6 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 148..182

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 162.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                          if (
                                                                                              listFilterFields[sourceField] != undefined &&
                                                                                              listFilterFields[sourceField][popupReferenceModule] != undefined
                                                                                          ) {
                                                                                              $.each(listFilterFields[sourceField][popupReferenceModule], function (index, value) {
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 4 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 240..250

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 125.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                          if (
                                                                                              mappingRelatedModule[sourceField] != undefined &&
                                                                                              mappingRelatedModule[sourceField][popupReferenceModule] != undefined
                                                                                          ) {
                                                                                              $.each(mappingRelatedModule[sourceField][popupReferenceModule], function (index, value) {
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 4 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 253..263

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 125.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                          if (parentModule === 'Settings') {
                                                                                              moduleClassName = parentModule + '_' + moduleName + '_Edit_Js';
                                                                                              if (typeof window[moduleClassName] === 'undefined') {
                                                                                                  moduleClassName = moduleName + '_Edit_Js';
                                                                                              }
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 4 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/List.js on lines 25..37

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 115.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                                              AppConnector.request({
                                                                                                                  module: self.moduleName,
                                                                                                                  action: 'Fields',
                                                                                                                  mode: 'findAddress',
                                                                                                                  type: search.find('.js-select-operator').val(),
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 3 hrs to fix
                                                                              public_html/layouts/basic/modules/OpenStreetMap/resources/Map.js on lines 341..359

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 112.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                                  if (value != null) {
                                                                                                      if (value == 1) {
                                                                                                          headerAnimationElement.addClass('d-none');
                                                                                                          currentBlock.find("[data-mode='show']").removeClass('d-none');
                                                                                                          bodyContents.removeClass('d-none');
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 3 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Detail.js on lines 1009..1019

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 108.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                                                              Open

                                                                                          this.formElement.find('.copyAddressFromDelivery').on('click', function (e) {
                                                                                              let element = $(this);
                                                                                              let block = element.closest('.js-toggle-panel');
                                                                                              let from = element.data('label');
                                                                                              let to = block.data('label');
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 2 other locations - About 3 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 689..695
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 696..702

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 100.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                                                              Open

                                                                                          this.formElement.find('.copyAddressFromMain').on('click', function (e) {
                                                                                              let element = $(this);
                                                                                              let block = element.closest('.js-toggle-panel');
                                                                                              let from = element.data('label');
                                                                                              let to = block.data('label');
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 2 other locations - About 3 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 696..702
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 703..709

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 100.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 3 locations. Consider refactoring.
                                                                              Open

                                                                                          this.formElement.find('.copyAddressFromMailing').on('click', function (e) {
                                                                                              let element = $(this);
                                                                                              let block = element.closest('.js-toggle-panel');
                                                                                              let from = element.data('label');
                                                                                              let to = block.data('label');
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 2 other locations - About 3 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 689..695
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 703..709

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 100.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                          } else {
                                                                                              let initialFormData = form.serialize();
                                                                                              window.onbeforeunload = function (e) {
                                                                                                  if (initialFormData != form.serialize() && form.data('submit') != 'true') {
                                                                                                      return app.vtranslate('JS_CHANGES_WILL_BE_LOST');
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 2 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 1049..1056

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 79.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                              CKEDITOR.on('instanceReady', function (e) {
                                                                                                  let initialFormData = form.serialize();
                                                                                                  window.onbeforeunload = function (e) {
                                                                                                      if (initialFormData != form.serialize() && form.data('submit') != 'true') {
                                                                                                          return app.vtranslate('JS_CHANGES_WILL_BE_LOST');
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 2 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 1057..1064

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 79.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                          if (typeof data['hideFields'] != 'undefined') {
                                                                                              $.each(data['hideFields'], function (_, fieldName) {
                                                                                                  form.find(`.js-field-block-column[data-field="${fieldName}"]`).addClass('d-none');
                                                                                                  self.checkVisibilityBlocks();
                                                                                              });
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 2 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 1554..1559

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 78.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                          if (typeof data['showFields'] != 'undefined') {
                                                                                              $.each(data['showFields'], function (_, fieldName) {
                                                                                                  form.find(`.js-field-block-column[data-field="${fieldName}"]`).removeClass('d-none');
                                                                                                  self.checkVisibilityBlocks();
                                                                                              });
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 2 hrs to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 1560..1565

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 78.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                          AppConnector.request(params)
                                                                                              .done(function (data) {
                                                                                                  aDeferred.resolve(data);
                                                                                              })
                                                                                              .fail(function (error) {
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 1 hr to fix
                                                                              public_html/layouts/basic/modules/Settings/Menu/resources/Menu.js on lines 118..124

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 60.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                              if (element.closest('.tab-pane').length > 0) {
                                                                                                  t = false;
                                                                                                  if (element.closest('.tab-pane.active').length > 0) {
                                                                                                      t = true;
                                                                                                  }
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 1 hr to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 1303..1308

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 60.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                              if (element.closest('.tab-pane').length > 0) {
                                                                                                  t = false;
                                                                                                  if (element.closest('.tab-pane.active').length > 0) {
                                                                                                      t = true;
                                                                                                  }
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 1 hr to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 1280..1285

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 60.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                          container.on('click', '.createReferenceRecord', function (e) {
                                                                                              let element = $(e.currentTarget);
                                                                                              let controlElementDiv = element.closest('.fieldValue');
                                                                                              thisInstance.referenceCreateHandler(controlElementDiv);
                                                                                          });
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 1 hr to fix
                                                                              public_html/layouts/basic/modules/Settings/LayoutEditor/resources/LayoutEditor.js on lines 139..143

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 60.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                      registerHelpInfo: function (form) {
                                                                                          if (!form) {
                                                                                              form = this.getForm();
                                                                                          }
                                                                                          app.showPopoverElementView(form.find('.js-help-info'));
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 55 mins to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Detail.js on lines 1917..1922

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 53.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                                  input
                                                                                                      .autocomplete({
                                                                                                          source: function (request, response) {
                                                                                                              AppConnector.request({
                                                                                                                  module: self.moduleName,
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 55 mins to fix
                                                                              public_html/layouts/basic/modules/OpenStreetMap/resources/Map.js on lines 336..392

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 53.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 9 locations. Consider refactoring.
                                                                              Open

                                                                                                  document.progressLoader = $.progressIndicator({
                                                                                                      message: app.vtranslate('JS_SAVE_LOADER_INFO'),
                                                                                                      position: 'html',
                                                                                                      blockInfo: {
                                                                                                          enabled: true
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 8 other locations - About 40 mins to fix
                                                                              public_html/layouts/basic/modules/Settings/AutomaticAssignment/resources/Edit.js on lines 53..59
                                                                              public_html/layouts/basic/modules/Settings/Groups/resources/Edit.js on lines 30..34
                                                                              public_html/layouts/basic/modules/Users/resources/SwitchUsers.js on lines 35..41
                                                                              public_html/layouts/basic/modules/Users/resources/SwitchUsers.js on lines 49..55
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 95..101
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 965..971
                                                                              public_html/layouts/basic/modules/Vtiger/resources/GenerateModal.js on lines 11..17
                                                                              public_html/layouts/basic/modules/Vtiger/resources/PDF.js on lines 52..58

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 49.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 9 locations. Consider refactoring.
                                                                              Open

                                                                                              document.progressLoader = $.progressIndicator({
                                                                                                  message: app.vtranslate('JS_SAVE_LOADER_INFO'),
                                                                                                  position: 'html',
                                                                                                  blockInfo: {
                                                                                                      enabled: true
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 8 other locations - About 40 mins to fix
                                                                              public_html/layouts/basic/modules/Settings/AutomaticAssignment/resources/Edit.js on lines 53..59
                                                                              public_html/layouts/basic/modules/Settings/Groups/resources/Edit.js on lines 30..34
                                                                              public_html/layouts/basic/modules/Users/resources/SwitchUsers.js on lines 35..41
                                                                              public_html/layouts/basic/modules/Users/resources/SwitchUsers.js on lines 49..55
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 95..101
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 921..927
                                                                              public_html/layouts/basic/modules/Vtiger/resources/GenerateModal.js on lines 11..17
                                                                              public_html/layouts/basic/modules/Vtiger/resources/PDF.js on lines 52..58

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 49.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 9 locations. Consider refactoring.
                                                                              Open

                                                                                              document.progressLoader = $.progressIndicator({
                                                                                                  message: app.vtranslate('JS_SAVE_LOADER_INFO'),
                                                                                                  position: 'html',
                                                                                                  blockInfo: {
                                                                                                      enabled: true
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 8 other locations - About 40 mins to fix
                                                                              public_html/layouts/basic/modules/Settings/AutomaticAssignment/resources/Edit.js on lines 53..59
                                                                              public_html/layouts/basic/modules/Settings/Groups/resources/Edit.js on lines 30..34
                                                                              public_html/layouts/basic/modules/Users/resources/SwitchUsers.js on lines 35..41
                                                                              public_html/layouts/basic/modules/Users/resources/SwitchUsers.js on lines 49..55
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 921..927
                                                                              public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 965..971
                                                                              public_html/layouts/basic/modules/Vtiger/resources/GenerateModal.js on lines 11..17
                                                                              public_html/layouts/basic/modules/Vtiger/resources/PDF.js on lines 52..58

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 49.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                          if (typeof window[moduleClassName] !== 'undefined') {
                                                                                              instance = new window[moduleClassName]();
                                                                                          } else {
                                                                                              instance = new window[fallbackClassName]();
                                                                                          }
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 40 mins to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/List.js on lines 38..42

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 49.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                          form.on(Vtiger_Edit_Js.recordPreSave, (e, data) => {
                                                                                              this.preSaveValidation(form).done((response) => {
                                                                                                  if (response !== true) {
                                                                                                      e.preventDefault();
                                                                                                  }
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 40 mins to fix
                                                                              public_html/layouts/basic/modules/HelpDesk/resources/Edit.js on lines 15..21

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 49.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                              if (sourceModule === 'Accounts') {
                                                                                                  errorMsg = 'JS_SELECTED_ACCOUNT_DOES_NOT_HAVE_AN_ADDRESS';
                                                                                              } else if (sourceModule === 'Contacts') {
                                                                                                  errorMsg = 'JS_SELECTED_CONTACT_DOES_NOT_HAVE_AN_ADDRESS';
                                                                                              } else {
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 40 mins to fix
                                                                              public_html/layouts/basic/modules/Vtiger/resources/dashboards/Widget.js on lines 2648..2654

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 48.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Similar blocks of code found in 4 locations. Consider refactoring.
                                                                              Open

                                                                                      getForm: function () {
                                                                                          if (this.formElement == false) {
                                                                                              this.setForm($('#EditView'));
                                                                                          }
                                                                                          return this.formElement;
                                                                              Severity: Major
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 3 other locations - About 35 mins to fix
                                                                              public_html/layouts/basic/modules/Settings/CustomView/resources/FilterPermissions.js on lines 90..95
                                                                              public_html/layouts/basic/modules/Settings/Vtiger/resources/EditModal.js on lines 8..13
                                                                              public_html/layouts/basic/modules/Settings/WebserviceUsers/resources/Edit.js on lines 8..13

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 47.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                              Open

                                                                                              open: function (event, ui) {
                                                                                                  //To Make the menu come up in the case of quick create
                                                                                                  $(this).data('ui-autocomplete').menu.element.css('z-index', '100001');
                                                                                              },
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 35 mins to fix
                                                                              public_html/layouts/resources/Fields.js on lines 2381..2384

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 46.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              Identical blocks of code found in 3 locations. Consider refactoring.
                                                                              Open

                                                                                              AppConnector.request({
                                                                                                  async: false,
                                                                                                  url: 'index.php',
                                                                                                  type: 'POST',
                                                                                                  data: formData,
                                                                              Severity: Minor
                                                                              Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 2 other locations - About 30 mins to fix
                                                                              public_html/layouts/basic/modules/Settings/AutomaticAssignment/resources/Edit.js on lines 100..122
                                                                              public_html/layouts/basic/modules/Settings/Picklist/resources/Index.js on lines 367..386

                                                                              Duplicated Code

                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                              Tuning

                                                                              This issue has a mass of 45.

                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                              Refactorings

                                                                              Further Reading

                                                                              There are no issues that match your filters.

                                                                              Category
                                                                              Status