From 608cd140d8e788057d033b1c10ce765dfe3cfb3e Mon Sep 17 00:00:00 2001 From: mesilov Date: Sat, 17 Feb 2018 20:35:47 +0300 Subject: [PATCH 1/5] task#96 add userfield type support --- src/classes/userfieldtype/UserfieldType.php | 126 ++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 src/classes/userfieldtype/UserfieldType.php diff --git a/src/classes/userfieldtype/UserfieldType.php b/src/classes/userfieldtype/UserfieldType.php new file mode 100644 index 00000000..b5362bc2 --- /dev/null +++ b/src/classes/userfieldtype/UserfieldType.php @@ -0,0 +1,126 @@ +client->call('userfieldtype.add', array( + 'USER_TYPE_ID' => $userTypeId, + 'HANDLER' => $handlerUrl, + 'TITLE' => $title, + 'DESCRIPTION' => $description, + )); + } + + /** + * update userfield type + * + * @param $userTypeId + * @param $handlerUrl + * @param $title + * @param $description + * + * @return array + * @throws \Bitrix24\Exceptions\Bitrix24ApiException + * @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException + * @throws \Bitrix24\Exceptions\Bitrix24Exception + * @throws \Bitrix24\Exceptions\Bitrix24IoException + * @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException + * @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException + * @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException + * @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException + * @throws \Bitrix24\Exceptions\Bitrix24SecurityException + * @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException + * @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException + * @throws \Bitrix24\Exceptions\Bitrix24WrongClientException + */ + public function update($userTypeId, $handlerUrl, $title, $description) + { + return $this->client->call('userfieldtype.update', array( + 'USER_TYPE_ID' => $userTypeId, + 'HANDLER' => $handlerUrl, + 'TITLE' => $title, + 'DESCRIPTION' => $description, + )); + } + + /** + * delete userfield type + * + * @param $userTypeId + * + * @return array + * @throws \Bitrix24\Exceptions\Bitrix24ApiException + * @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException + * @throws \Bitrix24\Exceptions\Bitrix24Exception + * @throws \Bitrix24\Exceptions\Bitrix24IoException + * @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException + * @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException + * @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException + * @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException + * @throws \Bitrix24\Exceptions\Bitrix24SecurityException + * @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException + * @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException + * @throws \Bitrix24\Exceptions\Bitrix24WrongClientException + */ + public function delete($userTypeId) + { + return $this->client->call('userfieldtype.delete', array( + 'USER_TYPE_ID' => $userTypeId, + )); + } + + /** + * get list of userfield type + * + * @return array + * @throws \Bitrix24\Exceptions\Bitrix24ApiException + * @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException + * @throws \Bitrix24\Exceptions\Bitrix24Exception + * @throws \Bitrix24\Exceptions\Bitrix24IoException + * @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException + * @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException + * @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException + * @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException + * @throws \Bitrix24\Exceptions\Bitrix24SecurityException + * @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException + * @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException + * @throws \Bitrix24\Exceptions\Bitrix24WrongClientException + */ + public function getList() + { + return $this->client->call('userfieldtype.list'); + } +} \ No newline at end of file From 0593be913734c0bb0169bf557f5ef9d45e2945b6 Mon Sep 17 00:00:00 2001 From: mesilov Date: Sat, 17 Feb 2018 20:37:26 +0300 Subject: [PATCH 2/5] task#96 add placements --- src/presets/placement/Placement.php | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/presets/placement/Placement.php b/src/presets/placement/Placement.php index d00cfdda..3b7bf4b3 100644 --- a/src/presets/placement/Placement.php +++ b/src/presets/placement/Placement.php @@ -4,6 +4,7 @@ /** * Class Fields + * * @package Bitrix24\Presets\Placement */ class Placement @@ -40,4 +41,36 @@ class Placement * @var string */ const CRM_ACTIVITY_LIST_MENU = 'CRM_ACTIVITY_LIST_MENU'; + /** + * @var string + */ + const CRM_LEAD_DETAIL_TAB = 'CRM_LEAD_DETAIL_TAB'; + /** + * @var string + */ + const CRM_DEAL_DETAIL_TAB = 'CRM_DEAL_DETAIL_TAB'; + /** + * @var string + */ + const CRM_CONTACT_DETAIL_TAB = 'CRM_CONTACT_DETAIL_TAB'; + /** + * @var string + */ + const CRM_COMPANY_DETAIL_TAB = 'CRM_COMPANY_DETAIL_TAB'; + /** + * @var string + */ + const CRM_LEAD_DETAIL_ACTIVITY = 'CRM_LEAD_DETAIL_ACTIVITY'; + /** + * @var string + */ + const CRM_DEAL_DETAIL_ACTIVITY = 'CRM_DEAL_DETAIL_ACTIVITY'; + /** + * @var string + */ + const CRM_CONTACT_DETAIL_ACTIVITY = 'CRM_CONTACT_DETAIL_ACTIVITY'; + /** + * @var string + */ + const CRM_COMPANY_DETAIL_ACTIVITY = 'CRM_COMPANY_DETAIL_ACTIVITY'; } \ No newline at end of file From c640d3fa8e8fc4b64050ac0a00ee6ca921025e39 Mon Sep 17 00:00:00 2001 From: mesilov Date: Sun, 18 Feb 2018 10:36:51 +0300 Subject: [PATCH 3/5] task#96 add presents for request timing information --- CHANGELOG.md | 17 ++++++++++++++++ src/presets/timing.php | 44 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 src/presets/timing.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 829d6230..35f5599a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,21 @@ # bitrix24-php-sdk change log +## 0.6.0 (18.02.2018) +* add presets for request timing information +* add all methods for sonetgroup +* add method `crm.contact.userfield.update` +* add activities methods +* add exception `Bitrix24PortalRenamedException` +* add a pair of fields for the Lead +* add requisite support +* add method update to deal\userfield entity +* add `Product\Property` support +* add method `crm.product.delete` +* add method `crm.product.fields` +* add method `crm.product.property.types` +* add method `crm.product.property.delete` +* add methods for `\Bitrix24\CRM\Status` +* add new placement presets for detail page + ## 0.5.4 (8.07.2017) * add Callback for expired token. Fix pullrequest#63 by valga * add method `update` in class `Bitrix24\CRM\Product` diff --git a/src/presets/timing.php b/src/presets/timing.php new file mode 100644 index 00000000..61f2b806 --- /dev/null +++ b/src/presets/timing.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Bitrix24\Presets; + +/** + * Class Timing + * + * @package Bitrix24\Presets + */ +class Timing +{ + /** + * @var string + */ + const START = 'start'; + /** + * @var string + */ + const FINISH = 'finish'; + /** + * @var string + */ + const DURATION = 'duration'; + /** + * @var string + */ + const PROCESSING = 'processing'; + /** + * @var string + */ + const DATE_START = 'date_start'; + /** + * @var string + */ + const DATE_FINISH = 'date_finish'; +} \ No newline at end of file From 2c7ec6d7b34324af657daa8e7d8fc23a792ba1f2 Mon Sep 17 00:00:00 2001 From: mesilov Date: Sun, 18 Feb 2018 13:10:58 +0300 Subject: [PATCH 4/5] task#96 add support for face tracker entity --- CHANGELOG.md | 1 + src/classes/facetracker/client.php | 58 ++++++++++++++++++++++ src/classes/facetracker/user.php | 79 ++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 src/classes/facetracker/client.php create mode 100644 src/classes/facetracker/user.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 35f5599a..754b90cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # bitrix24-php-sdk change log ## 0.6.0 (18.02.2018) +* add support for `FaceTracker` entity * add presets for request timing information * add all methods for sonetgroup * add method `crm.contact.userfield.update` diff --git a/src/classes/facetracker/client.php b/src/classes/facetracker/client.php new file mode 100644 index 00000000..e15ce5ed --- /dev/null +++ b/src/classes/facetracker/client.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Bitrix24\FaceTracker; + +use Bitrix24\Bitrix24Entity; +use Bitrix24\Exceptions\Bitrix24Exception; + +/** + * Class Client + * + * @package Bitrix24\FaceTracker + */ +class Client extends Bitrix24Entity +{ + /** + * add client face to client library + * + * @see https://dev.1c-bitrix.ru/rest_help/faceid/face_client_add.php + * + * @param $clientPhoto string client base64 encoding photo + * + * @return array + * @throws Bitrix24Exception + */ + public function add($clientPhoto) + { + return $this->client->call('face.client.add', array('PHOTO' => $clientPhoto)); + } + + /** + * find client face in client gallery + * + * @see https://dev.1c-bitrix.ru/rest_help/faceid/face_client_identify.php + * + * @param $clientPhoto string client base64 encoding photo + * @param $isForceAdd + * + * @return array + * @throws Bitrix24Exception + */ + public function identify($clientPhoto, $isForceAdd) + { + return $this->client->call('face.client.identify', + array( + 'PHOTO' => $clientPhoto, + 'FORCE_ADD' => $isForceAdd === true ? 'Y' : 'N', + ) + ); + } +} \ No newline at end of file diff --git a/src/classes/facetracker/user.php b/src/classes/facetracker/user.php new file mode 100644 index 00000000..0a5f4f12 --- /dev/null +++ b/src/classes/facetracker/user.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Bitrix24\FaceTracker; + +use Bitrix24\Bitrix24Entity; +use Bitrix24\Exceptions\Bitrix24Exception; + +/** + * Class User + * + * @package Bitrix24\FaceTracker + */ +class User extends Bitrix24Entity +{ + /** + * add user face to client library + * + * @param $userId int user identifier + * @param $userPhoto string client base64 encoding photo + * + * @return array + * @throws Bitrix24Exception + */ + public function add($userId, $userPhoto) + { + return $this->client->call('face.user.add', + array( + 'PHOTO' => $userPhoto, + 'USER_ID' => $userId, + ) + ); + } + + /** + * find user face in user gallery + * + * @see https://dev.1c-bitrix.ru/rest_help/faceid/face_user_identify.php + * + * @param $clientPhoto string client base64 encoding photo + * + * @return array + * @throws Bitrix24Exception + */ + public function identify($clientPhoto) + { + return $this->client->call('face.user.identify', + array( + 'PHOTO' => $clientPhoto, + ) + ); + } + + /** + * delete face from user gallery + * + * @see https://dev.1c-bitrix.ru/rest_help/faceid/face_user_delete.php + * + * @param $faceId + * + * @return array + * @throws Bitrix24Exception + */ + public function delete($faceId) + { + return $this->client->call('face.user.delete', + array( + 'FACE_ID' => $faceId, + ) + ); + } +} \ No newline at end of file From 3f0b6f619d8bb62af8c92ebc8fe2803827908212 Mon Sep 17 00:00:00 2001 From: mesilov Date: Wed, 11 Apr 2018 01:54:38 +0300 Subject: [PATCH 5/5] task#102 add crm-robots support --- src/classes/bizproc/Robot.php | 112 ++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 src/classes/bizproc/Robot.php diff --git a/src/classes/bizproc/Robot.php b/src/classes/bizproc/Robot.php new file mode 100644 index 00000000..b2b739ae --- /dev/null +++ b/src/classes/bizproc/Robot.php @@ -0,0 +1,112 @@ +client->call('bizproc.activity.add', + array( + 'CODE' => $code, + 'HANDLER' => $handler, + 'AUTH_USER_ID' => $userId, + 'NAME' => $arName, + 'PROPERTIES' => $arProps, + )); + + return $arResult['result']; + } + + /** + * delete activity + * + * @param $code string + * + * @see https://dev.1c-bitrix.ru/rest_help/bizproc/bizproc_robot/robotdelete.php + * + * @return array + * @throws \Bitrix24\Exceptions\Bitrix24WrongClientException + * @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException + * @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException + * @throws \Bitrix24\Exceptions\Bitrix24SecurityException + * @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException + * @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException + * @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException + * @throws \Bitrix24\Exceptions\Bitrix24IoException + * @throws \Bitrix24\Exceptions\Bitrix24Exception + * @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException + * @throws \Bitrix24\Exceptions\Bitrix24ApiException + */ + public function delete($code) + { + $arResult = $this->client->call('bizproc.robot.delete', + array( + 'code' => $code, + ) + ); + + return $arResult['result']; + } + + /** + * get list of robots + * + * @see https://dev.1c-bitrix.ru/rest_help/bizproc/bizproc_robot/robotlist.php + * + * @return mixed + * @throws \Bitrix24\Exceptions\Bitrix24ApiException + * @throws \Bitrix24\Exceptions\Bitrix24EmptyResponseException + * @throws \Bitrix24\Exceptions\Bitrix24Exception + * @throws \Bitrix24\Exceptions\Bitrix24IoException + * @throws \Bitrix24\Exceptions\Bitrix24MethodNotFoundException + * @throws \Bitrix24\Exceptions\Bitrix24PaymentRequiredException + * @throws \Bitrix24\Exceptions\Bitrix24PortalDeletedException + * @throws \Bitrix24\Exceptions\Bitrix24PortalRenamedException + * @throws \Bitrix24\Exceptions\Bitrix24SecurityException + * @throws \Bitrix24\Exceptions\Bitrix24TokenIsExpiredException + * @throws \Bitrix24\Exceptions\Bitrix24TokenIsInvalidException + * @throws \Bitrix24\Exceptions\Bitrix24WrongClientException + */ + public function getList() + { + $arResult = $this->client->call('bizproc.robot.list', + array() + ); + + return $arResult['result']; + } +} \ No newline at end of file