Internal API EN: различия между версиями

Материал из WiKi - UserSide
([IronBot] Sync EN/UK localization from RU)
 
([IronBot] Fix EN localization text)
 
Строка 1: Строка 1:
'''en''' | [[Internal_API_UK|uk]] | [[Internal_API|ru]]
'''en''' | [[Internal_API_UK|uk]] | [[Internal_API|ru]]


Custom Events v2 - это локальная система внутренних событий ERP. Она выполняет клиентский PHP-код внутри текущего PHP-процесса ERP без HTTP-запросов, веб-хуков и внешних очередей.
Custom Events v2 is a local ERP internal event system. It runs customer PHP code inside the current ERP PHP process without HTTP requests, webhooks, or external queues.


Старый механизм <code>legacy/Config/custom_api.txt</code> с функцией <code>api_function(...)</code> остается legacy-контрактом. В v2 старые названия используются только для карты совместимости. Новый клиентский код должен использовать константы <code>CustomEvent::...</code>.
The old <code>legacy/Config/custom_api.txt</code> mechanism with the <code>api_function(...)</code> function remains a legacy contract. In v2, old names are used only for the compatibility map. New customer code must use <code>CustomEvent::...</code> constants.


== Файлы ==
== Files ==


Рабочий клиентский файл один:
There is one working customer file:


<pre>evolution/CustomEvents/v2/handlers.php</pre>
<pre>evolution/CustomEvents/v2/handlers.php</pre>


Пример:
Example:


<pre>evolution/CustomEvents/v2/handlers.example.php</pre>
<pre>evolution/CustomEvents/v2/handlers.example.php</pre>


Список всех констант:
List of all constants:


<pre>evolution/CustomEvents/Runtime/v2/CustomEvent.php</pre>
<pre>evolution/CustomEvents/Runtime/v2/CustomEvent.php</pre>


Карта старых имен в новые события:
Map of old names to new events:


<pre>evolution/CustomEvents/Runtime/v2/CustomEventLegacyEventMap.php</pre>
<pre>evolution/CustomEvents/Runtime/v2/CustomEventLegacyEventMap.php</pre>


Кеш:
Cache:


<pre>var/cache/CustomEvents/handlers.v2.cache.php</pre>
<pre>var/cache/CustomEvents/handlers.v2.cache.php</pre>


Лог:
Log:


<pre>var/log/custom-events-v2.log</pre>
<pre>var/log/custom-events-v2.log</pre>


== Как писать обработчики ==
== How to write handlers ==


Используется одна функция регистрации: <code>internal_event(...)</code>.
One registration function is used: <code>internal_event(...)</code>.


В одном файле можно зарегистрировать несколько обработчиков подряд:
Several handlers can be registered one after another in the same file:


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
Строка 51: Строка 51:
     static function ($event): bool|string {
     static function ($event): bool|string {
         if ((int)$event->get('new_status_id') === 0) {
         if ((int)$event->get('new_status_id') === 0) {
             return 'Запрещено переводить абонента в этот статус';
             return 'Changing the customer to this status is forbidden';
         }
         }


Строка 63: Строка 63:
         $customerId = (int)$event->get('customer_id');
         $customerId = (int)$event->get('customer_id');


         return '<div>Дополнительная информация по абоненту #' . $customerId . '</div>';
         return '<div>Additional customer information #' . $customerId . '</div>';
     },
     },
);
);
</syntaxhighlight>
</syntaxhighlight>


В обработчик всегда приходит один параметр <code>$event</code>.
The handler always receives one parameter: <code>$event</code>.


Данные читаются без типовых оберток:
Data is read without type wrappers:


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
Строка 78: Строка 78:
</syntaxhighlight>
</syntaxhighlight>


Если нужен конкретный тип, приводите значение в своем коде:
If a specific type is required, cast the value in your code:


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
Строка 85: Строка 85:
</syntaxhighlight>
</syntaxhighlight>


== Результат обработчика ==
== Handler result ==


Обработчик возвращает простое значение:
The handler returns a simple value:


{| class="wikitable"
{| class="wikitable"
! Возврат
! Return
! Значение
! Meaning
|-
|-
| <code>true</code>
| <code>true</code>
| Обработчик выполнен успешно
| The handler completed successfully
|-
|-
| <code>false</code>
| <code>false</code>
| Для события <code>*.before</code> запретить штатную операцию
| For a <code>*.before</code> event, block the standard operation
|-
|-
| <code>null</code>
| <code>null</code>
| Ничего не менять
| Do not change anything
|-
|-
| строка
| string
| Для <code>*.before</code> запретить операцию с текстом причины; для <code>*.render</code> вывести строку/HTML
| For <code>*.before</code>, block the operation with a reason text; for <code>*.render</code>, output a string or HTML
|}
|}


События <code>*.before</code> могут отменять штатную операцию. Остальные события не должны отменять уже выполненное действие.
<code>*.before</code> events can cancel the standard operation. Other events must not cancel an action that has already been completed.


== Пример запрета операции ==
== Example: blocking an operation ==


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
Строка 115: Строка 115:
     static function ($event): bool|string {
     static function ($event): bool|string {
         if ((int)$event->get('new_status_id') === 0) {
         if ((int)$event->get('new_status_id') === 0) {
             return 'Запрещено переводить абонента в этот статус';
             return 'Changing the customer to this status is forbidden';
         }
         }


Строка 123: Строка 123:
</syntaxhighlight>
</syntaxhighlight>


== Пример вывода HTML ==
== Example: outputting HTML ==


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
Строка 131: Строка 131:
         $customerId = (int)$event->get('customer_id');
         $customerId = (int)$event->get('customer_id');


         return '<div>Дополнительная информация по абоненту #' . $customerId . '</div>';
         return '<div>Additional customer information #' . $customerId . '</div>';
     },
     },
);
);
</syntaxhighlight>
</syntaxhighlight>


== Проверка, кеш и лог ==
== Validation, cache, and log ==


При изменении <code>evolution/CustomEvents/v2/handlers.php</code> ERP проверяет синтаксис через <code>php -l</code>. Если синтаксис корректный, файл копируется в <code>var/cache/CustomEvents/handlers.v2.cache.php</code>.
When <code>evolution/CustomEvents/v2/handlers.php</code> changes, ERP checks the syntax with <code>php -l</code>. If the syntax is valid, the file is copied to <code>var/cache/CustomEvents/handlers.v2.cache.php</code>.


Runtime-лог пишется в JSON Lines в <code>var/log/custom-events-v2.log</code>. Одна строка - один вызов обработчика, ошибка или факт отсутствия обработчиков.
The runtime log is written as JSON Lines to <code>var/log/custom-events-v2.log</code>. One line is one handler call, error, or fact that no handlers exist.


Пример строки:
Example line:


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
Строка 148: Строка 148:
</syntaxhighlight>
</syntaxhighlight>


Лог ротируется в:
The log is rotated to:


<pre>var/log/custom-events-v2.log.1</pre>
<pre>var/log/custom-events-v2.log.1</pre>


== Ошибки ==
== Errors ==


Если в обработчике возникнет ошибка, ERP запишет ее в лог и продолжит работу по правилам конкретного события.
If an error occurs in a handler, ERP writes it to the log and continues according to the rules of the specific event.


Обработчик выполняется внутри того же PHP-процесса, что и ядро ERP. Через ядро проходят тысячи операций, и медленный или ошибочный клиентский код может остановить или дестабилизировать работу всей системы. Не используйте <code>exit</code>, <code>die</code>, бесконечные циклы, тяжелые SQL-запросы без ограничений и долгие внешние операции. Держите обработчики короткими и предсказуемыми.
The handler runs inside the same PHP process as the ERP core. Thousands of operations pass through the core, so slow or faulty customer code can stop or destabilize the entire system. Do not use <code>exit</code>, <code>die</code>, endless loops, heavy SQL queries without limits, or long external operations. Keep handlers short and predictable.


== Рекомендации ==
== Recommendations ==


* Используйте только константы <code>CustomEvent::...</code>.
* Use only <code>CustomEvent::...</code> constants.
* Не пишите строку события вручную.
* Do not write the event string manually.
* Делайте обработчики короткими.
* Keep handlers short.
* Не вызывайте HTTP/webhook из высокочастотных событий.
* Do not call HTTP/webhook from high-frequency events.
* Не используйте <code>exit</code>, <code>die</code>, бесконечные циклы и тяжелые выборки без ограничений.
* Do not use <code>exit</code>, <code>die</code>, endless loops, or heavy selections without limits.
* Возвращайте <code>true</code>, <code>false</code>, <code>null</code> или строку.
* Return <code>true</code>, <code>false</code>, <code>null</code>, or a string.


== Все события ==
== All events ==


Ниже перечислены все события v2. Полный технический список констант находится в <code>evolution/CustomEvents/Runtime/v2/CustomEvent.php</code>.
All v2 events are listed below. The complete technical list of constants is in <code>evolution/CustomEvents/Runtime/v2/CustomEvent.php</code>.


Поля <code>event</code> указаны как текущий контракт данных.
The <code>event</code> fields are the current data contract.


=== Здания ===
=== Buildings ===


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::BUILDING_CREATED</code>
| <code>CustomEvent::BUILDING_CREATED</code>
| После создания здания
| After creating a building
| <code>building_id</code>, <code>data</code>
| <code>building_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::BUILDING_CHANGED</code>
| <code>CustomEvent::BUILDING_CHANGED</code>
| После редактирования здания
| After editing a building
| <code>building_id</code>, <code>data</code>
| <code>building_id</code>, <code>data</code>
|}
|}


=== Коммутация ===
=== Commutation ===


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::COMMUTATION_CREATE_BEFORE</code>
| <code>CustomEvent::COMMUTATION_CREATE_BEFORE</code>
| Перед созданием коммутации между объектами
| Before creating commutation between objects
| <code>source_type</code>, <code>source_id</code>, <code>target_type</code>, <code>target_id</code>, <code>data</code>
| <code>source_type</code>, <code>source_id</code>, <code>target_type</code>, <code>target_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::COMMUTATION_DELETE_BEFORE</code>
| <code>CustomEvent::COMMUTATION_DELETE_BEFORE</code>
| Перед удалением коммутации между объектами
| Before deleting commutation between objects
| <code>source_type</code>, <code>source_id</code>, <code>target_type</code>, <code>target_id</code>, <code>data</code>
| <code>source_type</code>, <code>source_id</code>, <code>target_type</code>, <code>target_id</code>, <code>data</code>
|}
|}


=== Главная страница ===
=== Dashboard ===


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::DASHBOARD_TOP_CONTENT_RENDER</code>
| <code>CustomEvent::DASHBOARD_TOP_CONTENT_RENDER</code>
| При выводе текста в начальной части главной страницы
| When rendering text at the top of the dashboard
| <code>employee_id</code>, <code>data</code>
| <code>employee_id</code>, <code>data</code>
|}
|}


=== Оборудование ===
=== Equipment ===


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::DEVICE_CHANGED</code>
| <code>CustomEvent::DEVICE_CHANGED</code>
| После редактирования оборудования
| After editing equipment
| <code>device_id</code>, <code>device_type</code>, <code>data</code>
| <code>device_id</code>, <code>device_type</code>, <code>data</code>
|-
|-
| <code>CustomEvent::DEVICE_NOTIFICATION_DOWN</code>
| <code>CustomEvent::DEVICE_NOTIFICATION_DOWN</code>
| При фиксации недоступности оборудования
| When equipment unavailability is recorded
| <code>device_id</code>, <code>device_type</code>, <code>ip</code>, <code>data</code>
| <code>device_id</code>, <code>device_type</code>, <code>ip</code>, <code>data</code>
|-
|-
| <code>CustomEvent::DEVICE_NOTIFICATION_UP</code>
| <code>CustomEvent::DEVICE_NOTIFICATION_UP</code>
| При восстановлении доступности оборудования
| When equipment availability is restored
| <code>device_id</code>, <code>device_type</code>, <code>ip</code>, <code>data</code>
| <code>device_id</code>, <code>device_type</code>, <code>ip</code>, <code>data</code>
|-
|-
| <code>CustomEvent::DEVICE_INTERFACE_PORT_NUMBER_RENDER</code>
| <code>CustomEvent::DEVICE_INTERFACE_PORT_NUMBER_RENDER</code>
| При выводе номера порта в таблице интерфейсов
| When rendering the port number in the interface table
| <code>device_id</code>, <code>interface_id</code>, <code>port_number</code>, <code>data</code>
| <code>device_id</code>, <code>interface_id</code>, <code>port_number</code>, <code>data</code>
|-
|-
| <code>CustomEvent::DEVICE_INTERFACE_ADDITIONAL_DATA_RENDER</code>
| <code>CustomEvent::DEVICE_INTERFACE_ADDITIONAL_DATA_RENDER</code>
| При выводе дополнительного содержимого в карточке оборудования
| When rendering additional content in the equipment card
| <code>device_id</code>, <code>data</code>
| <code>device_id</code>, <code>data</code>
|}
|}


=== Абоненты ===
=== Customers ===


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::CUSTOMER_CREATED</code>
| <code>CustomEvent::CUSTOMER_CREATED</code>
| После создания абонента
| After creating a customer
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_CHANGE_BEFORE</code>
| <code>CustomEvent::CUSTOMER_CHANGE_BEFORE</code>
| Перед редактированием абонента
| Before editing a customer
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_CHANGED</code>
| <code>CustomEvent::CUSTOMER_CHANGED</code>
| После редактирования абонента
| After editing a customer
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_MERGED</code>
| <code>CustomEvent::CUSTOMER_MERGED</code>
| После объединения абонентов
| After merging customers
| <code>customer_id</code>, <code>target_customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>target_customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_STATUS_CHANGE_BEFORE</code>
| <code>CustomEvent::CUSTOMER_STATUS_CHANGE_BEFORE</code>
| Перед изменением статуса абонента
| Before changing a customer status
| <code>customer_id</code>, <code>new_status_id</code>, <code>old_status_id</code>, <code>data</code>
| <code>customer_id</code>, <code>new_status_id</code>, <code>old_status_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_STATUS_CHANGED</code>
| <code>CustomEvent::CUSTOMER_STATUS_CHANGED</code>
| После изменения статуса абонента
| After changing a customer status
| <code>customer_id</code>, <code>new_status_id</code>, <code>old_status_id</code>, <code>data</code>
| <code>customer_id</code>, <code>new_status_id</code>, <code>old_status_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_TARIFF_CHANGE_BEFORE</code>
| <code>CustomEvent::CUSTOMER_TARIFF_CHANGE_BEFORE</code>
| Перед изменением тарифа абонента
| Before changing a customer tariff
| <code>customer_id</code>, <code>billing_id</code>, <code>new_tariff_id</code>, <code>old_tariff_id</code>, <code>data</code>
| <code>customer_id</code>, <code>billing_id</code>, <code>new_tariff_id</code>, <code>old_tariff_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_TARIFF_CHANGED</code>
| <code>CustomEvent::CUSTOMER_TARIFF_CHANGED</code>
| После изменения тарифа абонента
| After changing a customer tariff
| <code>customer_id</code>, <code>billing_id</code>, <code>new_tariff_id</code>, <code>old_tariff_id</code>, <code>data</code>
| <code>customer_id</code>, <code>billing_id</code>, <code>new_tariff_id</code>, <code>old_tariff_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_BALANCE_CHANGED</code>
| <code>CustomEvent::CUSTOMER_BALANCE_CHANGED</code>
| При изменении баланса абонента
| When a customer balance changes
| <code>customer_id</code>, <code>amount</code>, <code>data</code>
| <code>customer_id</code>, <code>amount</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_FORMER_TRANSFER_BEFORE</code>
| <code>CustomEvent::CUSTOMER_FORMER_TRANSFER_BEFORE</code>
| Перед переводом абонента в бывшие абоненты
| Before moving a customer to former customers
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_FORMER_TRANSFERRED</code>
| <code>CustomEvent::CUSTOMER_FORMER_TRANSFERRED</code>
| После перевода абонента в бывшие абоненты
| After moving a customer to former customers
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_FORMER_RESTORE_BEFORE</code>
| <code>CustomEvent::CUSTOMER_FORMER_RESTORE_BEFORE</code>
| Перед восстановлением абонента из бывших абонентов
| Before restoring a customer from former customers
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_FORMER_RESTORED</code>
| <code>CustomEvent::CUSTOMER_FORMER_RESTORED</code>
| После восстановления абонента из бывших абонентов
| After restoring a customer from former customers
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_DISCONNECT_PLAN_BEFORE</code>
| <code>CustomEvent::CUSTOMER_DISCONNECT_PLAN_BEFORE</code>
| Перед постановкой абонента на отключение
| Before scheduling customer disconnection
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_DISCONNECT_PLANNED</code>
| <code>CustomEvent::CUSTOMER_DISCONNECT_PLANNED</code>
| После постановки абонента на отключение
| After scheduling customer disconnection
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_DISCONNECT_BEFORE</code>
| <code>CustomEvent::CUSTOMER_DISCONNECT_BEFORE</code>
| Перед отключением абонента
| Before disconnecting a customer
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_DISCONNECTED</code>
| <code>CustomEvent::CUSTOMER_DISCONNECTED</code>
| После отключения абонента
| After disconnecting a customer
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_DISCONNECT_CANCEL_BEFORE</code>
| <code>CustomEvent::CUSTOMER_DISCONNECT_CANCEL_BEFORE</code>
| Перед отменой отключения абонента
| Before cancelling customer disconnection
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_DISCONNECT_CANCELLED</code>
| <code>CustomEvent::CUSTOMER_DISCONNECT_CANCELLED</code>
| После отмены отключения абонента
| After cancelling customer disconnection
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_SERVICE_ENABLE_BEFORE</code>
| <code>CustomEvent::CUSTOMER_SERVICE_ENABLE_BEFORE</code>
| Перед подключением услуги абоненту
| Before enabling a service for a customer
| <code>customer_id</code>, <code>service_id</code>, <code>data</code>
| <code>customer_id</code>, <code>service_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_SERVICE_ENABLED</code>
| <code>CustomEvent::CUSTOMER_SERVICE_ENABLED</code>
| После подключения услуги абоненту
| After enabling a service for a customer
| <code>customer_id</code>, <code>service_id</code>, <code>data</code>
| <code>customer_id</code>, <code>service_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_SERVICE_DISABLE_BEFORE</code>
| <code>CustomEvent::CUSTOMER_SERVICE_DISABLE_BEFORE</code>
| Перед отключением услуги абоненту
| Before disabling a service for a customer
| <code>customer_id</code>, <code>service_id</code>, <code>data</code>
| <code>customer_id</code>, <code>service_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_SERVICE_DISABLED</code>
| <code>CustomEvent::CUSTOMER_SERVICE_DISABLED</code>
| После отключения услуги абоненту
| After disabling a service for a customer
| <code>customer_id</code>, <code>service_id</code>, <code>data</code>
| <code>customer_id</code>, <code>service_id</code>, <code>data</code>
|}
|}


==== IP/MAC абонента ====
==== Customer IP/MAC ====


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::CUSTOMER_IP_ADD_BEFORE</code>
| <code>CustomEvent::CUSTOMER_IP_ADD_BEFORE</code>
| Перед добавлением IP/MAC-адреса
| Before adding an IP/MAC address
| <code>customer_id</code>, <code>ip</code>, <code>mac</code>, <code>subnet_property</code>, <code>data</code>
| <code>customer_id</code>, <code>ip</code>, <code>mac</code>, <code>subnet_property</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_IP_ADDED</code>
| <code>CustomEvent::CUSTOMER_IP_ADDED</code>
| После добавления IP/MAC-адреса
| After adding an IP/MAC address
| <code>customer_id</code>, <code>ip</code>, <code>mac</code>, <code>subnet_property</code>, <code>data</code>
| <code>customer_id</code>, <code>ip</code>, <code>mac</code>, <code>subnet_property</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_IP_DELETE_BEFORE</code>
| <code>CustomEvent::CUSTOMER_IP_DELETE_BEFORE</code>
| Перед удалением IP/MAC-адреса
| Before deleting an IP/MAC address
| <code>customer_id</code>, <code>ip</code>, <code>mac</code>, <code>subnet_property</code>, <code>data</code>
| <code>customer_id</code>, <code>ip</code>, <code>mac</code>, <code>subnet_property</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_IP_DELETED</code>
| <code>CustomEvent::CUSTOMER_IP_DELETED</code>
| После удаления IP/MAC-адреса
| After deleting an IP/MAC address
| <code>customer_id</code>, <code>ip</code>, <code>mac</code>, <code>subnet_property</code>, <code>data</code>
| <code>customer_id</code>, <code>ip</code>, <code>mac</code>, <code>subnet_property</code>, <code>data</code>
|}
|}


==== Метки абонента ====
==== Customer tags ====


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::CUSTOMER_TAG_ADD_BEFORE</code>
| <code>CustomEvent::CUSTOMER_TAG_ADD_BEFORE</code>
| Перед добавлением метки абоненту
| Before adding a tag to a customer
| <code>customer_id</code>, <code>tag_id</code>, <code>data</code>
| <code>customer_id</code>, <code>tag_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_TAG_ADDED</code>
| <code>CustomEvent::CUSTOMER_TAG_ADDED</code>
| После добавления метки абоненту
| After adding a tag to a customer
| <code>customer_id</code>, <code>tag_id</code>, <code>data</code>
| <code>customer_id</code>, <code>tag_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_TAG_DELETE_BEFORE</code>
| <code>CustomEvent::CUSTOMER_TAG_DELETE_BEFORE</code>
| Перед удалением метки абонента
| Before deleting a customer tag
| <code>customer_id</code>, <code>tag_id</code>, <code>data</code>
| <code>customer_id</code>, <code>tag_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_TAG_DELETED</code>
| <code>CustomEvent::CUSTOMER_TAG_DELETED</code>
| После удаления метки абонента
| After deleting a customer tag
| <code>customer_id</code>, <code>tag_id</code>, <code>data</code>
| <code>customer_id</code>, <code>tag_id</code>, <code>data</code>
|}
|}


==== Личный кабинет абонента ====
==== Customer portal ====


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::CUSTOMER_PORTAL_REGISTRATION_BEFORE</code>
| <code>CustomEvent::CUSTOMER_PORTAL_REGISTRATION_BEFORE</code>
| Перед регистрацией абонента в личном кабинете
| Before registering a customer in the customer portal
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_PORTAL_REGISTERED</code>
| <code>CustomEvent::CUSTOMER_PORTAL_REGISTERED</code>
| После регистрации абонента в личном кабинете
| After registering a customer in the customer portal
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_PORTAL_LOGIN_BEFORE</code>
| <code>CustomEvent::CUSTOMER_PORTAL_LOGIN_BEFORE</code>
| Перед входом абонента в личный кабинет
| Before a customer logs in to the customer portal
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_PORTAL_DASHBOARD_RENDER</code>
| <code>CustomEvent::CUSTOMER_PORTAL_DASHBOARD_RENDER</code>
| При выводе содержимого на главной странице личного кабинета
| When rendering content on the customer portal dashboard
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_PORTAL_PAGE_RENDER</code>
| <code>CustomEvent::CUSTOMER_PORTAL_PAGE_RENDER</code>
| При выводе содержимого на страницах личного кабинета
| When rendering content on customer portal pages
| <code>customer_id</code>, <code>page_mode</code>, <code>page_id</code>, <code>data</code>
| <code>customer_id</code>, <code>page_mode</code>, <code>page_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_PORTAL_HEAD_RENDER</code>
| <code>CustomEvent::CUSTOMER_PORTAL_HEAD_RENDER</code>
| При выводе содержимого после <code>head</code> в личном кабинете
| When rendering content after <code>head</code> in the customer portal
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|}
|}


==== Карточка абонента ====
==== Customer card ====


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::CUSTOMER_CARD_PRIMARY_CONTENT_RENDER</code>
| <code>CustomEvent::CUSTOMER_CARD_PRIMARY_CONTENT_RENDER</code>
| При выводе основного содержимого в карточке абонента
| When rendering the main content in the customer card
| <code>customer_id</code>, <code>mode</code>, <code>employee_id</code>, <code>data</code>
| <code>customer_id</code>, <code>mode</code>, <code>employee_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_CARD_SECONDARY_CONTENT_RENDER</code>
| <code>CustomEvent::CUSTOMER_CARD_SECONDARY_CONTENT_RENDER</code>
| При выводе дополнительного содержимого в карточке абонента
| When rendering additional content in the customer card
| <code>customer_id</code>, <code>mode</code>, <code>employee_id</code>, <code>ip_mac</code>, <code>data</code>
| <code>customer_id</code>, <code>mode</code>, <code>employee_id</code>, <code>ip_mac</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_CARD_IP_MAC_CONTENT_RENDER</code>
| <code>CustomEvent::CUSTOMER_CARD_IP_MAC_CONTENT_RENDER</code>
| При выводе информации возле IP/MAC-адресов абонента
| When rendering information near customer IP/MAC addresses
| <code>customer_id</code>, <code>ip</code>, <code>mac</code>, <code>data</code>
| <code>customer_id</code>, <code>ip</code>, <code>mac</code>, <code>data</code>
|-
|-
| <code>CustomEvent::CUSTOMER_CARD_SMS_CONTENT_RENDER</code>
| <code>CustomEvent::CUSTOMER_CARD_SMS_CONTENT_RENDER</code>
| При выводе содержимого отправки SMS в карточке абонента
| When rendering SMS sending content in the customer card
| <code>customer_id</code>, <code>data</code>
| <code>customer_id</code>, <code>data</code>
|}
|}


=== Сотрудники ===
=== Employees ===


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::EMPLOYEE_MESSAGE_CREATED</code>
| <code>CustomEvent::EMPLOYEE_MESSAGE_CREATED</code>
| После создания сообщения сотруднику
| After creating a message for an employee
| <code>receiver_employee_id</code>, <code>message_id</code>, <code>data</code>
| <code>receiver_employee_id</code>, <code>message_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::EMPLOYEE_CHANGED</code>
| <code>CustomEvent::EMPLOYEE_CHANGED</code>
| После редактирования сотрудника
| After editing an employee
| <code>employee_id</code>, <code>data</code>
| <code>employee_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::EMPLOYEE_PERSONAL_SECTION_CONTENT_RENDER</code>
| <code>CustomEvent::EMPLOYEE_PERSONAL_SECTION_CONTENT_RENDER</code>
| При выводе информации в персональном разделе сотрудника
| When rendering information in an employee personal section
| <code>employee_id</code>, <code>data</code>
| <code>employee_id</code>, <code>data</code>
|}
|}


==== Табель работ ====
==== Timesheet ====


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::EMPLOYEE_TIMESHEET_PRINT_HEADER_RENDER</code>
| <code>CustomEvent::EMPLOYEE_TIMESHEET_PRINT_HEADER_RENDER</code>
| При выводе шапки печатного табеля
| When rendering the printed timesheet header
| <code>employee_id</code>, <code>period</code>, <code>data</code>
| <code>employee_id</code>, <code>period</code>, <code>data</code>
|-
|-
| <code>CustomEvent::EMPLOYEE_TIMESHEET_PRINT_FOOTER_RENDER</code>
| <code>CustomEvent::EMPLOYEE_TIMESHEET_PRINT_FOOTER_RENDER</code>
| При выводе подвала печатного табеля
| When rendering the printed timesheet footer
| <code>employee_id</code>, <code>period</code>, <code>data</code>
| <code>employee_id</code>, <code>period</code>, <code>data</code>
|}
|}


=== Склад ===
=== Warehouse ===


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::INVENTORY_TRANSFER_BEFORE</code>
| <code>CustomEvent::INVENTORY_TRANSFER_BEFORE</code>
| Перед перемещением ТМЦ
| Before moving inventory items
| <code>inventory_id</code>, <code>operation_id</code>, <code>data</code>
| <code>inventory_id</code>, <code>operation_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::INVENTORY_TRANSFERRED</code>
| <code>CustomEvent::INVENTORY_TRANSFERRED</code>
| После перемещения ТМЦ
| After moving inventory items
| <code>inventory_id</code>, <code>operation_id</code>, <code>data</code>
| <code>inventory_id</code>, <code>operation_id</code>, <code>data</code>
|}
|}


=== Задания ===
=== Tasks ===


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::TASK_CARD_RENDER</code>
| <code>CustomEvent::TASK_CARD_RENDER</code>
| При выводе содержимого в карточке задания
| When rendering content in the task card
| <code>task_type_id</code>, <code>task_id</code>, <code>employee_id</code>, <code>data</code>
| <code>task_type_id</code>, <code>task_id</code>, <code>employee_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_WORK_DATE_RENDER</code>
| <code>CustomEvent::TASK_WORK_DATE_RENDER</code>
| При выводе содержимого возле даты работ
| When rendering content near the work date
| <code>task_type_id</code>, <code>task_id</code>, <code>employee_id</code>, <code>data</code>
| <code>task_type_id</code>, <code>task_id</code>, <code>employee_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_CREATE_BEFORE</code>
| <code>CustomEvent::TASK_CREATE_BEFORE</code>
| Перед созданием задания
| Before creating a task
| <code>task_type_id</code>, <code>author_employee_id</code>, <code>data</code>
| <code>task_type_id</code>, <code>author_employee_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_CREATED</code>
| <code>CustomEvent::TASK_CREATED</code>
| После создания задания
| After creating a task
| <code>task_id</code>, <code>task_type_id</code>, <code>author_employee_id</code>, <code>data</code>
| <code>task_id</code>, <code>task_type_id</code>, <code>author_employee_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_DELETE_BEFORE</code>
| <code>CustomEvent::TASK_DELETE_BEFORE</code>
| Перед удалением задания
| Before deleting a task
| <code>task_id</code>, <code>data</code>
| <code>task_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_CHANGE_BEFORE</code>
| <code>CustomEvent::TASK_CHANGE_BEFORE</code>
| Перед редактированием задания
| Before editing a task
| <code>task_id</code>, <code>data</code>
| <code>task_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_CHANGED</code>
| <code>CustomEvent::TASK_CHANGED</code>
| После редактирования задания
| After editing a task
| <code>task_id</code>, <code>data</code>
| <code>task_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_COMMENT_CREATE_BEFORE</code>
| <code>CustomEvent::TASK_COMMENT_CREATE_BEFORE</code>
| Перед добавлением комментария к заданию
| Before adding a task comment
| <code>task_id</code>, <code>comment</code>, <code>data</code>
| <code>task_id</code>, <code>comment</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_COMMENT_CREATED</code>
| <code>CustomEvent::TASK_COMMENT_CREATED</code>
| После добавления комментария к заданию
| After adding a task comment
| <code>task_id</code>, <code>comment_id</code>, <code>comment</code>, <code>data</code>
| <code>task_id</code>, <code>comment_id</code>, <code>comment</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_COMMENT_CHANGED</code>
| <code>CustomEvent::TASK_COMMENT_CHANGED</code>
| После редактирования комментария к заданию
| After editing a task comment
| <code>task_id</code>, <code>comment_id</code>, <code>comment</code>, <code>data</code>
| <code>task_id</code>, <code>comment_id</code>, <code>comment</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_COMMENT_TEXT_RENDER</code>
| <code>CustomEvent::TASK_COMMENT_TEXT_RENDER</code>
| При выводе текста комментария задания
| When rendering task comment text
| <code>task_id</code>, <code>comment_id</code>, <code>comment</code>, <code>data</code>
| <code>task_id</code>, <code>comment_id</code>, <code>comment</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_DIVISION_ASSIGN_BEFORE</code>
| <code>CustomEvent::TASK_DIVISION_ASSIGN_BEFORE</code>
| Перед добавлением подразделения к заданию
| Before adding a division to a task
| <code>task_id</code>, <code>division_id</code>, <code>data</code>
| <code>task_id</code>, <code>division_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_DIVISION_REMOVE_BEFORE</code>
| <code>CustomEvent::TASK_DIVISION_REMOVE_BEFORE</code>
| Перед исключением подразделения из задания
| Before removing a division from a task
| <code>task_id</code>, <code>division_id</code>, <code>data</code>
| <code>task_id</code>, <code>division_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_EMPLOYEE_ASSIGN_BEFORE</code>
| <code>CustomEvent::TASK_EMPLOYEE_ASSIGN_BEFORE</code>
| Перед добавлением исполнителя к заданию
| Before adding an assignee to a task
| <code>task_id</code>, <code>employee_id</code>, <code>data</code>
| <code>task_id</code>, <code>employee_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_EMPLOYEE_REMOVE_BEFORE</code>
| <code>CustomEvent::TASK_EMPLOYEE_REMOVE_BEFORE</code>
| Перед исключением исполнителя из задания
| Before removing an assignee from a task
| <code>task_id</code>, <code>employee_id</code>, <code>data</code>
| <code>task_id</code>, <code>employee_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_WATCHER_DIVISION_ASSIGN_BEFORE</code>
| <code>CustomEvent::TASK_WATCHER_DIVISION_ASSIGN_BEFORE</code>
| Перед добавлением подразделения наблюдателем
| Before adding a division as a watcher
| <code>task_id</code>, <code>division_id</code>, <code>data</code>
| <code>task_id</code>, <code>division_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_WATCHER_EMPLOYEE_ASSIGN_BEFORE</code>
| <code>CustomEvent::TASK_WATCHER_EMPLOYEE_ASSIGN_BEFORE</code>
| Перед добавлением сотрудника наблюдателем
| Before adding an employee as a watcher
| <code>task_id</code>, <code>employee_id</code>, <code>data</code>
| <code>task_id</code>, <code>employee_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_OBJECT_ATTACHED</code>
| <code>CustomEvent::TASK_OBJECT_ATTACHED</code>
| После добавления объекта к заданию
| After adding an object to a task
| <code>task_id</code>, <code>object_type</code>, <code>object_id</code>, <code>data</code>
| <code>task_id</code>, <code>object_type</code>, <code>object_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_OBJECT_DETACHED</code>
| <code>CustomEvent::TASK_OBJECT_DETACHED</code>
| После исключения объекта из задания
| After removing an object from a task
| <code>task_id</code>, <code>object_type</code>, <code>object_id</code>, <code>data</code>
| <code>task_id</code>, <code>object_type</code>, <code>object_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_RETURNED_TO_AUTHOR</code>
| <code>CustomEvent::TASK_RETURNED_TO_AUTHOR</code>
| После возврата задания автору
| After returning a task to the author
| <code>task_id</code>, <code>data</code>
| <code>task_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_STATE_CHANGE_BEFORE</code>
| <code>CustomEvent::TASK_STATE_CHANGE_BEFORE</code>
| Перед изменением статуса задания
| Before changing a task status
| <code>task_id</code>, <code>old_state_id</code>, <code>new_state_id</code>, <code>data</code>
| <code>task_id</code>, <code>old_state_id</code>, <code>new_state_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::TASK_STATE_CHANGED</code>
| <code>CustomEvent::TASK_STATE_CHANGED</code>
| После изменения статуса задания
| After changing a task status
| <code>task_id</code>, <code>old_state_id</code>, <code>new_state_id</code>, <code>data</code>
| <code>task_id</code>, <code>old_state_id</code>, <code>new_state_id</code>, <code>data</code>
|}
|}


=== Сооружения связи ===
=== Communications installations ===


{| class="wikitable"
{| class="wikitable"
! Константа
! Constant
! Когда вызывается
! When called
! Данные <code>$event</code>
! <code>$event</code> data
|-
|-
| <code>CustomEvent::NODE_CARD_ADDITIONAL_DATA_RENDER</code>
| <code>CustomEvent::NODE_CARD_ADDITIONAL_DATA_RENDER</code>
| При выводе дополнительного содержимого в карточке сооружения связи
| When rendering additional content in the communications installation card
| <code>node_id</code>, <code>data</code>
| <code>node_id</code>, <code>data</code>
|-
|-
| <code>CustomEvent::NODE_CARD_PRIMARY_CONTENT_RENDER</code>
| <code>CustomEvent::NODE_CARD_PRIMARY_CONTENT_RENDER</code>
| При выводе основного содержимого в карточке сооружения связи
| When rendering the main content in the communications installation card
| <code>node_id</code>, <code>data</code>
| <code>node_id</code>, <code>data</code>
|}
|}

Текущая версия от 19:35, 23 мая 2026

en | uk | ru

Custom Events v2 is a local ERP internal event system. It runs customer PHP code inside the current ERP PHP process without HTTP requests, webhooks, or external queues.

The old legacy/Config/custom_api.txt mechanism with the api_function(...) function remains a legacy contract. In v2, old names are used only for the compatibility map. New customer code must use CustomEvent::... constants.

Files

There is one working customer file:

evolution/CustomEvents/v2/handlers.php

Example:

evolution/CustomEvents/v2/handlers.example.php

List of all constants:

evolution/CustomEvents/Runtime/v2/CustomEvent.php

Map of old names to new events:

evolution/CustomEvents/Runtime/v2/CustomEventLegacyEventMap.php

Cache:

var/cache/CustomEvents/handlers.v2.cache.php

Log:

var/log/custom-events-v2.log

How to write handlers

One registration function is used: internal_event(...).

Several handlers can be registered one after another in the same file:

internal_event(
    CustomEvent::TASK_CREATED,
    static function ($event): bool {
        $taskId = $event->get('task_id');

        return true;
    },
);

internal_event(
    CustomEvent::CUSTOMER_STATUS_CHANGE_BEFORE,
    static function ($event): bool|string {
        if ((int)$event->get('new_status_id') === 0) {
            return 'Changing the customer to this status is forbidden';
        }

        return true;
    },
);

internal_event(
    CustomEvent::CUSTOMER_CARD_PRIMARY_CONTENT_RENDER,
    static function ($event): string {
        $customerId = (int)$event->get('customer_id');

        return '<div>Additional customer information #' . $customerId . '</div>';
    },
);

The handler always receives one parameter: $event.

Data is read without type wrappers:

$taskId = $event->get('task_id');
$customerId = $event->get('customer_id');
$data = $event->all();

If a specific type is required, cast the value in your code:

$taskId = (int)$event->get('task_id');
$comment = (string)$event->get('comment');

Handler result

The handler returns a simple value:

Return Meaning
true The handler completed successfully
false For a *.before event, block the standard operation
null Do not change anything
string For *.before, block the operation with a reason text; for *.render, output a string or HTML

*.before events can cancel the standard operation. Other events must not cancel an action that has already been completed.

Example: blocking an operation

internal_event(
    CustomEvent::CUSTOMER_STATUS_CHANGE_BEFORE,
    static function ($event): bool|string {
        if ((int)$event->get('new_status_id') === 0) {
            return 'Changing the customer to this status is forbidden';
        }

        return true;
    },
);

Example: outputting HTML

internal_event(
    CustomEvent::CUSTOMER_CARD_PRIMARY_CONTENT_RENDER,
    static function ($event): string {
        $customerId = (int)$event->get('customer_id');

        return '<div>Additional customer information #' . $customerId . '</div>';
    },
);

Validation, cache, and log

When evolution/CustomEvents/v2/handlers.php changes, ERP checks the syntax with php -l. If the syntax is valid, the file is copied to var/cache/CustomEvents/handlers.v2.cache.php.

The runtime log is written as JSON Lines to var/log/custom-events-v2.log. One line is one handler call, error, or fact that no handlers exist.

Example line:

{"ts":"2026-05-10T12:01:03+03:00","event":"task.created","has_handlers":true,"handlers":1,"handler_index":0,"duration_ms":2.341,"memory_kb":18,"result":"allow","message":null}

The log is rotated to:

var/log/custom-events-v2.log.1

Errors

If an error occurs in a handler, ERP writes it to the log and continues according to the rules of the specific event.

The handler runs inside the same PHP process as the ERP core. Thousands of operations pass through the core, so slow or faulty customer code can stop or destabilize the entire system. Do not use exit, die, endless loops, heavy SQL queries without limits, or long external operations. Keep handlers short and predictable.

Recommendations

  • Use only CustomEvent::... constants.
  • Do not write the event string manually.
  • Keep handlers short.
  • Do not call HTTP/webhook from high-frequency events.
  • Do not use exit, die, endless loops, or heavy selections without limits.
  • Return true, false, null, or a string.

All events

All v2 events are listed below. The complete technical list of constants is in evolution/CustomEvents/Runtime/v2/CustomEvent.php.

The event fields are the current data contract.

Buildings

Constant When called $event data
CustomEvent::BUILDING_CREATED After creating a building building_id, data
CustomEvent::BUILDING_CHANGED After editing a building building_id, data

Commutation

Constant When called $event data
CustomEvent::COMMUTATION_CREATE_BEFORE Before creating commutation between objects source_type, source_id, target_type, target_id, data
CustomEvent::COMMUTATION_DELETE_BEFORE Before deleting commutation between objects source_type, source_id, target_type, target_id, data

Dashboard

Constant When called $event data
CustomEvent::DASHBOARD_TOP_CONTENT_RENDER When rendering text at the top of the dashboard employee_id, data

Equipment

Constant When called $event data
CustomEvent::DEVICE_CHANGED After editing equipment device_id, device_type, data
CustomEvent::DEVICE_NOTIFICATION_DOWN When equipment unavailability is recorded device_id, device_type, ip, data
CustomEvent::DEVICE_NOTIFICATION_UP When equipment availability is restored device_id, device_type, ip, data
CustomEvent::DEVICE_INTERFACE_PORT_NUMBER_RENDER When rendering the port number in the interface table device_id, interface_id, port_number, data
CustomEvent::DEVICE_INTERFACE_ADDITIONAL_DATA_RENDER When rendering additional content in the equipment card device_id, data

Customers

Constant When called $event data
CustomEvent::CUSTOMER_CREATED After creating a customer customer_id, data
CustomEvent::CUSTOMER_CHANGE_BEFORE Before editing a customer customer_id, data
CustomEvent::CUSTOMER_CHANGED After editing a customer customer_id, data
CustomEvent::CUSTOMER_MERGED After merging customers customer_id, target_customer_id, data
CustomEvent::CUSTOMER_STATUS_CHANGE_BEFORE Before changing a customer status customer_id, new_status_id, old_status_id, data
CustomEvent::CUSTOMER_STATUS_CHANGED After changing a customer status customer_id, new_status_id, old_status_id, data
CustomEvent::CUSTOMER_TARIFF_CHANGE_BEFORE Before changing a customer tariff customer_id, billing_id, new_tariff_id, old_tariff_id, data
CustomEvent::CUSTOMER_TARIFF_CHANGED After changing a customer tariff customer_id, billing_id, new_tariff_id, old_tariff_id, data
CustomEvent::CUSTOMER_BALANCE_CHANGED When a customer balance changes customer_id, amount, data
CustomEvent::CUSTOMER_FORMER_TRANSFER_BEFORE Before moving a customer to former customers customer_id, data
CustomEvent::CUSTOMER_FORMER_TRANSFERRED After moving a customer to former customers customer_id, data
CustomEvent::CUSTOMER_FORMER_RESTORE_BEFORE Before restoring a customer from former customers customer_id, data
CustomEvent::CUSTOMER_FORMER_RESTORED After restoring a customer from former customers customer_id, data
CustomEvent::CUSTOMER_DISCONNECT_PLAN_BEFORE Before scheduling customer disconnection customer_id, data
CustomEvent::CUSTOMER_DISCONNECT_PLANNED After scheduling customer disconnection customer_id, data
CustomEvent::CUSTOMER_DISCONNECT_BEFORE Before disconnecting a customer customer_id, data
CustomEvent::CUSTOMER_DISCONNECTED After disconnecting a customer customer_id, data
CustomEvent::CUSTOMER_DISCONNECT_CANCEL_BEFORE Before cancelling customer disconnection customer_id, data
CustomEvent::CUSTOMER_DISCONNECT_CANCELLED After cancelling customer disconnection customer_id, data
CustomEvent::CUSTOMER_SERVICE_ENABLE_BEFORE Before enabling a service for a customer customer_id, service_id, data
CustomEvent::CUSTOMER_SERVICE_ENABLED After enabling a service for a customer customer_id, service_id, data
CustomEvent::CUSTOMER_SERVICE_DISABLE_BEFORE Before disabling a service for a customer customer_id, service_id, data
CustomEvent::CUSTOMER_SERVICE_DISABLED After disabling a service for a customer customer_id, service_id, data

Customer IP/MAC

Constant When called $event data
CustomEvent::CUSTOMER_IP_ADD_BEFORE Before adding an IP/MAC address customer_id, ip, mac, subnet_property, data
CustomEvent::CUSTOMER_IP_ADDED After adding an IP/MAC address customer_id, ip, mac, subnet_property, data
CustomEvent::CUSTOMER_IP_DELETE_BEFORE Before deleting an IP/MAC address customer_id, ip, mac, subnet_property, data
CustomEvent::CUSTOMER_IP_DELETED After deleting an IP/MAC address customer_id, ip, mac, subnet_property, data

Customer tags

Constant When called $event data
CustomEvent::CUSTOMER_TAG_ADD_BEFORE Before adding a tag to a customer customer_id, tag_id, data
CustomEvent::CUSTOMER_TAG_ADDED After adding a tag to a customer customer_id, tag_id, data
CustomEvent::CUSTOMER_TAG_DELETE_BEFORE Before deleting a customer tag customer_id, tag_id, data
CustomEvent::CUSTOMER_TAG_DELETED After deleting a customer tag customer_id, tag_id, data

Customer portal

Constant When called $event data
CustomEvent::CUSTOMER_PORTAL_REGISTRATION_BEFORE Before registering a customer in the customer portal customer_id, data
CustomEvent::CUSTOMER_PORTAL_REGISTERED After registering a customer in the customer portal customer_id, data
CustomEvent::CUSTOMER_PORTAL_LOGIN_BEFORE Before a customer logs in to the customer portal customer_id, data
CustomEvent::CUSTOMER_PORTAL_DASHBOARD_RENDER When rendering content on the customer portal dashboard customer_id, data
CustomEvent::CUSTOMER_PORTAL_PAGE_RENDER When rendering content on customer portal pages customer_id, page_mode, page_id, data
CustomEvent::CUSTOMER_PORTAL_HEAD_RENDER When rendering content after head in the customer portal customer_id, data

Customer card

Constant When called $event data
CustomEvent::CUSTOMER_CARD_PRIMARY_CONTENT_RENDER When rendering the main content in the customer card customer_id, mode, employee_id, data
CustomEvent::CUSTOMER_CARD_SECONDARY_CONTENT_RENDER When rendering additional content in the customer card customer_id, mode, employee_id, ip_mac, data
CustomEvent::CUSTOMER_CARD_IP_MAC_CONTENT_RENDER When rendering information near customer IP/MAC addresses customer_id, ip, mac, data
CustomEvent::CUSTOMER_CARD_SMS_CONTENT_RENDER When rendering SMS sending content in the customer card customer_id, data

Employees

Constant When called $event data
CustomEvent::EMPLOYEE_MESSAGE_CREATED After creating a message for an employee receiver_employee_id, message_id, data
CustomEvent::EMPLOYEE_CHANGED After editing an employee employee_id, data
CustomEvent::EMPLOYEE_PERSONAL_SECTION_CONTENT_RENDER When rendering information in an employee personal section employee_id, data

Timesheet

Constant When called $event data
CustomEvent::EMPLOYEE_TIMESHEET_PRINT_HEADER_RENDER When rendering the printed timesheet header employee_id, period, data
CustomEvent::EMPLOYEE_TIMESHEET_PRINT_FOOTER_RENDER When rendering the printed timesheet footer employee_id, period, data

Warehouse

Constant When called $event data
CustomEvent::INVENTORY_TRANSFER_BEFORE Before moving inventory items inventory_id, operation_id, data
CustomEvent::INVENTORY_TRANSFERRED After moving inventory items inventory_id, operation_id, data

Tasks

Constant When called $event data
CustomEvent::TASK_CARD_RENDER When rendering content in the task card task_type_id, task_id, employee_id, data
CustomEvent::TASK_WORK_DATE_RENDER When rendering content near the work date task_type_id, task_id, employee_id, data
CustomEvent::TASK_CREATE_BEFORE Before creating a task task_type_id, author_employee_id, data
CustomEvent::TASK_CREATED After creating a task task_id, task_type_id, author_employee_id, data
CustomEvent::TASK_DELETE_BEFORE Before deleting a task task_id, data
CustomEvent::TASK_CHANGE_BEFORE Before editing a task task_id, data
CustomEvent::TASK_CHANGED After editing a task task_id, data
CustomEvent::TASK_COMMENT_CREATE_BEFORE Before adding a task comment task_id, comment, data
CustomEvent::TASK_COMMENT_CREATED After adding a task comment task_id, comment_id, comment, data
CustomEvent::TASK_COMMENT_CHANGED After editing a task comment task_id, comment_id, comment, data
CustomEvent::TASK_COMMENT_TEXT_RENDER When rendering task comment text task_id, comment_id, comment, data
CustomEvent::TASK_DIVISION_ASSIGN_BEFORE Before adding a division to a task task_id, division_id, data
CustomEvent::TASK_DIVISION_REMOVE_BEFORE Before removing a division from a task task_id, division_id, data
CustomEvent::TASK_EMPLOYEE_ASSIGN_BEFORE Before adding an assignee to a task task_id, employee_id, data
CustomEvent::TASK_EMPLOYEE_REMOVE_BEFORE Before removing an assignee from a task task_id, employee_id, data
CustomEvent::TASK_WATCHER_DIVISION_ASSIGN_BEFORE Before adding a division as a watcher task_id, division_id, data
CustomEvent::TASK_WATCHER_EMPLOYEE_ASSIGN_BEFORE Before adding an employee as a watcher task_id, employee_id, data
CustomEvent::TASK_OBJECT_ATTACHED After adding an object to a task task_id, object_type, object_id, data
CustomEvent::TASK_OBJECT_DETACHED After removing an object from a task task_id, object_type, object_id, data
CustomEvent::TASK_RETURNED_TO_AUTHOR After returning a task to the author task_id, data
CustomEvent::TASK_STATE_CHANGE_BEFORE Before changing a task status task_id, old_state_id, new_state_id, data
CustomEvent::TASK_STATE_CHANGED After changing a task status task_id, old_state_id, new_state_id, data

Communications installations

Constant When called $event data
CustomEvent::NODE_CARD_ADDITIONAL_DATA_RENDER When rendering additional content in the communications installation card node_id, data
CustomEvent::NODE_CARD_PRIMARY_CONTENT_RENDER When rendering the main content in the communications installation card node_id, data