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;
- Read upRead up
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;
Avoid deeply nested control flow statements. Open
if ($isRawData) {
if ($isCreate) {
$data[$fieldName]['raw'] = $fieldModel->get('postvalue');
} else {
$data[$fieldName]['rawFrom'] = $fieldModel->get('prevalue');
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);
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;
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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())
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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'),
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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');
}
- Read upRead up
- Exclude checks
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')) ?: '',
- Read upRead up
- Exclude checks
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')),
- Read upRead up
- Exclude checks
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)),
- Read upRead up
- Exclude checks
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)) {
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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);
}
- Read upRead up
- Exclude checks
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)),
- Read upRead up
- Exclude checks
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)),
- Read upRead up
- Exclude checks
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)) {
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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
- CERT, DCL51-J. - Do not shadow or obscure identifiers in subscopes
Call to method getUserLabel
from undeclared class \App\Fields\Owner
Open
'owner' => \App\Fields\Owner::getUserLabel($recordModel->get('whodid')) ?: '',
- Exclude checks
Possibly zero references to use statement for classlike/namespace OA
(\OpenApi\Annotations)
Open
use OpenApi\Annotations as OA;
- Exclude checks
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)),
- Exclude checks
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)),
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_RecordHistory_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Schema(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* type="object",
- Exclude checks
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",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"time", "owner", "status"},
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
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),
- Exclude checks
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),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* schema="BaseModule_Get_RecordHistory_Response",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"records", "isMorePages"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Gets the history of the record",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* tags={"BaseModule"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* path="/webservice/WebserviceStandard/{moduleName}/RecordHistory/{recordId}",
- Exclude checks
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),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
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"),
- Exclude checks
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),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(response=404, description="Record doesn't exist",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* title="Base module - Response action history record",
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Schema(type="object", title="Record data create",
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"targetModule", "targetModuleLabel", "targetLabel"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function get(): array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$pagingModel->set('page', (int) $page);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row['rawOwner'] = $recordModel->get('whodid') ?: 0;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
\Api\WebserviceStandard\Fields::loadWebserviceByField($fieldInstance, $this);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$data[$fieldName]['from'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('prevalue'), $recordModel, true);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(response=200, description="Recent activities detail",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="records", type="object", title="Entires of recent record activities",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="label", type="string", description="Translated field label", example="Name"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$pagingModel = new \Vtiger_Paging_Model();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$limit = 100;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$startIndex = $pagingModel->getStartIndex();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$query = (new \App\Db\Query())
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(response=404, description="Record doesn't exist",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
->where(['crmid' => $this->controller->request->getInteger('record')])
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'owner' => \App\Fields\Owner::getUserLabel($recordModel->get('whodid')) ?: '',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* oneOf={
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row['rawTime'] = $recordModel->getActivityTime();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (($isCreate = $recordModel->isCreate()) || $recordModel->isUpdate() || $recordModel->isTransferEdit()) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\AdditionalProperties(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"label", "value", "raw"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="label", type="string", description="Translated field label", example="Name"),
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$query->andWhere(['>=', 'id', (int) $startWith]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!$limit--) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
];
- Exclude checks
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),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Gets the history of the record",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Action module for recent activities in CRM",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* summary="Record history",
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
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),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_RecordHistory_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_RecordHistory_Response"),
- Exclude checks
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",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"records", "isMorePages"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\AdditionalProperties(
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* },
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$records = [];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'time' => $recordModel->getDisplayActivityTime(),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row['rawStatus'] = $recordModel->getStatusLabel();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="data", title="Additional information",
- Exclude checks
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",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
->limit($limit + 1)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel = (new \ModTracker_Record_Model())->setData($row)->setParent($row['crmid'], $row['module']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($isRawData) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($fieldInstance->isViewable() && 5 !== $fieldModel->getFieldInstance()->getDisplayType()) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$fieldName = $fieldInstance->getName();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},
- Exclude checks
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),
- Exclude checks
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`",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* title="Base module - Response action history record",
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Schema(type="object", title="Record data change", description="Edit, conversation",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="label", type="string", description="Translated field label", example="Name"),
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
->orderBy(['changedon' => SORT_DESC]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
foreach ($recordModel->getFieldInstances() as $fieldModel) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$data[$fieldName]['label'] = $fieldInstance->getFullLabelTranslation();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($isCreate) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},
- Exclude checks
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),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_RecordHistory_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* schema="BaseModule_Get_RecordHistory_Response",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"time", "owner", "status"},
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="data", title="Additional information",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* oneOf={
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"label", "value", "raw"},
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
->offset($startIndex)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'status' => \App\Language::translate($recordModel->getStatusLabel(), 'ModTracker'),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$data[$fieldName]['value'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('postvalue'), $recordModel, true);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
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`",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* type="object",
- Exclude checks
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",
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Schema(type="object", title="Record data change", description="Edit, conversation",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\AdditionalProperties(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="targetModuleLabel", type="string", description="Translated module name", example="Kontakt"),
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
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]])
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$isRawData = $this->isRawData();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* tags={"BaseModule"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(response=200, description="Recent activities detail",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Schema(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($startWith = $this->controller->request->getHeader('x-start-with')) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row = [
- Exclude checks
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),
- Exclude checks
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),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Action module for recent activities in CRM",
- Exclude checks
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"),
- Exclude checks
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),
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
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"),
- Exclude checks
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",
- Exclude checks
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),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$isMorePages = false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
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"),
- Exclude checks
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",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\AdditionalProperties(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"label", "from", "to"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="targetModuleLabel", type="string", description="Translated module name", example="Kontakt"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="isMorePages", type="boolean", example=true),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$pagingModel->set('limit', $limit);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* summary="Record history",
- Exclude checks
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),
- Exclude checks
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),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="records", type="object", title="Entires of recent record activities",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="label", type="string", description="Translated field label", example="Name"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$data = [];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($fieldModel && ($fieldInstance = $fieldModel->getFieldInstance())) {
- Exclude checks
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),
- Exclude checks
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"),
- Exclude checks
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),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'targetModule' => $relationInstance->get('targetmodule'),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$data[$fieldName]['to'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('postvalue'), $recordModel, true);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$data[$fieldName]['rawTo'] = $fieldModel->get('postvalue');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'records' => $records,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($requestLimit = $this->controller->request->getHeader('x-row-limit')) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$isMorePages = true;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$data[$fieldName]['raw'] = $fieldModel->get('postvalue');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($isRawData) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$records[$recordModel->get('id')] = $row;
- Exclude checks
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)),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row['data'] = $data;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$relationInstance = $recordModel->getRelationInstance();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'targetModuleLabel' => \App\Language::translateSingularModuleName($relationInstance->get('targetmodule')),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$limit = (int) $requestLimit;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
->from('vtiger_modtracker_basic')
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row['data'] = [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!$data) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'isMorePages' => $isMorePages,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($isRawData) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row['data']['targetId'] = $relationInstance->get('targetid');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Check if you send raw data.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($isCreate) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} elseif ($recordModel->isRelationLink() || $recordModel->isRelationUnLink() || $recordModel->isTransferLink() || $recordModel->isTransferUnLink()) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
protected function isRawData(): bool
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$data[$fieldName]['rawFrom'] = $fieldModel->get('prevalue');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Schema(type="object", title="Record data create",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"label", "from", "to"},
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"targetModule", "targetModuleLabel", "targetLabel"},
- Exclude checks
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"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* },
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="isMorePages", type="boolean", example=true),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($page = $this->controller->request->getHeader('x-page')) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return 1 === (int) ($this->controller->headers['x-raw-data'] ?? 0);
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
* @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),
- Exclude checks
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)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
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"),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \Api\Core\Exception('MadTracker is turned off', 403);
- Exclude checks
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),
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
* @OA\AdditionalProperties(type="object", title="Key indicating the number of changes made to a given record",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$this->recordModel = \Vtiger_Record_Model::getInstanceById($this->controller->request->getInteger('record'), $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->recordModel->isViewable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \Api\Core\Exception('No permissions to view record', 403);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get related record list method.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @OA\Get(
- Exclude checks
Line exceeds 120 characters; contains 170 characters Open
* @OA\Schema(type="object", title="Operations on related records", description="Adding relations, removing relations, transferring records",
- Exclude checks
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'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->recordModel = \Vtiger_Record_Model::getInstanceById($this->controller->request->getInteger('record'), $moduleName);
- Exclude checks
Line exceeds 120 characters; contains 169 characters Open
$data[$fieldName]['value'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('postvalue'), $recordModel, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $allowedMethod = ['GET'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
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),
- Exclude checks
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),
- Exclude checks
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),
- Exclude checks
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"),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $recordModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \Api\Core\Exception('Record doesn\'t exist', 404);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->recordModel->getModule()->isTrackingEnabled()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @api
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
* @OA\Property(property="label", type="string", description="Translated field label", example="Name"),
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
->andWhere(['not in', 'status', [\ModTracker_Record_Model::DISPLAYED, \ModTracker_Record_Model::SHOW_HIDDEN_DATA]])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
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),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var \Vtiger_Record_Model Record model instance. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkAction(): void
- Exclude checks
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"),
- Exclude checks
Line exceeds 120 characters; contains 162 characters Open
* @OA\Property(property="targetModule", type="string", description="The name of the target related module", example="Contacts"),
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
* @OA\Property(property="targetId", type="integer", description="Id of the target related module", example=394),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $this->controller->request->getModule();
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
if ($this->controller->request->isEmpty('record', true) || !\App\Record::isExists($this->controller->request->getInteger('record'), $moduleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* path="/webservice/WebserviceStandard/{moduleName}/RecordHistory/{recordId}",
- Exclude checks
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"),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::checkAction();
- Exclude checks
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"),
- Exclude checks
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),
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
* @OA\Property(property="targetModuleLabel", type="string", description="Translated module name", example="Kontakt"),
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
$data[$fieldName]['from'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('prevalue'), $recordModel, true);
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
} elseif ($recordModel->isRelationLink() || $recordModel->isRelationUnLink() || $recordModel->isTransferLink() || $recordModel->isTransferUnLink()) {
- Exclude checks
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"),
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
* @OA\Property(property="rawStatus", type="string", description="The name of the untranslated label", example="LBL_UPDATED"),
- Exclude checks
Line exceeds 120 characters; contains 166 characters Open
$data[$fieldName]['to'] = $fieldInstance->getUITypeModel()->getHistoryDisplayValue($fieldModel->get('postvalue'), $recordModel, true);
- Exclude checks
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)),
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
'targetModuleLabel' => \App\Language::translateSingularModuleName($relationInstance->get('targetmodule')),
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
* @OA\Property(property="label", type="string", description="Translated field label", example="Name"),
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks
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"),
- Exclude checks