Skip to content

Commit 7a8be99

Browse files
authored
Merge pull request #209 from bitrix24/dev
Build 1.5.0
2 parents a32fb34 + 352f5b3 commit 7a8be99

File tree

114 files changed

+9202
-267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+9202
-267
lines changed

.php-cs-fixer.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@
77
$finder = Finder::create()
88
->in(__DIR__ . '/src/Infrastructure/Console/Commands/')
99
->in(__DIR__ . '/src/Services/CRM/Address/')
10-
->in(__DIR__ . '/src/Services/CRM/Item/Service/')
10+
->in(__DIR__ . '/src/Services/CRM/Item/')
1111
->in(__DIR__ . '/src/Services/CRM/Contact/')
1212
->in(__DIR__ . '/src/Services/CRM/Quote/')
1313
->in(__DIR__ . '/src/Services/CRM/Lead/')
1414
->in(__DIR__ . '/src/Services/CRM/Currency/')
15+
->in(__DIR__ . '/src/Services/CRM/Requisites/')
16+
->in(__DIR__ . '/src/Services/CRM/Status/')
17+
->in(__DIR__ . '/src/Services/CRM/Timeline/')
18+
->in(__DIR__ . '/src/Services/Entity/Section/')
19+
->in(__DIR__ . '/src/Services/Department/')
1520
->name('*.php')
1621
->exclude(['vendor', 'storage', 'docker', 'docs']) // Exclude directories
1722
->ignoreDotFiles(true)

CHANGELOG.md

Lines changed: 113 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,124 @@
11
# b24-php-sdk change log
22

3+
## UPCOMING 1.6.0 – 2025.09.01
4+
5+
## 1.5.0 – 2025.08.01
6+
7+
### Added
8+
9+
- Added service `Services\Entity\Section\Service\Section` with support methods,
10+
see [crm.entity.section.* methods](https://github.com/bitrix24/b24phpsdk/issues/200):
11+
- `get` retrieve a list of storage sections, with batch calls support
12+
- `add` add a storage section, with batch calls support
13+
- `update` update a storage section, with batch calls support
14+
- `delete` delete a storage section, with batch calls support
15+
- Added service `Services\Entity\Item\Property\Service\Property` with support methods:
16+
- `get` retrieve a list of additional properties of storage elements, with batch calls support
17+
- `add` add an additional property to storage elements, with batch calls support
18+
- `update` update an additional property of storage elements, with batch calls support
19+
- `delete` delete an additional property of storage elements, with batch calls support
20+
- Added service `Services\Department\Service\Department` with support methods,
21+
see [department.* methods](https://github.com/bitrix24/b24phpsdk/issues/204):
22+
- `fields` gets the department fields reference
23+
- `get` retrieves a list of departments, with batch calls support
24+
- `add` creates a department, with batch calls support
25+
- `delete` deletes a department, with batch calls support
26+
- `update` modifies a department, with batch calls support
27+
- `countByFilter` count departments by filter
28+
- Added service `CRM\Requisites\Service\RequisiteUserfield` with support methods,
29+
see [add crm.requisite.userfield.* methods](https://github.com/bitrix24/b24phpsdk/issues/188):
30+
- `add` add userfield to requisite
31+
- `get` get userfield to requisite
32+
- `list` list userfields
33+
- `delete` delete userfield
34+
- `update` update userfield
35+
- Added service `CRM\Requisites\Service\RequisiteBankdetail` with support methods:
36+
- `add` add bank detail to requisite
37+
- `get` get bank detail to requisite
38+
- `fields` get fields for bank details
39+
- `list` list bank details
40+
- `delete` delete bank detail
41+
- `update` update bank detail
42+
- `countByFilter` count bank details by filter
43+
- Added service `CRM\Requisites\Service\RequisiteLink` with support methods:
44+
- `register` registers the link between requisites and an object
45+
- `unregister` removes the link between requisites and an object
46+
- `fields` get a formal description of the fields of the requisites link
47+
- `get` returns the link between requisites and an object
48+
- `list` returns a list of links between requisites based on a filter
49+
- `countByFilter` count links by filter
50+
- Added service `CRM\Requisites\Service\RequisitePresetField` with support methods:
51+
- `add` adds a customizable field to the requisites template
52+
- `get` returns the description of the custom field in the requisites template by identifier
53+
- `fields` returns the description of the custom field in the requisites template by identifier
54+
- `list` returns a list of all custom fields for a specific requisites template
55+
- `delete` deletes a customizable field from the requisites template
56+
- `update` modifies a custom field in the requisites template
57+
- `availabletoadd` returns fields available for addition to the specified requisites template
58+
- Added service `Services\CRM\Status\Service\Status` with support methods,
59+
see [crm.status.* methods](https://github.com/bitrix24/b24phpsdk/issues/194):
60+
- `fields` returns descriptions of reference book fields
61+
- `get` returns an element of the reference book by its identifier
62+
- `list` returns a list of elements of the reference book by filter, with batch calls support
63+
- `add` creates a new element in the specified reference book, with batch calls support
64+
- `delete` deletes an element from the reference book, with batch calls support
65+
- `update` updates an existing element of the reference book, with batch calls support
66+
- `countByFilter` counts elements of the reference book by filter
67+
- Added service `Services\CRM\Status\Service\StatusEntity` with support methods,
68+
- `items` returns elements of the reference book by its symbolic identifier
69+
- `types` returns descriptions of reference book types
70+
- Added service `Services\CRM\Timeline\Service\Comment` with support methods,
71+
see [crm.timeline.comment.* methods](https://github.com/bitrix24/b24phpsdk/issues/196):
72+
- `fields` retrieves a list of timeline comment fields
73+
- `get` retrieves information about a comment
74+
- `list` retrieves a list of all comments for a CRM entity, with batch calls support
75+
- `add` adds a new comment to the timeline, with batch calls support
76+
- `delete` deletes a comment, with batch calls support
77+
- `update` updates a comment, with batch calls support
78+
- `countByFilter` count comments by filter
79+
- Added support for events:
80+
- `OnCrmTimelineCommentAdd`
81+
- `OnCrmTimelineCommentDelete`
82+
- `OnCrmTimelineCommentUpdate`
83+
- Added service `Services\CRM\Timeline\Service\Bindings` with support methods:
84+
- `fields` retrieves the fields of the link between CRM entities and the timeline record
85+
- `list` retrieves a list of links for a timeline record, with batch calls support
86+
- `bind` adds a link between a timeline record and a CRM entity, with batch calls support
87+
- `unbind` removes a link between a timeline record and a CRM entity, with batch calls support
88+
- `countByFilter` count links between a timeline record and CRM entities by filter
89+
- Added service `Services\CRM\Item\Productrow\Service\Productrow` with support methods,
90+
see [crm.item.productrow.* methods](https://github.com/bitrix24/b24phpsdk/issues/198):
91+
- `fields` retrieves a list of product item fields
92+
- `set` associates a product item with a CRM object
93+
- `get` retrieves information about a product item by id
94+
- `list` retrieves a list of product items, with batch calls support
95+
- `add` adds a product item, with batch calls support
96+
- `delete` deletes a product item, with batch calls support
97+
- `update` updates a product item
98+
- `getAvailableForPayment` retrieves a list of unpaid products
99+
- `countByFilter` counts product items by filter
100+
101+
### Fixed
102+
- Fixed typehints in Contact batch for method `add`, [see details](https://github.com/bitrix24/b24phpsdk/issues/202)
103+
104+
### Changed
105+
- Fixed constructor arguments in tests ApplicationInstallations [see details](https://github.com/bitrix24/b24phpsdk/issues/191)
106+
- Bump giggsey/libphonenumber-for-php version to ^8|^9
107+
108+
### Statistics
109+
```
110+
Bitrix24 API-methods count: 1166
111+
Supported in bitrix24-php-sdk methods count: 362
112+
Coverage percentage: 31.05%
113+
```
114+
3115
## 1.4.0 – 2025.07.01
4116

5117
### Added
6118

7119
- Added service `Services\CRM\Lead\Service\LeadContact` with support methods,
8120
see [crm.lead.contact.* methods](https://github.com/bitrix24/b24phpsdk/issues/170):
9-
- `fields` get fiels for lead contact connection
121+
- `fields` get fields for lead contact connection
10122
- `setItems` set contacts related with lead
11123
- `get` get contacts related to lead
12124
- `deleteItems` delete all relations for lead

Makefile

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ integration_tests_lead_details:
227227
integration_tests_scope_automation:
228228
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_scope_automation
229229

230-
.PHONY: integration_tests_item_details
231-
integration_tests_item_details:
232-
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_item_details
230+
.PHONY: integration_tests_crm_item
231+
integration_tests_crm_item:
232+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_item
233233

234234
.PHONY: integration_tests_lead_productrows
235235
integration_tests_lead_productrows:
@@ -238,6 +238,30 @@ integration_tests_lead_productrows:
238238
.PHONY: integration_tests_crm_quote
239239
integration_tests_crm_quote:
240240
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_quote
241+
242+
.PHONY: integration_tests_crm_requisite
243+
integration_tests_crm_requisite:
244+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_requisite
245+
246+
.PHONY: integration_tests_crm_preset_field
247+
integration_tests_crm_preset_field:
248+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_preset_field
249+
250+
.PHONY: integration_tests_crm_requisite_userfield
251+
integration_tests_crm_requisite_userfield:
252+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_requisite_userfield
253+
254+
.PHONY: integration_tests_crm_status
255+
integration_tests_crm_status:
256+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_status
257+
258+
.PHONY: integration_tests_crm_timeline
259+
integration_tests_crm_timeline:
260+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_timeline
261+
262+
.PHONY: integration_tests_department
263+
integration_tests_department:
264+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_department
241265

242266
# work dev environment
243267
.PHONY: php-dev-server-up

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If You work on Windows:
2828
- please use [WSL - Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/)
2929
- if your filesystem is NTFS, You can disable flag `git config --global core.protectNTFS false` for checkout folders started with dot.
3030

31-
Or add `"bitrix24/b24phpsdk": "1.4.*"` to `composer.json` of your application.
31+
Or add `"bitrix24/b24phpsdk": "1.5.*"` to `composer.json` of your application.
3232

3333
## B24PhpSdk ✨FEATURES✨
3434

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"ext-intl": "*",
3232
"psr/log": "^2 || ^3",
3333
"fig/http-message-util": "^1",
34-
"giggsey/libphonenumber-for-php": "^8",
34+
"giggsey/libphonenumber-for-php": "^8 || ^9",
3535
"darsyn/ip": "^4 || ^5",
3636
"nesbot/carbon": "^3",
3737
"moneyphp/money": "^3 || ^4",

phpstan.neon.dist

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ parameters:
1414
- tests/Integration/Services/CRM/Address
1515
- tests/Integration/Services/CRM/Deal/Service/DealRecurringTest.php
1616
- tests/Integration/Services/CRM/Lead/Service/LeadContactTest.php
17-
- tests/Integration/Services/CRM/Item/Service/ItemDetailsConfigurationTest.php
17+
- tests/Integration/Services/CRM/Item
1818
- tests/Integration/Services/CRM/Deal/Service/DealDetailsConfigurationTest.php
1919
- tests/Integration/Services/CRM/Lead/Service/LeadDetailsConfigurationTest.php
2020
- tests/Integration/Services/CRM/Contact/Service/ContactDetailsConfigurationTest.php
@@ -26,6 +26,13 @@ parameters:
2626
- tests/Integration/Services/CRM/Quote/Service/QuoteProductRowsTest.php
2727
- tests/Integration/Services/CRM/Lead/Service/LeadUserfieldTest.php
2828
- tests/Integration/Services/CRM/Currency
29+
- tests/Integration/Services/CRM/Requisites
30+
excludePaths:
31+
- tests/Integration/Services/CRM/Requisites/Service/RequisiteUserfieldUseCaseTest.php
32+
- tests/Integration/Services/CRM/Status
33+
- tests/Integration/Services/CRM/Timeline
34+
- tests/Integration/Services/Entity/Section
35+
- tests/Integration/Services/Department
2936
bootstrapFiles:
3037
- tests/bootstrap.php
3138
parallel:

phpunit.xml.dist

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
<testsuite name="integration_tests_lead_contacts">
7474
<file>./tests/Integration/Services/CRM/Lead/Service/LeadContactTest.php</file>
7575
</testsuite>
76-
<testsuite name="integration_tests_item_details">
77-
<file>./tests/Integration/Services/CRM/Item/Service/ItemDetailsConfigurationTest.php</file>
76+
<testsuite name="integration_tests_crm_item">
77+
<directory>./tests/Integration/Services/CRM/Item/Productrow/</directory>
7878
</testsuite>
7979
<testsuite name="integration_tests_scope_automation">
8080
<directory>./tests/Integration/Services/CRM/Automation/</directory>
@@ -85,6 +85,24 @@
8585
<testsuite name="integration_tests_crm_quote">
8686
<directory>./tests/Integration/Services/CRM/Quote/</directory>
8787
</testsuite>
88+
<testsuite name="integration_tests_crm_requisite">
89+
<file>./tests/Integration/Services/CRM/Requisites/Service/RequisiteLinkTest.php</file>
90+
</testsuite>
91+
<testsuite name="integration_tests_crm_preset_field">
92+
<file>./tests/Integration/Services/CRM/Requisites/Service/RequisitePresetFieldTest.php</file>
93+
</testsuite>
94+
<testsuite name="integration_tests_crm_requisite_userfield">
95+
<file>./tests/Integration/Services/CRM/Requisites/Service/RequisiteUserfieldTest.php</file>
96+
</testsuite>
97+
<testsuite name="integration_tests_crm_status">
98+
<directory>./tests/Integration/Services/CRM/Status/</directory>
99+
</testsuite>
100+
<testsuite name="integration_tests_crm_timeline">
101+
<directory>./tests/Integration/Services/CRM/Timeline/</directory>
102+
</testsuite>
103+
<testsuite name="integration_tests_department">
104+
<directory>./tests/Integration/Services/Department/</directory>
105+
</testsuite>
88106
</testsuites>
89107
<source>
90108
<include>

rector.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
__DIR__ . '/tests/Integration/Services/Placement',
3939
__DIR__ . '/src/Services/CRM/Deal',
4040
__DIR__ . '/tests/Integration/Services/CRM/Deal/Service',
41-
__DIR__ . '/src/Services/CRM/Item/Service',
42-
__DIR__ . '/tests/Integration/Services/CRM/Item/Service',
41+
__DIR__ . '/src/Services/CRM/Item',
42+
__DIR__ . '/tests/Integration/Services/CRM/Item',
4343
__DIR__ . '/src/Services/CRM/Deal/Service/DealDetailsConfiguration.php',
4444
__DIR__ . '/tests/Integration/Services/CRM/Deal/Service/DealDetailsConfigurationTest.php',
4545
__DIR__ . '/src/Services/CRM/Contact/Service/ContactDetailsConfiguration.php',
@@ -50,6 +50,14 @@
5050
__DIR__ . '/tests/Integration/Services/CRM/Quote/Service',
5151
__DIR__ . '/src/Services/CRM/Currency',
5252
__DIR__ . '/tests/Integration/Services/CRM/Currency',
53+
__DIR__ . '/src/Services/CRM/Requisites',
54+
__DIR__ . '/tests/Integration/Services/CRM/Requisites',
55+
__DIR__ . '/src/Services/CRM/Timeline',
56+
__DIR__ . '/tests/Integration/Services/CRM/Timeline',
57+
__DIR__ . '/src/Services/Entity/Section',
58+
__DIR__ . '/tests/Integration/Services/Entity/Section',
59+
__DIR__ . '/src/Services/Department',
60+
__DIR__ . '/tests/Integration/Services/Department',
5361
__DIR__ . '/tests/Unit/',
5462
])
5563
->withCache(cacheDirectory: __DIR__ . '.cache/rector')

src/Core/ApiClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ApiClient implements ApiClientInterface
3838
/**
3939
* @const string
4040
*/
41-
protected const SDK_VERSION = '1.4.0';
41+
protected const SDK_VERSION = '1.5.0';
4242

4343
protected const SDK_USER_AGENT = 'b24-php-sdk-vendor';
4444

src/Core/Batch.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@
3434
*/
3535
class Batch implements BatchOperationsInterface
3636
{
37+
protected const ENTITY_METHODS = [
38+
'entity.item.delete',
39+
'entity.section.delete',
40+
'entity.item.get',
41+
'entity.section.get',
42+
'entity.item.update',
43+
'entity.section.update',
44+
'entity.item.property.update',
45+
];
46+
3747
protected const MAX_BATCH_PACKET_SIZE = 50;
3848

3949
protected const MAX_ELEMENTS_IN_PAGE = 50;
@@ -144,7 +154,7 @@ public function deleteEntityItems(
144154

145155
$parameters = $useFieldsInsteadOfId ? ['fields' => $itemId] : ['ID' => $itemId];
146156
// TODO: delete after migration to RestAPI v2
147-
if ($apiMethod === 'entity.item.delete') {
157+
if (in_array($apiMethod, self::ENTITY_METHODS)) {
148158
$parameters = array_merge($parameters, $additionalParameters);
149159
}
150160

@@ -218,7 +228,7 @@ public function updateEntityItems(string $apiMethod, array $entityItems): Genera
218228
);
219229
}
220230

221-
if ($apiMethod !== 'entity.item.update') {
231+
if (!in_array($apiMethod, self::ENTITY_METHODS)) {
222232
if (!array_key_exists('fields', $entityItem)) {
223233
throw new InvalidArgumentException(
224234
sprintf('array key «fields» not found in entity item with id %s', $entityItemId)
@@ -482,7 +492,7 @@ public function getTraversableList(
482492
// todo wait new api version
483493
if ($apiMethod !== 'user.get') {
484494
$defaultOrderKey = 'order';
485-
$orderKey = $apiMethod === 'entity.item.get' ? 'SORT' : $defaultOrderKey;
495+
$orderKey = in_array($apiMethod, self::ENTITY_METHODS) ? 'SORT' : $defaultOrderKey;
486496

487497
$params = [
488498
$orderKey => $this->getReverseOrder($order),

0 commit comments

Comments
 (0)