YetiForceCompany/YetiForceCRM

View on GitHub
api/webservice/WebserviceStandard/BaseModule/RecordHistory.php

Summary

Maintainability
D
1 day
Test Coverage
C
78%

Function get has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    public function get(): array
    {
        $pagingModel = new \Vtiger_Paging_Model();
        $limit = 100;
        $isMorePages = false;
Severity: Minor
Found in api/webservice/WebserviceStandard/BaseModule/RecordHistory.php - About 1 day 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

Method get has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get(): array
    {
        $pagingModel = new \Vtiger_Paging_Model();
        $limit = 100;
        $isMorePages = false;
Severity: Major
Found in api/webservice/WebserviceStandard/BaseModule/RecordHistory.php - About 3 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                                if ($isRawData) {
                                    if ($isCreate) {
                                        $data[$fieldName]['raw'] = $fieldModel->get('postvalue');
                                    } else {
                                        $data[$fieldName]['rawFrom'] = $fieldModel->get('prevalue');
    Severity: Major
    Found in api/webservice/WebserviceStandard/BaseModule/RecordHistory.php - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

                  if (($isCreate = $recordModel->isCreate()) || $recordModel->isUpdate() || $recordModel->isTransferEdit()) {
                      $data = [];
                      foreach ($recordModel->getFieldInstances() as $fieldModel) {
                          if ($fieldModel && ($fieldInstance = $fieldModel->getFieldInstance())) {
                              \Api\WebserviceStandard\Fields::loadWebserviceByField($fieldInstance, $this);
      Severity: Major
      Found in api/webservice/WebserviceStandard/BaseModule/RecordHistory.php - About 40 mins to fix

        The method get() has an NPath complexity of 2888. The configured NPath complexity threshold is 200.
        Open

            public function get(): array
            {
                $pagingModel = new \Vtiger_Paging_Model();
                $limit = 100;
                $isMorePages = false;

        NPathComplexity

        Since: 0.1

        The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

        Example

        class Foo {
            function bar() {
                // lots of complicated code
            }
        }

        Source https://phpmd.org/rules/codesize.html#npathcomplexity

        The method get() has a Cyclomatic Complexity of 26. The configured cyclomatic complexity threshold is 10.
        Open

            public function get(): array
            {
                $pagingModel = new \Vtiger_Paging_Model();
                $limit = 100;
                $isMorePages = false;

        CyclomaticComplexity

        Since: 0.1

        Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

        Example

        // Cyclomatic Complexity = 11
        class Foo {
        1   public function example() {
        2       if ($a == $b) {
        3           if ($a1 == $b1) {
                        fiddle();
        4           } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                        fiddle();
                    }
        5       } elseif ($c == $d) {
        6           while ($c == $d) {
                        fiddle();
                    }
        7        } elseif ($e == $f) {
        8           for ($n = 0; $n < $h; $n++) {
                        fiddle();
                    }
                } else {
                    switch ($z) {
        9               case 1:
                            fiddle();
                            break;
        10              case 2:
                            fiddle();
                            break;
        11              case 3:
                            fiddle();
                            break;
                        default:
                            fiddle();
                            break;
                    }
                }
            }
        }

        Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

        Refactor this function to reduce its Cognitive Complexity from 59 to the 15 allowed.
        Open

            public function get(): array

        Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

        See

        Missing class import via use statement (line '37', column '14').
        Open

                    throw new \Api\Core\Exception('Record doesn\'t exist', 404);

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '41', column '14').
        Open

                    throw new \Api\Core\Exception('No permissions to view record', 403);

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '164', column '24').
        Open

                    $recordModel = (new \ModTracker_Record_Model())->setData($row)->setParent($row['crmid'], $row['module']);

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '134', column '22').
        Open

                $pagingModel = new \Vtiger_Paging_Model();

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '44', column '14').
        Open

                    throw new \Api\Core\Exception('MadTracker is turned off', 403);

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '145', column '17').
        Open

                $query = (new \App\Db\Query())

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Avoid assigning values to variables in if clauses and the like (line '152', column '7').
        Open

            public function get(): array
            {
                $pagingModel = new \Vtiger_Paging_Model();
                $limit = 100;
                $isMorePages = false;

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid using static access to class '\Api\WebserviceStandard\Fields' in method 'get'.
        Open

                                \Api\WebserviceStandard\Fields::loadWebserviceByField($fieldInstance, $this);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class '\App\Language' in method 'get'.
        Open

                        'status' => \App\Language::translate($recordModel->getStatusLabel(), 'ModTracker'),

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid assigning values to variables in if clauses and the like (line '175', column '9').
        Open

            public function get(): array
            {
                $pagingModel = new \Vtiger_Paging_Model();
                $limit = 100;
                $isMorePages = false;

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        The method get uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                                        } else {
                                            $data[$fieldName]['rawFrom'] = $fieldModel->get('prevalue');
                                            $data[$fieldName]['rawTo'] = $fieldModel->get('postvalue');
                                        }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Avoid using static access to class '\App\Fields\Owner' in method 'get'.
        Open

                        'owner' => \App\Fields\Owner::getUserLabel($recordModel->get('whodid')) ?: '',

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class '\App\Language' in method 'get'.
        Open

                            'targetModuleLabel' => \App\Language::translateSingularModuleName($relationInstance->get('targetmodule')),

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class '\App\Purifier' in method 'get'.
        Open

                            'targetLabel' => \App\Purifier::encodeHtml(\App\Utils\Completions::decode(\App\Record::getLabel($relationInstance->get('targetid'), true), \App\Utils\Completions::FORMAT_TEXT)),

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class '\App\Record' in method 'checkAction'.
        Open

                if ($this->controller->request->isEmpty('record', true) || !\App\Record::isExists($this->controller->request->getInteger('record'), $moduleName)) {

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid assigning values to variables in if clauses and the like (line '141', column '7').
        Open

            public function get(): array
            {
                $pagingModel = new \Vtiger_Paging_Model();
                $limit = 100;
                $isMorePages = false;

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid using static access to class '\Vtiger_Record_Model' in method 'checkAction'.
        Open

                $this->recordModel = \Vtiger_Record_Model::getInstanceById($this->controller->request->getInteger('record'), $moduleName);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid assigning values to variables in if clauses and the like (line '178', column '26').
        Open

            public function get(): array
            {
                $pagingModel = new \Vtiger_Paging_Model();
                $limit = 100;
                $isMorePages = false;

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid assigning values to variables in if clauses and the like (line '137', column '7').
        Open

            public function get(): array
            {
                $pagingModel = new \Vtiger_Paging_Model();
                $limit = 100;
                $isMorePages = false;

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        The method get uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                                    } else {
                                        $data[$fieldName]['from'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('prevalue'), $recordModel, true);
                                        $data[$fieldName]['to'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('postvalue'), $recordModel, true);
                                    }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Avoid using static access to class '\App\Utils\Completions' in method 'get'.
        Open

                            'targetLabel' => \App\Purifier::encodeHtml(\App\Utils\Completions::decode(\App\Record::getLabel($relationInstance->get('targetid'), true), \App\Utils\Completions::FORMAT_TEXT)),

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class '\App\Record' in method 'get'.
        Open

                            'targetLabel' => \App\Purifier::encodeHtml(\App\Utils\Completions::decode(\App\Record::getLabel($relationInstance->get('targetid'), true), \App\Utils\Completions::FORMAT_TEXT)),

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Define a constant instead of duplicating this literal "record" 4 times.
        Open

                if ($this->controller->request->isEmpty('record', true) || !\App\Record::isExists($this->controller->request->getInteger('record'), $moduleName)) {

        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

        Noncompliant Code Example

        With the default threshold of 3:

        function run() {
          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
          execute('action1');
          release('action1');
        }
        

        Compliant Solution

        ACTION_1 = 'action1';
        
        function run() {
          prepare(ACTION_1);
          execute(ACTION_1);
          release(ACTION_1);
        }
        

        Exceptions

        To prevent generating some false-positives, literals having less than 5 characters are excluded.

        Define a constant instead of duplicating this literal "postvalue" 4 times.
        Open

                                        $data[$fieldName]['value'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('postvalue'), $recordModel, true);

        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

        Noncompliant Code Example

        With the default threshold of 3:

        function run() {
          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
          execute('action1');
          release('action1');
        }
        

        Compliant Solution

        ACTION_1 = 'action1';
        
        function run() {
          prepare(ACTION_1);
          execute(ACTION_1);
          release(ACTION_1);
        }
        

        Exceptions

        To prevent generating some false-positives, literals having less than 5 characters are excluded.

        Rename "$recordModel" which has the same name as the field declared at line 29.
        Open

                    $recordModel = (new \ModTracker_Record_Model())->setData($row)->setParent($row['crmid'], $row['module']);

        Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

        Noncompliant Code Example

        class Foo {
          public $myField;
        
          public function doSomething() {
            $myField = 0;
            ...
          }
        }
        

        See

        Call to method getUserLabel from undeclared class \App\Fields\Owner
        Open

                        'owner' => \App\Fields\Owner::getUserLabel($recordModel->get('whodid')) ?: '',

        Possibly zero references to use statement for classlike/namespace OA (\OpenApi\Annotations)
        Open

        use OpenApi\Annotations as OA;

        Reference to constant FORMAT_TEXT from undeclared class \App\Utils\Completions
        Open

                            'targetLabel' => \App\Purifier::encodeHtml(\App\Utils\Completions::decode(\App\Record::getLabel($relationInstance->get('targetid'), true), \App\Utils\Completions::FORMAT_TEXT)),

        Call to method decode from undeclared class \App\Utils\Completions
        Open

                            'targetLabel' => \App\Purifier::encodeHtml(\App\Utils\Completions::decode(\App\Record::getLabel($relationInstance->get('targetid'), true), \App\Utils\Completions::FORMAT_TEXT)),

        Call to undeclared method \App\Db\Query::from
        Open

                $query = (new \App\Db\Query())

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_RecordHistory_Response"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *    @OA\Schema(

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        type="object",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                @OA\AdditionalProperties(type="object", title="Key indicating the number of changes made to a given record",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    required={"time", "owner", "status"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    @OA\Property(property="owner", type="string", description="Username of the user who made the change", example="System Admin"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="moduleName", in="path", @OA\Schema(type="string"), description="Module name", required=true, example="Contacts"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="x-row-limit", in="header", @OA\Schema(type="integer"), description="Get rows limit, default: 100", required=false, example=50),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="x-start-with", in="header", @OA\Schema(type="integer"), description="Show history from given ID", required=false, example=5972),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        schema="BaseModule_Get_RecordHistory_Response",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            required={"records", "isMorePages"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        description="Gets the history of the record",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        tags={"BaseModule"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\JsonContent(ref="#/components/schemas/Exception"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\JsonContent(ref="#/components/schemas/Exception"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        path="/webservice/WebserviceStandard/{moduleName}/RecordHistory/{recordId}",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="x-start-with", in="header", @OA\Schema(type="integer"), description="Show history from given ID", required=false, example=5972),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="moduleName", in="path", @OA\Schema(type="string"), description="Module name", required=true, example="Contacts"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Response(response=404, description="Record doesn't exist",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        title="Base module - Response action history record",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    @OA\Property(property="rawStatus", type="string", description="The name of the untranslated label", example="LBL_UPDATED"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            @OA\Schema(type="object", title="Record data create",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="to", type="string", description="Value after change, the data type depends on the field type", example="Jan Nowak"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                required={"targetModule", "targetModuleLabel", "targetLabel"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            ),

        Spaces must be used for alignment; tabs are not allowed
        Open

            public function get(): array

        Spaces must be used for alignment; tabs are not allowed
        Open

                    $pagingModel->set('page', (int) $page);

        Spaces must be used for alignment; tabs are not allowed
        Open

                        $row['rawOwner'] = $recordModel->get('whodid') ?: 0;

        Spaces must be used for alignment; tabs are not allowed
        Open

                                \Api\WebserviceStandard\Fields::loadWebserviceByField($fieldInstance, $this);

        Spaces must be used for alignment; tabs are not allowed
        Open

                                        $data[$fieldName]['from'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('prevalue'), $recordModel, true);

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Response(response=200, description="Recent activities detail",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *             @OA\Property(property="records", type="object", title="Entires of recent record activities",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="label", type="string", description="Translated field label", example="Name"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *    ),

        Spaces must be used for alignment; tabs are not allowed
        Open

                $pagingModel = new \Vtiger_Paging_Model();

        Spaces must be used for alignment; tabs are not allowed
        Open

                $limit = 100;

        Spaces must be used for alignment; tabs are not allowed
        Open

                $startIndex = $pagingModel->getStartIndex();

        Spaces must be used for alignment; tabs are not allowed
        Open

                $query = (new \App\Db\Query())

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Response(response=404, description="Record doesn't exist",

        Spaces must be used for alignment; tabs are not allowed
        Open

                    ->where(['crmid' => $this->controller->request->getInteger('record')])

        Spaces must be used for alignment; tabs are not allowed
        Open

                        'owner' => \App\Fields\Owner::getUserLabel($recordModel->get('whodid')) ?: '',

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                        oneOf={

        Spaces must be used for alignment; tabs are not allowed
        Open

                        $row['rawTime'] = $recordModel->getActivityTime();

        Spaces must be used for alignment; tabs are not allowed
        Open

                    if (($isCreate = $recordModel->isCreate()) || $recordModel->isUpdate() || $recordModel->isTransferEdit()) {

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\AdditionalProperties(

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    required={"label", "value", "raw"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="label", type="string", description="Translated field label", example="Name"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\Property(property="targetModule", type="string", description="The name of the target related module", example="Contacts"),

        Spaces must be used for alignment; tabs are not allowed
        Open

                    $query->andWhere(['>=', 'id', (int) $startWith]);

        Spaces must be used for alignment; tabs are not allowed
        Open

                    if (!$limit--) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                    ];

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="x-row-limit", in="header", @OA\Schema(type="integer"), description="Get rows limit, default: 100", required=false, example=50),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\JsonContent(ref="#/components/schemas/Exception"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *    ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        description="Gets the history of the record",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        description="Action module for recent activities in CRM",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        summary="Record history",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                     @OA\Property(property="time", type="string", description="Showing the exact date on which the change took place", example="2019-10-07 08:32:38"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    @OA\Property(property="owner", type="string", description="Username of the user who made the change", example="System Admin"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="x-raw-data", in="header", @OA\Schema(type="integer", enum={0, 1}), description="Gets raw data", required=false, example=1),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_RecordHistory_Response"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_RecordHistory_Response"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Property(property="result", type="object", title="Returns recent activities that took place in CRM",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            required={"records", "isMorePages"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\AdditionalProperties(

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="rawFrom", type="string", description="Value before change, value in database format, only available in `x-raw-data`", example="Jan Kowalski"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                        },

        Spaces must be used for alignment; tabs are not allowed
        Open

                $records = [];

        Spaces must be used for alignment; tabs are not allowed
        Open

                        'time' => $recordModel->getDisplayActivityTime(),

        Spaces must be used for alignment; tabs are not allowed
        Open

                        $row['rawStatus'] = $recordModel->getStatusLabel();

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    @OA\Property(property="data", title="Additional information",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            @OA\Schema(type="object", title="Operations on related records", description="Adding relations, removing relations, transferring records",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            ),

        Spaces must be used for alignment; tabs are not allowed
        Open

                    ->limit($limit + 1)

        Spaces must be used for alignment; tabs are not allowed
        Open

                    $recordModel = (new \ModTracker_Record_Model())->setData($row)->setParent($row['crmid'], $row['module']);

        Spaces must be used for alignment; tabs are not allowed
        Open

                    if ($isRawData) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                                if ($fieldInstance->isViewable() && 5 !== $fieldModel->getFieldInstance()->getDisplayType()) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                                    $fieldName = $fieldInstance->getName();

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="recordId", in="path", @OA\Schema(type="integer"), description="Record id", required=true, example=116),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Response(response=403, description="`No permissions to view record` OR `MadTracker is turned off`",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *    ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        title="Base module - Response action history record",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                     @OA\Property(property="time", type="string", description="Showing the exact date on which the change took place", example="2019-10-07 08:32:38"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="value", type="string", description="Value, the data type depends on the field type", example="Jan Kowalski"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="raw", type="string", description="Value in database format, only available in `x-raw-data`", example="Jan Kowalski"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            @OA\Schema(type="object", title="Record data change", description="Edit, conversation",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="label", type="string", description="Translated field label", example="Name"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="from", type="string", description="Value before change, the data type depends on the field type", example="Jan Kowalski"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="rawFrom", type="string", description="Value before change, value in database format, only available in `x-raw-data`", example="Jan Kowalski"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                ),

        Spaces must be used for alignment; tabs are not allowed
        Open

                    ->orderBy(['changedon' => SORT_DESC]);

        Spaces must be used for alignment; tabs are not allowed
        Open

                        foreach ($recordModel->getFieldInstances() as $fieldModel) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                                    $data[$fieldName]['label'] = $fieldInstance->getFullLabelTranslation();

        Spaces must be used for alignment; tabs are not allowed
        Open

                                    if ($isCreate) {

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="recordId", in="path", @OA\Schema(type="integer"), description="Record id", required=true, example=116),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_RecordHistory_Response"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        schema="BaseModule_Get_RecordHistory_Response",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    required={"time", "owner", "status"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    @OA\Property(property="status", type="string", description="Name of the action that was carried out", example="changed"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                     @OA\Property(property="rawTime", type="string", description="Showing the exact date on which the change took place",  example="2019-10-07 08:32:38"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                     @OA\Property(property="rawTime", type="string", description="Showing the exact date on which the change took place",  example="2019-10-07 08:32:38"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    @OA\Property(property="rawStatus", type="string", description="The name of the untranslated label", example="LBL_UPDATED"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    @OA\Property(property="data", title="Additional information",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                        oneOf={

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    required={"label", "value", "raw"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="rawTo", type="string", description="Value after change, value in database format, only available in `x-raw-data`", example="Jan Nowak"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                ),

        Spaces must be used for alignment; tabs are not allowed
        Open

                    ->offset($startIndex)

        Spaces must be used for alignment; tabs are not allowed
        Open

                        'status' => \App\Language::translate($recordModel->getStatusLabel(), 'ModTracker'),

        Spaces must be used for alignment; tabs are not allowed
        Open

                                        $data[$fieldName]['value'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('postvalue'), $recordModel, true);

        Spaces must be used for alignment; tabs are not allowed
        Open

                                    } else {

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Response(response=403, description="`No permissions to view record` OR `MadTracker is turned off`",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\XmlContent(ref="#/components/schemas/Exception"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\XmlContent(ref="#/components/schemas/Exception"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        type="object",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                @OA\AdditionalProperties(type="object", title="Key indicating the number of changes made to a given record",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    @OA\Property(property="status", type="string", description="Name of the action that was carried out", example="changed"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="value", type="string", description="Value, the data type depends on the field type", example="Jan Kowalski"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            @OA\Schema(type="object", title="Record data change", description="Edit, conversation",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\AdditionalProperties(

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\Property(property="targetModuleLabel", type="string", description="Translated module name", example="Kontakt"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\Property(property="targetLabel", type="string", description="The label name of the target related module", example="Jan Kowalski"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    ),

        Spaces must be used for alignment; tabs are not allowed
        Open

                    ->andWhere(['not in', 'status', [\ModTracker_Record_Model::DISPLAYED, \ModTracker_Record_Model::SHOW_HIDDEN_DATA]])

        Spaces must be used for alignment; tabs are not allowed
        Open

                $isRawData = $this->isRawData();

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        tags={"BaseModule"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Response(response=200, description="Recent activities detail",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\XmlContent(ref="#/components/schemas/Exception"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *    @OA\Schema(

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            ),

        Spaces must be used for alignment; tabs are not allowed
        Open

                if ($startWith = $this->controller->request->getHeader('x-start-with')) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                }

        Spaces must be used for alignment; tabs are not allowed
        Open

                    $row = [

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="x-page", in="header", @OA\Schema(type="integer"), description="Page number, default: 1", required=false, example=1),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="x-raw-data", in="header", @OA\Schema(type="integer", enum={0, 1}), description="Gets raw data", required=false, example=1),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\XmlContent(ref="#/components/schemas/Exception"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        description="Action module for recent activities in CRM",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Property(property="status", type="integer", enum={0, 1}, description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    @OA\Property(property="rawOwner", type="integer", description="User ID of the user who made the change", example=1),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="raw", type="string", description="Value in database format, only available in `x-raw-data`", example="Jan Kowalski"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="rawTo", type="string", description="Value after change, value in database format, only available in `x-raw-data`", example="Jan Nowak"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            @OA\Schema(type="object", title="Operations on related records", description="Adding relations, removing relations, transferring records",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\Property(property="targetId", type="integer", description="Id of the target related module", example=394),

        Spaces must be used for alignment; tabs are not allowed
        Open

                $isMorePages = false;

        Spaces must be used for alignment; tabs are not allowed
        Open

             *            @OA\JsonContent(ref="#/components/schemas/Exception"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Property(property="status", type="integer", enum={0, 1}, description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Property(property="result", type="object", title="Returns recent activities that took place in CRM",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\AdditionalProperties(

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    required={"label", "from", "to"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\Property(property="targetModuleLabel", type="string", description="Translated module name", example="Kontakt"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *             @OA\Property(property="isMorePages", type="boolean", example=true),

        Spaces must be used for alignment; tabs are not allowed
        Open

                $pagingModel->set('limit', $limit);

        Spaces must be used for alignment; tabs are not allowed
        Open

                    }

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        summary="Record history",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="x-page", in="header", @OA\Schema(type="integer"), description="Page number, default: 1", required=false, example=1),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *             @OA\Property(property="records", type="object", title="Entires of recent record activities",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="label", type="string", description="Translated field label", example="Name"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *    ),

        Spaces must be used for alignment; tabs are not allowed
        Open

                        $data = [];

        Spaces must be used for alignment; tabs are not allowed
        Open

                            if ($fieldModel && ($fieldInstance = $fieldModel->getFieldInstance())) {

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                    @OA\Property(property="rawOwner", type="integer", description="User ID of the user who made the change", example=1),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="from", type="string", description="Value before change, the data type depends on the field type", example="Jan Kowalski"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\Property(property="targetId", type="integer", description="Id of the target related module", example=394),

        Spaces must be used for alignment; tabs are not allowed
        Open

            {

        Spaces must be used for alignment; tabs are not allowed
        Open

                    }

        Spaces must be used for alignment; tabs are not allowed
        Open

                                    }

        Spaces must be used for alignment; tabs are not allowed
        Open

                            'targetModule' => $relationInstance->get('targetmodule'),

        Spaces must be used for alignment; tabs are not allowed
        Open

             */

        Spaces must be used for alignment; tabs are not allowed
        Open

                                        $data[$fieldName]['to'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('postvalue'), $recordModel, true);

        Spaces must be used for alignment; tabs are not allowed
        Open

                                            $data[$fieldName]['rawTo'] = $fieldModel->get('postvalue');

        Spaces must be used for alignment; tabs are not allowed
        Open

                return [

        Spaces must be used for alignment; tabs are not allowed
        Open

                    'records' => $records,

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             */

        Spaces must be used for alignment; tabs are not allowed
        Open

                if ($requestLimit = $this->controller->request->getHeader('x-row-limit')) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                $dataReader = $query->createCommand()->query();

        Spaces must be used for alignment; tabs are not allowed
        Open

                                    }

        Spaces must be used for alignment; tabs are not allowed
        Open

                        $isMorePages = true;

        Spaces must be used for alignment; tabs are not allowed
        Open

                                            $data[$fieldName]['raw'] = $fieldModel->get('postvalue');

        Spaces must be used for alignment; tabs are not allowed
        Open

                        if ($isRawData) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                            }

        Spaces must be used for alignment; tabs are not allowed
        Open

                        }

        Spaces must be used for alignment; tabs are not allowed
        Open

                    $records[$recordModel->get('id')] = $row;

        Spaces must be used for alignment; tabs are not allowed
        Open

                            'targetLabel' => \App\Purifier::encodeHtml(\App\Utils\Completions::decode(\App\Record::getLabel($relationInstance->get('targetid'), true), \App\Utils\Completions::FORMAT_TEXT)),

        Spaces must be used for alignment; tabs are not allowed
        Open

                ];

        Spaces must be used for alignment; tabs are not allowed
        Open

                        $row['data'] = $data;

        Spaces must be used for alignment; tabs are not allowed
        Open

                        $relationInstance = $recordModel->getRelationInstance();

        Spaces must be used for alignment; tabs are not allowed
        Open

                        }

        Spaces must be used for alignment; tabs are not allowed
        Open

            /**

        Spaces must be used for alignment; tabs are not allowed
        Open

                            'targetModuleLabel' => \App\Language::translateSingularModuleName($relationInstance->get('targetmodule')),

        Spaces must be used for alignment; tabs are not allowed
        Open

                $dataReader->close();

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\Property(property="targetModule", type="string", description="The name of the target related module", example="Contacts"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        ),

        Spaces must be used for alignment; tabs are not allowed
        Open

                    $limit = (int) $requestLimit;

        Spaces must be used for alignment; tabs are not allowed
        Open

                    ->from('vtiger_modtracker_basic')

        Spaces must be used for alignment; tabs are not allowed
        Open

                        $row['data'] = [

        Spaces must be used for alignment; tabs are not allowed
        Open

            {

        Spaces must be used for alignment; tabs are not allowed
        Open

            }

        Spaces must be used for alignment; tabs are not allowed
        Open

                        if (!$data) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                    'isMorePages' => $isMorePages,

        Spaces must be used for alignment; tabs are not allowed
        Open

            }

        Spaces must be used for alignment; tabs are not allowed
        Open

                                    if ($isRawData) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                            $row['data']['targetId'] = $relationInstance->get('targetid');

        Spaces must be used for alignment; tabs are not allowed
        Open

             * Check if you send raw data.

        Spaces must be used for alignment; tabs are not allowed
        Open

             *

        Spaces must be used for alignment; tabs are not allowed
        Open

                                        if ($isCreate) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                    } elseif ($recordModel->isRelationLink() || $recordModel->isRelationUnLink() || $recordModel->isTransferLink() || $recordModel->isTransferUnLink()) {

        Spaces must be used for alignment; tabs are not allowed
        Open

            protected function isRawData(): bool

        Spaces must be used for alignment; tabs are not allowed
        Open

                                            $data[$fieldName]['rawFrom'] = $fieldModel->get('prevalue');

        Spaces must be used for alignment; tabs are not allowed
        Open

             * @return bool

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            @OA\Schema(type="object", title="Record data create",

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    required={"label", "from", "to"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                    @OA\Property(property="to", type="string", description="Value after change, the data type depends on the field type", example="Jan Nowak"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                            ),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                required={"targetModule", "targetModuleLabel", "targetLabel"},

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                                @OA\Property(property="targetLabel", type="string", description="The label name of the target related module", example="Jan Kowalski"),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *                        },

        Spaces must be used for alignment; tabs are not allowed
        Open

             *             @OA\Property(property="isMorePages", type="boolean", example=true),

        Spaces must be used for alignment; tabs are not allowed
        Open

             *        ),

        Spaces must be used for alignment; tabs are not allowed
        Open

                }

        Spaces must be used for alignment; tabs are not allowed
        Open

                if ($page = $this->controller->request->getHeader('x-page')) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                }

        Spaces must be used for alignment; tabs are not allowed
        Open

                while ($row = $dataReader->read()) {

        Spaces must be used for alignment; tabs are not allowed
        Open

                        break;

        Spaces must be used for alignment; tabs are not allowed
        Open

                        }

        Spaces must be used for alignment; tabs are not allowed
        Open

                        ];

        Spaces must be used for alignment; tabs are not allowed
        Open

                                        } else {

        Spaces must be used for alignment; tabs are not allowed
        Open

                                }

        Spaces must be used for alignment; tabs are not allowed
        Open

                                        }

        Spaces must be used for alignment; tabs are not allowed
        Open

                    }

        Spaces must be used for alignment; tabs are not allowed
        Open

                }

        Spaces must be used for alignment; tabs are not allowed
        Open

                            continue;

        Spaces must be used for alignment; tabs are not allowed
        Open

                return 1 === (int) ($this->controller->headers['x-raw-data'] ?? 0);

        Line exceeds 120 characters; contains 131 characters
        Open

             *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

        Spaces must be used to indent lines; tabs are not allowed
        Open

                if ($this->controller->request->isEmpty('record', true) || !\App\Record::isExists($this->controller->request->getInteger('record'), $moduleName)) {

        Spaces must be used to indent lines; tabs are not allowed
        Open

                }

        Line exceeds 120 characters; contains 150 characters
        Open

             *                    @OA\Property(property="owner", type="string", description="Username of the user who made the change", example="System Admin"),

        Spaces must be used to indent lines; tabs are not allowed
        Open

            /** {@inheritdoc}  */

        Spaces must be used to indent lines; tabs are not allowed
        Open

                    throw new \Api\Core\Exception('MadTracker is turned off', 403);

        Line exceeds 120 characters; contains 135 characters
        Open

             *        @OA\Parameter(name="recordId", in="path", @OA\Schema(type="integer"), description="Record id", required=true, example=116),

        Line exceeds 120 characters; contains 128 characters
        Open

             *                @OA\AdditionalProperties(type="object", title="Key indicating the number of changes made to a given record",

        Spaces must be used to indent lines; tabs are not allowed
        Open

            {

        Line exceeds 120 characters; contains 130 characters
        Open

                $this->recordModel = \Vtiger_Record_Model::getInstanceById($this->controller->request->getInteger('record'), $moduleName);

        Spaces must be used to indent lines; tabs are not allowed
        Open

                if (!$this->recordModel->isViewable()) {

        Spaces must be used to indent lines; tabs are not allowed
        Open

                    throw new \Api\Core\Exception('No permissions to view record', 403);

        Spaces must be used to indent lines; tabs are not allowed
        Open

             * Get related record list method.

        Spaces must be used to indent lines; tabs are not allowed
        Open

             * @OA\Get(

        Line exceeds 120 characters; contains 170 characters
        Open

             *                            @OA\Schema(type="object", title="Operations on related records", description="Adding relations, removing relations, transferring records",

        Spaces must be used to indent lines; tabs are not allowed
        Open

            public $allowedHeaders = ['x-raw-data', 'x-page', 'x-row-limit', 'x-start-with'];

        Spaces must be used to indent lines; tabs are not allowed
        Open

                $this->recordModel = \Vtiger_Record_Model::getInstanceById($this->controller->request->getInteger('record'), $moduleName);

        Line exceeds 120 characters; contains 169 characters
        Open

                                        $data[$fieldName]['value'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('postvalue'), $recordModel, true);

        Spaces must be used to indent lines; tabs are not allowed
        Open

            public $allowedMethod = ['GET'];

        Spaces must be used to indent lines; tabs are not allowed
        Open

            /** {@inheritdoc}  */

        Spaces must be used to indent lines; tabs are not allowed
        Open

             *

        Spaces must be used to indent lines; tabs are not allowed
        Open

             * @return array

        Line exceeds 120 characters; contains 155 characters
        Open

             *        @OA\Parameter(name="x-raw-data", in="header", @OA\Schema(type="integer", enum={0, 1}), description="Gets raw data", required=false, example=1),

        Line exceeds 120 characters; contains 148 characters
        Open

             *        @OA\Parameter(name="x-page", in="header", @OA\Schema(type="integer"), description="Page number, default: 1", required=false, example=1),

        Line exceeds 120 characters; contains 160 characters
        Open

             *        @OA\Parameter(name="x-start-with", in="header", @OA\Schema(type="integer"), description="Show history from given ID", required=false, example=5972),

        Line exceeds 120 characters; contains 172 characters
        Open

             *                                    @OA\Property(property="value", type="string", description="Value, the data type depends on the field type", example="Jan Kowalski"),

        Spaces must be used to indent lines; tabs are not allowed
        Open

            protected $recordModel;

        Spaces must be used to indent lines; tabs are not allowed
        Open

                    throw new \Api\Core\Exception('Record doesn\'t exist', 404);

        Spaces must be used to indent lines; tabs are not allowed
        Open

            /** {@inheritdoc}  */

        Spaces must be used to indent lines; tabs are not allowed
        Open

                }

        Spaces must be used to indent lines; tabs are not allowed
        Open

            /**

        Spaces must be used to indent lines; tabs are not allowed
        Open

             *

        Line exceeds 120 characters; contains 189 characters
        Open

             *        @OA\Property(property="status", type="integer", enum={0, 1}, description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error"),

        Line exceeds 120 characters; contains 205 characters
        Open

             *                                    @OA\Property(property="rawFrom", type="string", description="Value before change, value in database format, only available in `x-raw-data`", example="Jan Kowalski"),

        Spaces must be used to indent lines; tabs are not allowed
        Open

                if (!$this->recordModel->getModule()->isTrackingEnabled()) {

        Spaces must be used to indent lines; tabs are not allowed
        Open

             * @api

        Line exceeds 120 characters; contains 140 characters
        Open

             *                                    @OA\Property(property="label", type="string", description="Translated field label", example="Name"),

        Line exceeds 120 characters; contains 179 characters
        Open

             *                                    @OA\Property(property="to", type="string", description="Value after change, the data type depends on the field type", example="Jan Nowak"),

        Line exceeds 120 characters; contains 171 characters
        Open

             *                                @OA\Property(property="targetLabel", type="string", description="The label name of the target related module", example="Jan Kowalski"),

        Line exceeds 120 characters; contains 127 characters
        Open

                    ->andWhere(['not in', 'status', [\ModTracker_Record_Model::DISPLAYED, \ModTracker_Record_Model::SHOW_HIDDEN_DATA]])

        Spaces must be used to indent lines; tabs are not allowed
        Open

            }

        Line exceeds 120 characters; contains 159 characters
        Open

             *        @OA\Parameter(name="x-row-limit", in="header", @OA\Schema(type="integer"), description="Get rows limit, default: 100", required=false, example=50),

        Spaces must be used to indent lines; tabs are not allowed
        Open

            /** @var \Vtiger_Record_Model Record model instance. */

        Spaces must be used to indent lines; tabs are not allowed
        Open

            public function checkAction(): void

        Line exceeds 120 characters; contains 145 characters
        Open

             *        @OA\Parameter(name="moduleName", in="path", @OA\Schema(type="string"), description="Module name", required=true, example="Contacts"),

        Line exceeds 120 characters; contains 162 characters
        Open

             *                                @OA\Property(property="targetModule", type="string", description="The name of the target related module", example="Contacts"),

        Line exceeds 120 characters; contains 146 characters
        Open

             *                                @OA\Property(property="targetId", type="integer", description="Id of the target related module", example=394),

        Spaces must be used to indent lines; tabs are not allowed
        Open

                $moduleName = $this->controller->request->getModule();

        Line exceeds 120 characters; contains 155 characters
        Open

                if ($this->controller->request->isEmpty('record', true) || !\App\Record::isExists($this->controller->request->getInteger('record'), $moduleName)) {

        Spaces must be used to indent lines; tabs are not allowed
        Open

                }

        Spaces must be used to indent lines; tabs are not allowed
        Open

             *        path="/webservice/WebserviceStandard/{moduleName}/RecordHistory/{recordId}",

        Line exceeds 120 characters; contains 173 characters
        Open

             *                     @OA\Property(property="rawTime", type="string", description="Showing the exact date on which the change took place",  example="2019-10-07 08:32:38"),

        Spaces must be used to indent lines; tabs are not allowed
        Open

                parent::checkAction();

        Line exceeds 120 characters; contains 169 characters
        Open

             *                     @OA\Property(property="time", type="string", description="Showing the exact date on which the change took place", example="2019-10-07 08:32:38"),

        Line exceeds 120 characters; contains 140 characters
        Open

             *                    @OA\Property(property="rawOwner", type="integer", description="User ID of the user who made the change", example=1),

        Line exceeds 120 characters; contains 151 characters
        Open

             *                                @OA\Property(property="targetModuleLabel", type="string", description="Translated module name", example="Kontakt"),

        Line exceeds 120 characters; contains 167 characters
        Open

                                        $data[$fieldName]['from'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('prevalue'), $recordModel, true);

        Line exceeds 120 characters; contains 161 characters
        Open

                    } elseif ($recordModel->isRelationLink() || $recordModel->isRelationUnLink() || $recordModel->isTransferLink() || $recordModel->isTransferUnLink()) {

        Line exceeds 120 characters; contains 145 characters
        Open

             *                    @OA\Property(property="status", type="string", description="Name of the action that was carried out", example="changed"),

        Line exceeds 120 characters; contains 147 characters
        Open

             *                    @OA\Property(property="rawStatus", type="string", description="The name of the untranslated label", example="LBL_UPDATED"),

        Line exceeds 120 characters; contains 166 characters
        Open

                                        $data[$fieldName]['to'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('postvalue'), $recordModel, true);

        Line exceeds 120 characters; contains 197 characters
        Open

                            'targetLabel' => \App\Purifier::encodeHtml(\App\Utils\Completions::decode(\App\Record::getLabel($relationInstance->get('targetid'), true), \App\Utils\Completions::FORMAT_TEXT)),

        Line exceeds 120 characters; contains 126 characters
        Open

                            'targetModuleLabel' => \App\Language::translateSingularModuleName($relationInstance->get('targetmodule')),

        Line exceeds 120 characters; contains 140 characters
        Open

             *                                    @OA\Property(property="label", type="string", description="Translated field label", example="Name"),

        Line exceeds 120 characters; contains 180 characters
        Open

             *                                    @OA\Property(property="raw", type="string", description="Value in database format, only available in `x-raw-data`", example="Jan Kowalski"),

        Line exceeds 120 characters; contains 185 characters
        Open

             *                                    @OA\Property(property="from", type="string", description="Value before change, the data type depends on the field type", example="Jan Kowalski"),

        Line exceeds 120 characters; contains 199 characters
        Open

             *                                    @OA\Property(property="rawTo", type="string", description="Value after change, value in database format, only available in `x-raw-data`", example="Jan Nowak"),

        There are no issues that match your filters.

        Category
        Status