YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

        foreach ($rows as &$row) {
            $row['related'] = \App\Record::getHtmlLink($row['related_id'], null, \App\Config::main('href_max_length'));
            $info = '';
            if ($row['source_id']) {
                $info .= \App\Language::translate('LBL_SOURCE_RECORD') . ': ' . \App\Record::getHtmlLink($row['source_id'], null, \App\Config::main('href_max_length')) . '<br>';
Severity: Major
Found in app/Controller/Components/Action/InterestsConflict.php and 1 other location - About 6 hrs to fix
app/Controller/Components/Action/InterestsConflict.php on lines 137..150

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 205.

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 (sourceFieldElement.attr('name') == 'projectmilestoneid') {
                form = this.getForm();
                parentIdElement = form.find('[name="projectid"]');
                if (parentIdElement.length > 0 && parentIdElement.val().length > 0 && parentIdElement.val() != 0) {
                    closestContainer = parentIdElement.closest('.fieldValue');
public_html/layouts/basic/modules/ProjectTask/resources/Edit.js on lines 24..32

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 156.

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 (sourceFieldElement.attr('name') == 'parentid') {
                form = this.getForm();
                parentIdElement = form.find('[name="projectmilestoneid"]');
                if (parentIdElement.length > 0 && parentIdElement.val().length > 0 && parentIdElement.val() != 0) {
                    closestContainer = parentIdElement.closest('.fieldValue');
public_html/layouts/basic/modules/ProjectTask/resources/Edit.js on lines 15..23

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 156.

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

Method importRecords has 151 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function importRecords()
    {
        $moduleName = $this->module;
        $tableName = Import_Module_Model::getDbTableName($this->user);

Severity: Major
Found in modules/Import/actions/Data.php - About 6 hrs to fix

    File Record.php has 417 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Settings TreesManager record model class.
     *
    Severity: Minor
    Found in modules/Settings/TreesManager/models/Record.php - About 6 hrs to fix

      Cron has 44 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Cron
      {
          protected static $cronAction = false;
          protected static $baseTable = 'vtiger_cron_task';
          protected static $schemaInitialized = false;
      Severity: Minor
      Found in vtlib/Vtiger/Cron.php - About 6 hrs to fix

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

        <?php
        
        /**
         * Class to show hierarchy.
         *
        Severity: Major
        Found in modules/SSalesProcesses/views/Hierarchy.php and 1 other location - About 5 hrs to fix
        modules/MultiCompany/views/Hierarchy.php on lines 1..40

        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 203.

        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

        <?php
        
        /**
         * Class to show hierarchy.
         *
        Severity: Major
        Found in modules/MultiCompany/views/Hierarchy.php and 1 other location - About 5 hrs to fix
        modules/SSalesProcesses/views/Hierarchy.php on lines 1..45

        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 203.

        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

        Function addMiniListWidget has 149 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                addMiniListWidget: function (element, url) {
                    // 1. Show popup window for selection (module, filter, fields)
                    // 2. Compute the dynamic mini-list widget url
                    // 3. Add widget with URL to the page.
                    const thisInstance = this;

          Function getDateRangeByType has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getDateRangeByType($type, $dateObject = null)
              {
                  $currentUser = \App\User::getCurrentUserModel();
                  $weekStartDay = $currentUser->getDetail('dayoftheweek');
          
          
          Severity: Minor
          Found in include/fields/DateTimeRange.php - About 5 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 getRelatedLevelVariable has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getRelatedLevelVariable($fieldType = false)
              {
                  $cacheKey = "{$this->moduleName}|$fieldType";
                  if (isset(static::$relatedVariableLevel[$cacheKey])) {
                      return static::$relatedVariableLevel[$cacheKey];
          Severity: Minor
          Found in app/TextParser.php - About 5 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 getExpectedTimes has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function getExpectedTimes(int $id, \Vtiger_Record_Model $recordModel, array $type): array
              {
                  $return = [];
                  $date = new \DateTime();
                  if ($id && ($rules = self::getRulesForServiceContracts($id, $recordModel)) || ($rules = self::getSlaPolicyRulesForModule($recordModel))) {
          Severity: Minor
          Found in app/Utils/ServiceContracts.php - About 5 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 doTask has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              public function doTask($recordModel)
              {
                  if (!empty($this->template)) {
                      $mailerContent = [];
                      if (!empty($this->smtp)) {
          Severity: Minor
          Found in modules/com_vtiger_workflow/tasks/VTEmailTemplateTask.php - About 5 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

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

              public static function isNewMessagesForCrm(int $userId): bool
              {
                  $subQueryCrm = (new Db\Query())
                      ->select([
                          static::COLUMN_NAME['message']['crm'],
          Severity: Major
          Found in app/Chat.php and 1 other location - About 5 hrs to fix
          app/Chat.php on lines 821..836

          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 202.

          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

              public static function isNewMessagesForGroup(int $userId): bool
              {
                  $subQueryGroup = (new Db\Query())
                      ->select([
                          static::COLUMN_NAME['message']['group'],
          Severity: Major
          Found in app/Chat.php and 1 other location - About 5 hrs to fix
          app/Chat.php on lines 797..812

          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 202.

          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 10 locations. Consider refactoring.
          Open

          <?php
          /**
           * IGDN CRMEntity Class.
           *
           * @copyright YetiForce S.A.
          Severity: Major
          Found in modules/IGDN/IGDN.php and 9 other locations - About 5 hrs to fix
          modules/IGDNC/IGDNC.php on lines 1..65
          modules/IGIN/IGIN.php on lines 1..65
          modules/IGRN/IGRN.php on lines 1..65
          modules/IGRNC/IGRNC.php on lines 1..65
          modules/IIDN/IIDN.php on lines 1..65
          modules/IPreOrder/IPreOrder.php on lines 1..65
          modules/ISTDN/ISTDN.php on lines 1..65
          modules/ISTN/ISTN.php on lines 1..65
          modules/ISTRN/ISTRN.php on lines 1..65

          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 201.

          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 10 locations. Consider refactoring.
          Open

          <?php
          /**
           * ISTRN CRMEntity Class.
           *
           * @copyright YetiForce S.A.
          Severity: Major
          Found in modules/ISTRN/ISTRN.php and 9 other locations - About 5 hrs to fix
          modules/IGDN/IGDN.php on lines 1..65
          modules/IGDNC/IGDNC.php on lines 1..65
          modules/IGIN/IGIN.php on lines 1..65
          modules/IGRN/IGRN.php on lines 1..65
          modules/IGRNC/IGRNC.php on lines 1..65
          modules/IIDN/IIDN.php on lines 1..65
          modules/IPreOrder/IPreOrder.php on lines 1..65
          modules/ISTDN/ISTDN.php on lines 1..65
          modules/ISTN/ISTN.php on lines 1..65

          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 201.

          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 10 locations. Consider refactoring.
          Open

          <?php
          /**
           * ISTN CRMEntity Class.
           *
           * @copyright YetiForce S.A.
          Severity: Major
          Found in modules/ISTN/ISTN.php and 9 other locations - About 5 hrs to fix
          modules/IGDN/IGDN.php on lines 1..65
          modules/IGDNC/IGDNC.php on lines 1..65
          modules/IGIN/IGIN.php on lines 1..65
          modules/IGRN/IGRN.php on lines 1..65
          modules/IGRNC/IGRNC.php on lines 1..65
          modules/IIDN/IIDN.php on lines 1..65
          modules/IPreOrder/IPreOrder.php on lines 1..65
          modules/ISTDN/ISTDN.php on lines 1..65
          modules/ISTRN/ISTRN.php on lines 1..65

          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 201.

          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 10 locations. Consider refactoring.
          Open

          <?php
          /**
           * ISTDN CRMEntity Class.
           *
           * @copyright YetiForce S.A.
          Severity: Major
          Found in modules/ISTDN/ISTDN.php and 9 other locations - About 5 hrs to fix
          modules/IGDN/IGDN.php on lines 1..65
          modules/IGDNC/IGDNC.php on lines 1..65
          modules/IGIN/IGIN.php on lines 1..65
          modules/IGRN/IGRN.php on lines 1..65
          modules/IGRNC/IGRNC.php on lines 1..65
          modules/IIDN/IIDN.php on lines 1..65
          modules/IPreOrder/IPreOrder.php on lines 1..65
          modules/ISTN/ISTN.php on lines 1..65
          modules/ISTRN/ISTRN.php on lines 1..65

          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 201.

          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 10 locations. Consider refactoring.
          Open

          <?php
          /**
           * IGRN CRMEntity Class.
           *
           * @copyright YetiForce S.A.
          Severity: Major
          Found in modules/IGRN/IGRN.php and 9 other locations - About 5 hrs to fix
          modules/IGDN/IGDN.php on lines 1..65
          modules/IGDNC/IGDNC.php on lines 1..65
          modules/IGIN/IGIN.php on lines 1..65
          modules/IGRNC/IGRNC.php on lines 1..65
          modules/IIDN/IIDN.php on lines 1..65
          modules/IPreOrder/IPreOrder.php on lines 1..65
          modules/ISTDN/ISTDN.php on lines 1..65
          modules/ISTN/ISTN.php on lines 1..65
          modules/ISTRN/ISTRN.php on lines 1..65

          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 201.

          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

          Severity
          Category
          Status
          Source
          Language