From cffa864c4064a4868692014e99864a1d8d04b380 Mon Sep 17 00:00:00 2001 From: bmoiseenko Date: Wed, 6 Mar 2024 14:49:25 +0300 Subject: [PATCH 1/2] Account invoices settings invoices catalog id added --- src/AmoCRM/Models/AccountModel.php | 3 ++- .../AccountSettings/InvoicesSettings.php | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/AmoCRM/Models/AccountModel.php b/src/AmoCRM/Models/AccountModel.php index f2fac298..f1e31278 100644 --- a/src/AmoCRM/Models/AccountModel.php +++ b/src/AmoCRM/Models/AccountModel.php @@ -446,7 +446,8 @@ public static function fromArray(array $account): self if (isset($account[self::INVOICES_SETTINGS])) { $accountModel->setInvoicesSettings(new InvoicesSettings( - $account[self::INVOICES_SETTINGS]['lang'] ?? null + $account[self::INVOICES_SETTINGS]['lang'] ?? null, + $account[self::INVOICES_SETTINGS]['invoices_catalog_id'] ?? null )); } diff --git a/src/AmoCRM/Models/AccountSettings/InvoicesSettings.php b/src/AmoCRM/Models/AccountSettings/InvoicesSettings.php index 3156382c..b9009d63 100644 --- a/src/AmoCRM/Models/AccountSettings/InvoicesSettings.php +++ b/src/AmoCRM/Models/AccountSettings/InvoicesSettings.php @@ -11,10 +11,17 @@ class InvoicesSettings implements Arrayable */ protected $lang; + /** + * @var int|null + */ + protected $invoicesCatalogId; + public function __construct( - ?string $lang + ?string $lang, + ?int $invoicesCatalogId ) { $this->lang = $lang; + $this->invoicesCatalogId = $invoicesCatalogId; } /** @@ -24,6 +31,7 @@ public function toArray(): array { return [ 'lang' => $this->getLang(), + 'invoices_catalog_id' => $this->getInvoicesCatalogId(), ]; } @@ -34,4 +42,12 @@ public function getLang(): ?string { return $this->lang; } + + /** + * @return int|null + */ + public function getInvoicesCatalogId(): ?int + { + return $this->invoicesCatalogId; + } } From 0818b53214b051bf10e6659e27889ea4113c363c Mon Sep 17 00:00:00 2001 From: bmoiseenko Date: Mon, 18 Mar 2024 17:56:59 +0300 Subject: [PATCH 2/2] set invoice link if set --- src/AmoCRM/EntitiesServices/CatalogElements.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/AmoCRM/EntitiesServices/CatalogElements.php b/src/AmoCRM/EntitiesServices/CatalogElements.php index 2b1691f3..c136bd10 100644 --- a/src/AmoCRM/EntitiesServices/CatalogElements.php +++ b/src/AmoCRM/EntitiesServices/CatalogElements.php @@ -154,6 +154,10 @@ protected function processModelAction(BaseApiModel $apiModel, array $entity): vo if (isset($entity['catalog_id'])) { $apiModel->setCatalogId($entity['catalog_id']); } + + if (isset($entity['invoice_link'])) { + $apiModel->setInvoiceLink($entity['invoice_link']); + } }