Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
see [bitrix24AccountRepositoryInterface has problem with contract tests design - can't add flusher](https://github.com/bitrix24/b24phpsdk/issues/74).
- Fixed error in bitrix24 account contract test data provider,
see [incorrect data in data provider](https://github.com/bitrix24/b24phpsdk/issues/77).
- Fixed typehints in `ActivityItemResult`, `ContactItemResult`,
see [wrong type hints in ActivityItemResult](https://github.com/bitrix24/b24phpsdk/issues/81)

<!--
## Unreleased
Expand Down
68 changes: 33 additions & 35 deletions src/Services/CRM/Activity/Result/ActivityItemResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,49 +27,47 @@
/**
* @see https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_fields.php
*
* @property-read int $ID // Activity ID
* @property-read int $OWNER_ID
* @property-read string $OWNER_TYPE_ID
* @property-read ActivityType $TYPE_ID
* @property-read string $PROVIDER_ID
* @property-read string $PROVIDER_TYPE_ID
* @property-read string $PROVIDER_GROUP_ID
* @property-read int $ASSOCIATED_ENTITY_ID // ID of an entity associated with the activity
* @property-read string $SUBJECT
* @property-read string $START_TIME
* @property-read string $END_TIME // Completion time
* @property-read CarbonImmutable $DEADLINE // Deadline
* @property-read boolean $COMPLETED // Completed
* @property-read ActivityStatus $STATUS
* @property-read int $RESPONSIBLE_ID
* @property-read ActivityPriority $PRIORITY
* @property-read ActivityNotifyType $NOTIFY_TYPE // Notification type with crm_enum_activitynotifytype type
* @property-read int $NOTIFY_VALUE
* @property-read string $DESCRIPTION // Description
* @property-read ActivityContentType $DESCRIPTION_TYPE // Description type with crm_enum_contenttype type
* @property-read ActivityDirectionType $DIRECTION // with crm_enum_activity direction type
* @property-read string|null $LOCATION // Location
* @property-read array $BINDINGS // Bindings
* @property-read boolean $COMPLETED // Completed
* @property-read array $COMMUNICATIONS // type crm_activity_communication
* @property-read CarbonImmutable $CREATED
* @property-read int $AUTHOR_ID // Activity author ID
* @property-read CarbonImmutable $LAST_UPDATED // Date of the last update date
* @property-read CarbonImmutable $DEADLINE // Deadline
* @property-read string $DESCRIPTION // Description
* @property-read ActivityContentType $DESCRIPTION_TYPE // Description type with crm_enum_contenttype type
* @property-read ActivityDirectionType $DIRECTION // with crm_enum_activity direction type
* @property-read int $EDITOR_ID // Editor
* @property-read array $SETTINGS
* @property-read CarbonImmutable $END_TIME // Completion time
* @property-read array $FILES // Added files with diskfile type
* @property-read int $ID // Activity ID
* @property-read boolean $IS_INCOMING_CHANNEL
* @property-read CarbonImmutable $LAST_UPDATED // Date of the last update date
* @property-read string|null $LOCATION // Location
* @property-read ActivityNotifyType $NOTIFY_TYPE
* @property-read int $NOTIFY_VALUE
* @property-read string|null $ORIGIN_ID
* @property-read string|null $ORIGINATOR_ID
* @property-read int $RESULT_STATUS
* @property-read int $RESULT_STREAM
* @property-read string|null $RESULT_SOURCE_ID
* @property-read array $PROVIDER_PARAMS
* @property-read int $OWNER_ID
* @property-read int $OWNER_TYPE_ID
* @property-read int $RESPONSIBLE_ID
* @property-read string $PROVIDER_ID
* @property-read string|null $PROVIDER_DATA
* @property-read string|null $PROVIDER_GROUP_ID
* @property-read array $PROVIDER_PARAMS
* @property-read string $PROVIDER_TYPE_ID
* @property-read int $RESULT_MARK
* @property-read string|null $RESULT_VALUE
* @property-read Money|null $RESULT_SUM
* @property-read Currency|null $RESULT_CURRENCY_ID
* @property-read int $AUTOCOMPLETE_RULE // Autocompletion
* @property-read string $BINDINGS // Bindings
* @property-read array $COMMUNICATIONS // type crm_activity_communication
* @property-read array $FILES // Added files with diskfile type
* @property-read string $WEBDAV_ELEMENTS
* @property-read int $RESULT_STATUS
* @property-read int $RESULT_STREAM
* @property-read Money|null $RESULT_SUM
* @property-read Money|null $RESULT_VALUE
* @property-read string|null $RESULT_SOURCE_ID
* @property-read array $SETTINGS
* @property-read CarbonImmutable $START_TIME
* @property-read ActivityStatus $STATUS
* @property-read string $SUBJECT
* @property-read ActivityType $TYPE_ID
* @property-read array $WEBDAV_ELEMENTS
*/
class ActivityItemResult extends AbstractCrmItem
{
Expand Down
6 changes: 6 additions & 0 deletions src/Services/CRM/Common/Result/AbstractCrmItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function __get($offset)

switch ($offset) {
case 'ID':
case 'NOTIFY_VALUE':
case 'ASSIGNED_BY_ID':
case 'CONTACT_IDS':
case 'RESPONSIBLE_ID':
Expand Down Expand Up @@ -85,6 +86,7 @@ public function __get($offset)
case 'RESULT_STREAM':
case 'LAST_ACTIVITY_BY':
case 'ADDRESS_LOC_ADDR_ID':
case 'OWNER_TYPE_ID':
if ($this->data[$offset] !== '' && $this->data[$offset] !== null) {
return (int)$this->data[$offset];
}
Expand Down Expand Up @@ -114,6 +116,7 @@ public function __get($offset)
case 'TAX_INCLUDED':
case 'CUSTOMIZED':
case 'COMPLETED':
case 'IS_INCOMING_CHANNEL':
return $this->data[$offset] === 'Y';
case 'DATE_CREATE':
case 'CREATED_DATE':
Expand All @@ -129,6 +132,8 @@ public function __get($offset)
case 'movedTime':
case 'lastActivityTime':
case 'LAST_ACTIVITY_TIME':
case 'START_TIME':
case 'END_TIME':
if ($this->data[$offset] !== '') {
return CarbonImmutable::createFromFormat(DATE_ATOM, $this->data[$offset]);
}
Expand All @@ -140,6 +145,7 @@ public function __get($offset)
case 'PRICE':
case 'DISCOUNT_SUM':
case 'RESULT_SUM':
case 'RESULT_VALUE':
if ($this->data[$offset] !== '' && $this->data[$offset] !== null) {
$var = $this->data[$offset] * 100;
return new Money((string)$var, new Currency($this->currency->getCode()));
Expand Down
6 changes: 3 additions & 3 deletions src/Services/CRM/Contact/Result/ContactItemResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@
* @property-read CarbonImmutable $LAST_ACTIVITY_TIME
* @property-read int $LAST_ACTIVITY_BY
* @property-read string|null $LAST_NAME
* @property-read string|null $LINK
* @property-read array|null $LINK
* @property-read int $MODIFY_BY_ID
* @property-read string $NAME
* @property-read string|null $ORIGIN_ID
* @property-read string|null $ORIGINATOR_ID
* @property-read string|null $ORIGIN_VERSION
* @property-read string $OPENED
* @property-read bool $OPENED
* @property-read Phone[] $PHONE
* @property-read string|null $POST
* @property-read string|null $PHOTO
* @property-read array|null $PHOTO
* @property-read string|null $SECOND_NAME
* @property-read string|null $SOURCE_DESCRIPTION
* @property-read string|null $SOURCE_ID
Expand Down
Loading
Loading