Answer the question
In order to leave comments, you need to log in
Bitrix — How to subscribe to an order blocking event?
I need to record in the history of work with the order.
When viewed in the admin panel - the order is automatically blocked.
/bitrix/modules/sale/admin/order_view.php:149
if ($boolLocked)
$errorMsgs[] = Admin\OrderEdit::getLockingMessage($ID);
else
$orderClass::lock($ID);
return static::updateInternal($id, array(
'DATE_LOCK' => new Main\Type\DateTime(),
'LOCKED_BY' => (is_object($USER) ? $USER->GetID(): false)
));
$event = new Event($entity, self::EVENT_ON_BEFORE_UPDATE, array("id" => $primary, "fields" => $fields));
$event->send();
Answer the question
In order to leave comments, you need to log in
I don’t know specifically about the lock, you can update the order like this, check there if LOCKED_BY is not null, it means it’s locked
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler('sale', '\Bitrix\Sale\Internals\Order::onUpdate', ['OrderEvents', 'onUpdate']);
class OrderEvents {
public static function onUpdate(\Bitrix\Main\Event $event) {
$fields = $event->getParameters()['fields'];
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question