fix(meta): emit attribute properties based on stored/non-stored object context

DataProcessor/Report attributes incorrectly included Indexing, FullTextSearch,
DataHistory, FillFromFillingValue, FillValue, and Use properties. Added
"processor" and "processor-tabular" contexts to both meta-compile and meta-edit.
Also fixed Use emitted for Document (should be Catalog-only).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-02-15 22:57:35 +03:00
parent e29c184f8e
commit 7003a46ad0
4 changed files with 49 additions and 35 deletions
@@ -577,7 +577,7 @@ function Emit-TabularStandardAttributes {
function Emit-Attribute {
param([string]$indent, $parsed, [string]$context)
# $context: "catalog", "document", "tabular", "register"
# $context: "catalog", "document", "object", "processor", "tabular", "processor-tabular", "register"
$uuid = New-Guid-String
X "$indent<Attribute uuid=`"$uuid`">"
X "$indent`t<Properties>"
@@ -607,13 +607,13 @@ function Emit-Attribute {
X "$indent`t`t<MinValue xsi:nil=`"true`"/>"
X "$indent`t`t<MaxValue xsi:nil=`"true`"/>"
# FillFromFillingValue — not for tabular section attributes
if ($context -ne "tabular") {
# FillFromFillingValue — not for tabular/processor (non-stored objects don't have these)
if ($context -notin @("tabular", "processor")) {
X "$indent`t`t<FillFromFillingValue>false</FillFromFillingValue>"
}
# FillValue — not for tabular section attributes
if ($context -ne "tabular") {
# FillValue — not for tabular/processor
if ($context -notin @("tabular", "processor")) {
Emit-FillValue "$indent`t`t" $typeStr
}
@@ -632,20 +632,22 @@ function Emit-Attribute {
X "$indent`t`t<LinkByType/>"
X "$indent`t`t<ChoiceHistoryOnInput>Auto</ChoiceHistoryOnInput>"
# Use — only for catalog/document top-level attributes
if ($context -eq "catalog" -or $context -eq "document") {
# Use — only for catalog top-level attributes
if ($context -eq "catalog") {
X "$indent`t`t<Use>ForItem</Use>"
}
# Indexing
$indexing = "DontIndex"
if ($parsed.flags -contains "index") { $indexing = "Index" }
if ($parsed.flags -contains "indexadditional") { $indexing = "IndexWithAdditionalOrder" }
if ($parsed.indexing) { $indexing = $parsed.indexing }
X "$indent`t`t<Indexing>$indexing</Indexing>"
# Indexing/FullTextSearch/DataHistory — not for non-stored objects (processor, processor-tabular)
if ($context -notin @("processor", "processor-tabular")) {
$indexing = "DontIndex"
if ($parsed.flags -contains "index") { $indexing = "Index" }
if ($parsed.flags -contains "indexadditional") { $indexing = "IndexWithAdditionalOrder" }
if ($parsed.indexing) { $indexing = $parsed.indexing }
X "$indent`t`t<Indexing>$indexing</Indexing>"
X "$indent`t`t<FullTextSearch>Use</FullTextSearch>"
X "$indent`t`t<DataHistory>Use</DataHistory>"
X "$indent`t`t<FullTextSearch>Use</FullTextSearch>"
X "$indent`t`t<DataHistory>Use</DataHistory>"
}
X "$indent`t</Properties>"
X "$indent</Attribute>"
@@ -688,10 +690,11 @@ function Emit-TabularSection {
}
X "$indent`t</Properties>"
$tsContext = if ($objectType -in @("DataProcessor","Report")) { "processor-tabular" } else { "tabular" }
X "$indent`t<ChildObjects>"
foreach ($col in $columns) {
$parsed = Parse-AttributeShorthand $col
Emit-Attribute "$indent`t`t" $parsed "tabular"
Emit-Attribute "$indent`t`t" $parsed $tsContext
}
X "$indent`t</ChildObjects>"
@@ -2447,6 +2450,7 @@ if ($objType -in $typesWithAttrTS) {
$context = switch ($objType) {
"Catalog" { "catalog" }
"Document" { "document" }
{ $_ -in @("DataProcessor","Report") } { "processor" }
default { "object" }
}
foreach ($a in $attrs) {
+21 -16
View File
@@ -660,6 +660,7 @@ function Get-AttributeContext {
"Catalog" { return "catalog" }
"Document" { return "document" }
{ $_ -in @("InformationRegister","AccumulationRegister","AccountingRegister","CalculationRegister") } { return "register" }
{ $_ -in @("DataProcessor","Report","ExternalDataProcessor","ExternalReport") } { return "processor" }
default { return "object" }
}
}
@@ -698,8 +699,8 @@ function Build-AttributeFragment {
$sb.AppendLine("$indent`t`t<MinValue xsi:nil=`"true`"/>") | Out-Null
$sb.AppendLine("$indent`t`t<MaxValue xsi:nil=`"true`"/>") | Out-Null
# FillFromFillingValue — for catalog/document/object contexts
if ($context -ne "register") {
# FillFromFillingValue/FillValue — not for register, tabular (config TS), or processor (non-stored top-level)
if ($context -notin @("register", "tabular", "processor")) {
$sb.AppendLine("$indent`t`t<FillFromFillingValue>false</FillFromFillingValue>") | Out-Null
$sb.AppendLine($(Build-FillValueXml "$indent`t`t" $typeStr)) | Out-Null
}
@@ -719,20 +720,22 @@ function Build-AttributeFragment {
$sb.AppendLine("$indent`t`t<LinkByType/>") | Out-Null
$sb.AppendLine("$indent`t`t<ChoiceHistoryOnInput>Auto</ChoiceHistoryOnInput>") | Out-Null
# Use — catalog/document only
if ($context -eq "catalog" -or $context -eq "document") {
# Use — catalog only
if ($context -eq "catalog") {
$sb.AppendLine("$indent`t`t<Use>ForItem</Use>") | Out-Null
}
# Indexing
$indexing = "DontIndex"
if ($parsed.flags -contains "index") { $indexing = "Index" }
if ($parsed.flags -contains "indexadditional") { $indexing = "IndexWithAdditionalOrder" }
if ($parsed.indexing) { $indexing = $parsed.indexing }
$sb.AppendLine("$indent`t`t<Indexing>$indexing</Indexing>") | Out-Null
# Indexing/FullTextSearch/DataHistory — not for non-stored objects (processor, processor-tabular)
if ($context -notin @("processor", "processor-tabular")) {
$indexing = "DontIndex"
if ($parsed.flags -contains "index") { $indexing = "Index" }
if ($parsed.flags -contains "indexadditional") { $indexing = "IndexWithAdditionalOrder" }
if ($parsed.indexing) { $indexing = $parsed.indexing }
$sb.AppendLine("$indent`t`t<Indexing>$indexing</Indexing>") | Out-Null
$sb.AppendLine("$indent`t`t<FullTextSearch>Use</FullTextSearch>") | Out-Null
$sb.AppendLine("$indent`t`t<DataHistory>Use</DataHistory>") | Out-Null
$sb.AppendLine("$indent`t`t<FullTextSearch>Use</FullTextSearch>") | Out-Null
$sb.AppendLine("$indent`t`t<DataHistory>Use</DataHistory>") | Out-Null
}
$sb.AppendLine("$indent`t</Properties>") | Out-Null
$sb.Append("$indent</Attribute>") | Out-Null
@@ -804,8 +807,8 @@ function Build-TabularSectionFragment {
$sb.AppendLine("$indent`t`t`t</xr:StandardAttribute>") | Out-Null
$sb.AppendLine("$indent`t`t</StandardAttributes>") | Out-Null
# Use — catalog/document only
if ($objType -in @("Catalog","Document")) {
# Use — catalog only
if ($objType -eq "Catalog") {
$sb.AppendLine("$indent`t`t<Use>ForItem</Use>") | Out-Null
}
@@ -817,11 +820,12 @@ function Build-TabularSectionFragment {
elseif ($tsDef.attributes) { $columns = @($tsDef.attributes) }
elseif ($tsDef.реквизиты) { $columns = @($tsDef.реквизиты) }
$tsAttrContext = if ($script:objType -in @("DataProcessor","Report","ExternalDataProcessor","ExternalReport")) { "processor-tabular" } else { "tabular" }
if ($columns.Count -gt 0) {
$sb.AppendLine("$indent`t<ChildObjects>") | Out-Null
foreach ($col in $columns) {
$colParsed = Parse-AttributeShorthand $col
$sb.AppendLine($(Build-AttributeFragment $colParsed "tabular" "$indent`t`t")) | Out-Null
$sb.AppendLine($(Build-AttributeFragment $colParsed $tsAttrContext "$indent`t`t")) | Out-Null
}
$sb.AppendLine("$indent`t</ChildObjects>") | Out-Null
} else {
@@ -1816,7 +1820,8 @@ function Modify-ChildElements($modifyDef, [string]$childType) {
continue
}
$tsAttrIndent = Get-ChildIndent $tsChildObjEl
$fragmentXml = Build-AttributeFragment $parsed "tabular" $tsAttrIndent
$tsAttrContext = if ($script:objType -in @("DataProcessor","Report","ExternalDataProcessor","ExternalReport")) { "processor-tabular" } else { "tabular" }
$fragmentXml = Build-AttributeFragment $parsed $tsAttrContext $tsAttrIndent
$nodes = Import-Fragment $fragmentXml
$savedCO = $script:childObjectsEl
$script:childObjectsEl = $tsChildObjEl
+7 -2
View File
@@ -716,9 +716,11 @@ Ext/ # Расширение конфигураци
|---|---|---|
| `Indexing` | enum | `DontIndex` \| `Index` \| `IndexWithAdditionalOrder` |
| `ChoiceFoldersAndItems` | enum | `Items` \| `Folders` \| `FoldersAndItems` |
| `Use` | enum | `ForItem` \| `ForFolder` \| `ForFolderAndItem` (только для иерарх. справочников) |
| `Use` | enum | `ForItem` \| `ForFolder` \| `ForFolderAndItem` (только для справочников) |
| `FillFromFillingValue` | boolean | Заполнять из значения по умолчанию |
> **Различие хранимых и нехранимых объектов**: Свойства `Indexing`, `FullTextSearch`, `DataHistory`, `FillFromFillingValue`, `FillValue` присутствуют только у **хранимых** объектов (Catalog, Document, ExchangePlan, ChartOf*, BusinessProcess, Task). У объектов DataProcessor и Report (как в конфигурации, так и внешних EPF/ERF) эти свойства **отсутствуют**. Свойство `Use` есть только у справочников (Catalog).
### 6.2. Табличная часть (TabularSection)
```xml
@@ -749,7 +751,10 @@ Ext/ # Расширение конфигураци
<ChildObjects>
<Attribute uuid="...">
<!-- Реквизиты-колонки таблицы: формат как у обычных реквизитов,
но без FillFromFillingValue, FillValue, Use -->
но без FillFromFillingValue, FillValue, Use.
У нехранимых объектов (DataProcessor, Report) реквизиты ТЧ
содержат FillFromFillingValue и FillValue, но не содержат
Indexing, FullTextSearch, DataHistory -->
</Attribute>
</ChildObjects>
</TabularSection>
+1 -1
View File
@@ -314,7 +314,7 @@ xmlns="http://v8.1c.ru/8.3/xcf/logform"
</TabularSection>
```
> **Важно**: Реквизиты табличных частей имеют 2 дополнительных свойства по сравнению с реквизитами объекта: `FillFromFillingValue` и `FillValue`. Они вставляются между `MaxValue` и `FillChecking`.
> **Важно**: Реквизиты табличных частей имеют 2 дополнительных свойства по сравнению с реквизитами объекта: `FillFromFillingValue` и `FillValue`. Они вставляются между `MaxValue` и `FillChecking`. При этом свойства `Indexing`, `FullTextSearch`, `DataHistory` и `Use` **отсутствуют** как у реквизитов объекта, так и у реквизитов ТЧ обработок/отчётов (в отличие от хранимых объектов конфигурации).
## 4. Метаданные формы (`Forms/<Имя>.xml`)