Generates .bsl a file with an interception decorator for a borrowed extension object. Creates a file or appends to an existing one.
Precondition
The object must be borrowed into the extension (/cfe-borrow). The script reads NamePrefix from Configuration.xml of the extension to form the procedure name.
Parameters
| Parameter | Description | Default |
|---|---|---|
ExtensionPath |
Path to the extension (required) | — |
ModulePath |
Path to the module (required) | — |
MethodName |
Name of the method to intercept (required) | — |
InterceptorType |
Before / After / ModificationAndControl (required) |
— |
Context |
Context directive | НаСервере |
IsFunction |
The method is a function (will add Возврат) |
false |
ModulePath format
| ModulePath | File |
|---|---|
Catalog.X.ObjectModule |
Catalogs/X/Ext/ObjectModule.bsl |
Catalog.X.ManagerModule |
Catalogs/X/Ext/ManagerModule.bsl |
Catalog.X.Form.Y |
Catalogs/X/Forms/Y/Ext/Form/Module.bsl |
CommonModule.X |
CommonModules/X/Ext/Module.bsl |
Document.X.ObjectModule |
Documents/X/Ext/ObjectModule.bsl |
Document.X.Form.Y |
Documents/X/Forms/Y/Ext/Form/Module.bsl |
Similarly for Report, DataProcessor, InformationRegister, and other types.
Interception types
| InterceptorType | Decorator | Purpose |
|---|---|---|
Before |
&Перед |
Code before the call to the original method |
After |
&После |
Code after the call to the original method |
ModificationAndControl |
&ИзменениеИКонтроль |
Copy of the method body with markers #Вставка/#Удаление |
Command
powershell.exe -NoProfile -File .claude/skills/cfe-patch-method/scripts/cfe-patch-method.ps1 -ExtensionPath src -ModulePath "Catalog.Контрагенты.ObjectModule" -MethodName "ПриЗаписи" -InterceptorType Before
Examples
# Перехват &Перед на сервере
... -ExtensionPath src -ModulePath "Catalog.Контрагенты.ObjectModule" -MethodName "ПриЗаписи" -InterceptorType Before
# Перехват &После на клиенте
... -ExtensionPath src -ModulePath "Document.Заказ.Form.ФормаДокумента" -MethodName "ПослеЗаписиНаСервере" -InterceptorType After -Context "НаКлиенте"
# ИзменениеИКонтроль для функции
... -ExtensionPath src -ModulePath "CommonModule.ОбщийМодуль" -MethodName "ПолучитьДанные" -InterceptorType ModificationAndControl -IsFunction
Generated code (Before)
&НаСервере
&Перед("ПриЗаписи")
Процедура Расш1_ПриЗаписи()
// TODO: код перед вызовом оригинального метода
КонецПроцедуры