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